1 /* Simulator instruction semantics for m32rx.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
7 This file is part of the GNU Simulators.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #define WANT_CPU_M32RX
36 #define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->idesc->opcode, CGEN_INSN_##attr)
38 /* add: add $dr,$sr. */
41 SEM_FN_NAME (m32rx
,add
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
43 insn_t insn
= SEM_INSN (sem_arg
);
44 #define OPRND(f) par_exec->operands.fmt_add.f
45 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
46 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
48 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
52 SI opval
= ADDSI (OPRND (dr
), OPRND (sr
));
53 CPU (h_gr
[f_r1
]) = opval
;
54 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
57 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
59 #if WITH_PROFILE_MODEL_P
60 if (PROFILE_MODEL_P (current_cpu
))
62 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
63 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
64 m32rx_model_profile_insn (current_cpu
, abuf
);
72 /* add3: add3 $dr,$sr,$hash$slo16. */
75 SEM_FN_NAME (m32rx
,add3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
77 insn_t insn
= SEM_INSN (sem_arg
);
78 #define OPRND(f) par_exec->operands.fmt_add3.f
79 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
80 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
82 EXTRACT_FMT_ADD3_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
86 SI opval
= ADDSI (OPRND (sr
), OPRND (slo16
));
87 CPU (h_gr
[f_r1
]) = opval
;
88 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
91 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
93 #if WITH_PROFILE_MODEL_P
94 if (PROFILE_MODEL_P (current_cpu
))
96 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
97 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
98 m32rx_model_profile_insn (current_cpu
, abuf
);
106 /* and: and $dr,$sr. */
109 SEM_FN_NAME (m32rx
,and) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
111 insn_t insn
= SEM_INSN (sem_arg
);
112 #define OPRND(f) par_exec->operands.fmt_add.f
113 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
114 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
116 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
120 SI opval
= ANDSI (OPRND (dr
), OPRND (sr
));
121 CPU (h_gr
[f_r1
]) = opval
;
122 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
125 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
127 #if WITH_PROFILE_MODEL_P
128 if (PROFILE_MODEL_P (current_cpu
))
130 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
131 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
132 m32rx_model_profile_insn (current_cpu
, abuf
);
140 /* and3: and3 $dr,$sr,$uimm16. */
143 SEM_FN_NAME (m32rx
,and3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
145 insn_t insn
= SEM_INSN (sem_arg
);
146 #define OPRND(f) par_exec->operands.fmt_and3.f
147 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
148 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
150 EXTRACT_FMT_AND3_VARS
/* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
151 EXTRACT_FMT_AND3_CODE
154 SI opval
= ANDSI (OPRND (sr
), OPRND (uimm16
));
155 CPU (h_gr
[f_r1
]) = opval
;
156 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
159 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
161 #if WITH_PROFILE_MODEL_P
162 if (PROFILE_MODEL_P (current_cpu
))
164 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
165 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
166 m32rx_model_profile_insn (current_cpu
, abuf
);
174 /* or: or $dr,$sr. */
177 SEM_FN_NAME (m32rx
,or) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
179 insn_t insn
= SEM_INSN (sem_arg
);
180 #define OPRND(f) par_exec->operands.fmt_add.f
181 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
182 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
184 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
188 SI opval
= ORSI (OPRND (dr
), OPRND (sr
));
189 CPU (h_gr
[f_r1
]) = opval
;
190 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
193 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
195 #if WITH_PROFILE_MODEL_P
196 if (PROFILE_MODEL_P (current_cpu
))
198 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
199 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
200 m32rx_model_profile_insn (current_cpu
, abuf
);
208 /* or3: or3 $dr,$sr,$hash$ulo16. */
211 SEM_FN_NAME (m32rx
,or3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
213 insn_t insn
= SEM_INSN (sem_arg
);
214 #define OPRND(f) par_exec->operands.fmt_or3.f
215 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
216 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
218 EXTRACT_FMT_OR3_VARS
/* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
222 SI opval
= ORSI (OPRND (sr
), OPRND (ulo16
));
223 CPU (h_gr
[f_r1
]) = opval
;
224 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
227 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
229 #if WITH_PROFILE_MODEL_P
230 if (PROFILE_MODEL_P (current_cpu
))
232 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
233 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
234 m32rx_model_profile_insn (current_cpu
, abuf
);
242 /* xor: xor $dr,$sr. */
245 SEM_FN_NAME (m32rx
,xor) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
247 insn_t insn
= SEM_INSN (sem_arg
);
248 #define OPRND(f) par_exec->operands.fmt_add.f
249 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
250 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
252 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
256 SI opval
= XORSI (OPRND (dr
), OPRND (sr
));
257 CPU (h_gr
[f_r1
]) = opval
;
258 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
261 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
263 #if WITH_PROFILE_MODEL_P
264 if (PROFILE_MODEL_P (current_cpu
))
266 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
267 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
268 m32rx_model_profile_insn (current_cpu
, abuf
);
276 /* xor3: xor3 $dr,$sr,$uimm16. */
279 SEM_FN_NAME (m32rx
,xor3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
281 insn_t insn
= SEM_INSN (sem_arg
);
282 #define OPRND(f) par_exec->operands.fmt_and3.f
283 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
284 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
286 EXTRACT_FMT_AND3_VARS
/* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
287 EXTRACT_FMT_AND3_CODE
290 SI opval
= XORSI (OPRND (sr
), OPRND (uimm16
));
291 CPU (h_gr
[f_r1
]) = opval
;
292 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
295 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
297 #if WITH_PROFILE_MODEL_P
298 if (PROFILE_MODEL_P (current_cpu
))
300 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
301 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
302 m32rx_model_profile_insn (current_cpu
, abuf
);
310 /* addi: addi $dr,$simm8. */
313 SEM_FN_NAME (m32rx
,addi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
315 insn_t insn
= SEM_INSN (sem_arg
);
316 #define OPRND(f) par_exec->operands.fmt_addi.f
317 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
318 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
320 EXTRACT_FMT_ADDI_VARS
/* f-op1 f-r1 f-simm8 */
321 EXTRACT_FMT_ADDI_CODE
324 SI opval
= ADDSI (OPRND (dr
), OPRND (simm8
));
325 CPU (h_gr
[f_r1
]) = opval
;
326 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
329 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
331 #if WITH_PROFILE_MODEL_P
332 if (PROFILE_MODEL_P (current_cpu
))
334 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
335 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
336 m32rx_model_profile_insn (current_cpu
, abuf
);
344 /* addv: addv $dr,$sr. */
347 SEM_FN_NAME (m32rx
,addv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
349 insn_t insn
= SEM_INSN (sem_arg
);
350 #define OPRND(f) par_exec->operands.fmt_addv.f
351 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
352 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
354 EXTRACT_FMT_ADDV_VARS
/* f-op1 f-r1 f-op2 f-r2 */
355 EXTRACT_FMT_ADDV_CODE
359 temp0
= ADDSI (OPRND (dr
), OPRND (sr
));
360 temp1
= ADDOFSI (OPRND (dr
), OPRND (sr
), 0);
363 CPU (h_gr
[f_r1
]) = opval
;
364 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
368 CPU (h_cond
) = opval
;
369 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
373 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
375 #if WITH_PROFILE_MODEL_P
376 if (PROFILE_MODEL_P (current_cpu
))
378 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
379 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
380 m32rx_model_profile_insn (current_cpu
, abuf
);
388 /* addv3: addv3 $dr,$sr,$simm16. */
391 SEM_FN_NAME (m32rx
,addv3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
393 insn_t insn
= SEM_INSN (sem_arg
);
394 #define OPRND(f) par_exec->operands.fmt_addv3.f
395 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
396 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
398 EXTRACT_FMT_ADDV3_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
399 EXTRACT_FMT_ADDV3_CODE
403 temp0
= ADDSI (OPRND (sr
), OPRND (simm16
));
404 temp1
= ADDOFSI (OPRND (sr
), OPRND (simm16
), 0);
407 CPU (h_gr
[f_r1
]) = opval
;
408 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
412 CPU (h_cond
) = opval
;
413 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
417 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
419 #if WITH_PROFILE_MODEL_P
420 if (PROFILE_MODEL_P (current_cpu
))
422 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
423 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
424 m32rx_model_profile_insn (current_cpu
, abuf
);
432 /* addx: addx $dr,$sr. */
435 SEM_FN_NAME (m32rx
,addx
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
437 insn_t insn
= SEM_INSN (sem_arg
);
438 #define OPRND(f) par_exec->operands.fmt_addx.f
439 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
440 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
442 EXTRACT_FMT_ADDX_VARS
/* f-op1 f-r1 f-op2 f-r2 */
443 EXTRACT_FMT_ADDX_CODE
447 temp0
= ADDCSI (OPRND (dr
), OPRND (sr
), OPRND (condbit
));
448 temp1
= ADDCFSI (OPRND (dr
), OPRND (sr
), OPRND (condbit
));
451 CPU (h_gr
[f_r1
]) = opval
;
452 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
456 CPU (h_cond
) = opval
;
457 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
461 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
463 #if WITH_PROFILE_MODEL_P
464 if (PROFILE_MODEL_P (current_cpu
))
466 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
467 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
468 m32rx_model_profile_insn (current_cpu
, abuf
);
476 /* bc8: bc.s $disp8. */
479 SEM_FN_NAME (m32rx
,bc8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
481 insn_t insn
= SEM_INSN (sem_arg
);
482 #define OPRND(f) par_exec->operands.fmt_bc8.f
483 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
484 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
487 EXTRACT_FMT_BC8_VARS
/* f-op1 f-r1 f-disp8 */
490 if (OPRND (condbit
)) {
492 USI opval
= OPRND (disp8
);
493 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
495 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
499 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
501 #if WITH_PROFILE_MODEL_P
502 if (PROFILE_MODEL_P (current_cpu
))
504 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
512 /* bc24: bc.l $disp24. */
515 SEM_FN_NAME (m32rx
,bc24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
517 insn_t insn
= SEM_INSN (sem_arg
);
518 #define OPRND(f) par_exec->operands.fmt_bc24.f
519 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
520 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
523 EXTRACT_FMT_BC24_VARS
/* f-op1 f-r1 f-disp24 */
524 EXTRACT_FMT_BC24_CODE
526 if (OPRND (condbit
)) {
528 USI opval
= OPRND (disp24
);
529 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
531 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
535 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
537 #if WITH_PROFILE_MODEL_P
538 if (PROFILE_MODEL_P (current_cpu
))
540 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
548 /* beq: beq $src1,$src2,$disp16. */
551 SEM_FN_NAME (m32rx
,beq
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
553 insn_t insn
= SEM_INSN (sem_arg
);
554 #define OPRND(f) par_exec->operands.fmt_beq.f
555 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
556 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
559 EXTRACT_FMT_BEQ_VARS
/* f-op1 f-r1 f-op2 f-r2 f-disp16 */
562 if (EQSI (OPRND (src1
), OPRND (src2
))) {
564 USI opval
= OPRND (disp16
);
565 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
567 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
571 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
573 #if WITH_PROFILE_MODEL_P
574 if (PROFILE_MODEL_P (current_cpu
))
576 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
577 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
585 /* beqz: beqz $src2,$disp16. */
588 SEM_FN_NAME (m32rx
,beqz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
590 insn_t insn
= SEM_INSN (sem_arg
);
591 #define OPRND(f) par_exec->operands.fmt_beqz.f
592 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
593 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
596 EXTRACT_FMT_BEQZ_VARS
/* f-op1 f-r1 f-op2 f-r2 f-disp16 */
597 EXTRACT_FMT_BEQZ_CODE
599 if (EQSI (OPRND (src2
), 0)) {
601 USI opval
= OPRND (disp16
);
602 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
604 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
608 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
610 #if WITH_PROFILE_MODEL_P
611 if (PROFILE_MODEL_P (current_cpu
))
613 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
614 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
622 /* bgez: bgez $src2,$disp16. */
625 SEM_FN_NAME (m32rx
,bgez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
627 insn_t insn
= SEM_INSN (sem_arg
);
628 #define OPRND(f) par_exec->operands.fmt_beqz.f
629 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
630 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
633 EXTRACT_FMT_BEQZ_VARS
/* f-op1 f-r1 f-op2 f-r2 f-disp16 */
634 EXTRACT_FMT_BEQZ_CODE
636 if (GESI (OPRND (src2
), 0)) {
638 USI opval
= OPRND (disp16
);
639 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
641 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
645 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
647 #if WITH_PROFILE_MODEL_P
648 if (PROFILE_MODEL_P (current_cpu
))
650 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
651 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
659 /* bgtz: bgtz $src2,$disp16. */
662 SEM_FN_NAME (m32rx
,bgtz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
664 insn_t insn
= SEM_INSN (sem_arg
);
665 #define OPRND(f) par_exec->operands.fmt_beqz.f
666 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
667 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
670 EXTRACT_FMT_BEQZ_VARS
/* f-op1 f-r1 f-op2 f-r2 f-disp16 */
671 EXTRACT_FMT_BEQZ_CODE
673 if (GTSI (OPRND (src2
), 0)) {
675 USI opval
= OPRND (disp16
);
676 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
678 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
682 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
684 #if WITH_PROFILE_MODEL_P
685 if (PROFILE_MODEL_P (current_cpu
))
687 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
688 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
696 /* blez: blez $src2,$disp16. */
699 SEM_FN_NAME (m32rx
,blez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
701 insn_t insn
= SEM_INSN (sem_arg
);
702 #define OPRND(f) par_exec->operands.fmt_beqz.f
703 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
704 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
707 EXTRACT_FMT_BEQZ_VARS
/* f-op1 f-r1 f-op2 f-r2 f-disp16 */
708 EXTRACT_FMT_BEQZ_CODE
710 if (LESI (OPRND (src2
), 0)) {
712 USI opval
= OPRND (disp16
);
713 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
715 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
719 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
721 #if WITH_PROFILE_MODEL_P
722 if (PROFILE_MODEL_P (current_cpu
))
724 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
725 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
733 /* bltz: bltz $src2,$disp16. */
736 SEM_FN_NAME (m32rx
,bltz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
738 insn_t insn
= SEM_INSN (sem_arg
);
739 #define OPRND(f) par_exec->operands.fmt_beqz.f
740 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
741 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
744 EXTRACT_FMT_BEQZ_VARS
/* f-op1 f-r1 f-op2 f-r2 f-disp16 */
745 EXTRACT_FMT_BEQZ_CODE
747 if (LTSI (OPRND (src2
), 0)) {
749 USI opval
= OPRND (disp16
);
750 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
752 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
756 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
758 #if WITH_PROFILE_MODEL_P
759 if (PROFILE_MODEL_P (current_cpu
))
761 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
762 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
770 /* bnez: bnez $src2,$disp16. */
773 SEM_FN_NAME (m32rx
,bnez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
775 insn_t insn
= SEM_INSN (sem_arg
);
776 #define OPRND(f) par_exec->operands.fmt_beqz.f
777 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
778 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
781 EXTRACT_FMT_BEQZ_VARS
/* f-op1 f-r1 f-op2 f-r2 f-disp16 */
782 EXTRACT_FMT_BEQZ_CODE
784 if (NESI (OPRND (src2
), 0)) {
786 USI opval
= OPRND (disp16
);
787 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
789 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
793 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
795 #if WITH_PROFILE_MODEL_P
796 if (PROFILE_MODEL_P (current_cpu
))
798 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
799 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
807 /* bl8: bl.s $disp8. */
810 SEM_FN_NAME (m32rx
,bl8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
812 insn_t insn
= SEM_INSN (sem_arg
);
813 #define OPRND(f) par_exec->operands.fmt_bl8.f
814 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
815 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
818 EXTRACT_FMT_BL8_VARS
/* f-op1 f-r1 f-disp8 */
823 SI opval
= ADDSI (ANDSI (OPRND (pc
), -4), 4);
824 CPU (h_gr
[((HOSTUINT
) 14)]) = opval
;
825 TRACE_RESULT (current_cpu
, "gr-14", 'x', opval
);
828 USI opval
= OPRND (disp8
);
829 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
831 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
835 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
837 #if WITH_PROFILE_MODEL_P
838 if (PROFILE_MODEL_P (current_cpu
))
840 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
841 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
849 /* bl24: bl.l $disp24. */
852 SEM_FN_NAME (m32rx
,bl24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
854 insn_t insn
= SEM_INSN (sem_arg
);
855 #define OPRND(f) par_exec->operands.fmt_bl24.f
856 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
857 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
860 EXTRACT_FMT_BL24_VARS
/* f-op1 f-r1 f-disp24 */
861 EXTRACT_FMT_BL24_CODE
865 SI opval
= ADDSI (OPRND (pc
), 4);
866 CPU (h_gr
[((HOSTUINT
) 14)]) = opval
;
867 TRACE_RESULT (current_cpu
, "gr-14", 'x', opval
);
870 USI opval
= OPRND (disp24
);
871 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
873 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
877 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
879 #if WITH_PROFILE_MODEL_P
880 if (PROFILE_MODEL_P (current_cpu
))
882 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
883 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
891 /* bcl8: bcl.s $disp8. */
894 SEM_FN_NAME (m32rx
,bcl8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
896 insn_t insn
= SEM_INSN (sem_arg
);
897 #define OPRND(f) par_exec->operands.fmt_bcl8.f
898 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
899 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
902 EXTRACT_FMT_BCL8_VARS
/* f-op1 f-r1 f-disp8 */
903 EXTRACT_FMT_BCL8_CODE
905 if (OPRND (condbit
)) {
908 SI opval
= ADDSI (ANDSI (OPRND (pc
), -4), 4);
909 CPU (h_gr
[((HOSTUINT
) 14)]) = opval
;
910 TRACE_RESULT (current_cpu
, "gr-14", 'x', opval
);
913 USI opval
= OPRND (disp8
);
914 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
916 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
921 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
923 #if WITH_PROFILE_MODEL_P
924 if (PROFILE_MODEL_P (current_cpu
))
926 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
927 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
935 /* bcl24: bcl.l $disp24. */
938 SEM_FN_NAME (m32rx
,bcl24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
940 insn_t insn
= SEM_INSN (sem_arg
);
941 #define OPRND(f) par_exec->operands.fmt_bcl24.f
942 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
943 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
946 EXTRACT_FMT_BCL24_VARS
/* f-op1 f-r1 f-disp24 */
947 EXTRACT_FMT_BCL24_CODE
949 if (OPRND (condbit
)) {
952 SI opval
= ADDSI (OPRND (pc
), 4);
953 CPU (h_gr
[((HOSTUINT
) 14)]) = opval
;
954 TRACE_RESULT (current_cpu
, "gr-14", 'x', opval
);
957 USI opval
= OPRND (disp24
);
958 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
960 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
965 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
967 #if WITH_PROFILE_MODEL_P
968 if (PROFILE_MODEL_P (current_cpu
))
970 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
971 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
979 /* bnc8: bnc.s $disp8. */
982 SEM_FN_NAME (m32rx
,bnc8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
984 insn_t insn
= SEM_INSN (sem_arg
);
985 #define OPRND(f) par_exec->operands.fmt_bc8.f
986 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
987 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
990 EXTRACT_FMT_BC8_VARS
/* f-op1 f-r1 f-disp8 */
993 if (NOTBI (OPRND (condbit
))) {
995 USI opval
= OPRND (disp8
);
996 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
998 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1002 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1004 #if WITH_PROFILE_MODEL_P
1005 if (PROFILE_MODEL_P (current_cpu
))
1007 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1015 /* bnc24: bnc.l $disp24. */
1018 SEM_FN_NAME (m32rx
,bnc24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1020 insn_t insn
= SEM_INSN (sem_arg
);
1021 #define OPRND(f) par_exec->operands.fmt_bc24.f
1022 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1023 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1026 EXTRACT_FMT_BC24_VARS
/* f-op1 f-r1 f-disp24 */
1027 EXTRACT_FMT_BC24_CODE
1029 if (NOTBI (OPRND (condbit
))) {
1031 USI opval
= OPRND (disp24
);
1032 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1034 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1038 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1040 #if WITH_PROFILE_MODEL_P
1041 if (PROFILE_MODEL_P (current_cpu
))
1043 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1051 /* bne: bne $src1,$src2,$disp16. */
1054 SEM_FN_NAME (m32rx
,bne
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1056 insn_t insn
= SEM_INSN (sem_arg
);
1057 #define OPRND(f) par_exec->operands.fmt_beq.f
1058 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1059 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1062 EXTRACT_FMT_BEQ_VARS
/* f-op1 f-r1 f-op2 f-r2 f-disp16 */
1063 EXTRACT_FMT_BEQ_CODE
1065 if (NESI (OPRND (src1
), OPRND (src2
))) {
1067 USI opval
= OPRND (disp16
);
1068 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1070 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1074 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1076 #if WITH_PROFILE_MODEL_P
1077 if (PROFILE_MODEL_P (current_cpu
))
1079 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1080 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1088 /* bra8: bra.s $disp8. */
1091 SEM_FN_NAME (m32rx
,bra8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1093 insn_t insn
= SEM_INSN (sem_arg
);
1094 #define OPRND(f) par_exec->operands.fmt_bra8.f
1095 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1096 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1099 EXTRACT_FMT_BRA8_VARS
/* f-op1 f-r1 f-disp8 */
1100 EXTRACT_FMT_BRA8_CODE
1103 USI opval
= OPRND (disp8
);
1104 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1106 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1109 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1111 #if WITH_PROFILE_MODEL_P
1112 if (PROFILE_MODEL_P (current_cpu
))
1114 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1122 /* bra24: bra.l $disp24. */
1125 SEM_FN_NAME (m32rx
,bra24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1127 insn_t insn
= SEM_INSN (sem_arg
);
1128 #define OPRND(f) par_exec->operands.fmt_bra24.f
1129 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1130 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1133 EXTRACT_FMT_BRA24_VARS
/* f-op1 f-r1 f-disp24 */
1134 EXTRACT_FMT_BRA24_CODE
1137 USI opval
= OPRND (disp24
);
1138 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1140 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1143 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1145 #if WITH_PROFILE_MODEL_P
1146 if (PROFILE_MODEL_P (current_cpu
))
1148 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1156 /* bncl8: bncl.s $disp8. */
1159 SEM_FN_NAME (m32rx
,bncl8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1161 insn_t insn
= SEM_INSN (sem_arg
);
1162 #define OPRND(f) par_exec->operands.fmt_bcl8.f
1163 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1164 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1167 EXTRACT_FMT_BCL8_VARS
/* f-op1 f-r1 f-disp8 */
1168 EXTRACT_FMT_BCL8_CODE
1170 if (NOTBI (OPRND (condbit
))) {
1173 SI opval
= ADDSI (ANDSI (OPRND (pc
), -4), 4);
1174 CPU (h_gr
[((HOSTUINT
) 14)]) = opval
;
1175 TRACE_RESULT (current_cpu
, "gr-14", 'x', opval
);
1178 USI opval
= OPRND (disp8
);
1179 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1181 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1186 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1188 #if WITH_PROFILE_MODEL_P
1189 if (PROFILE_MODEL_P (current_cpu
))
1191 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1192 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1200 /* bncl24: bncl.l $disp24. */
1203 SEM_FN_NAME (m32rx
,bncl24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1205 insn_t insn
= SEM_INSN (sem_arg
);
1206 #define OPRND(f) par_exec->operands.fmt_bcl24.f
1207 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1208 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1211 EXTRACT_FMT_BCL24_VARS
/* f-op1 f-r1 f-disp24 */
1212 EXTRACT_FMT_BCL24_CODE
1214 if (NOTBI (OPRND (condbit
))) {
1217 SI opval
= ADDSI (OPRND (pc
), 4);
1218 CPU (h_gr
[((HOSTUINT
) 14)]) = opval
;
1219 TRACE_RESULT (current_cpu
, "gr-14", 'x', opval
);
1222 USI opval
= OPRND (disp24
);
1223 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1225 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1230 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1232 #if WITH_PROFILE_MODEL_P
1233 if (PROFILE_MODEL_P (current_cpu
))
1235 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1236 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1244 /* cmp: cmp $src1,$src2. */
1247 SEM_FN_NAME (m32rx
,cmp
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1249 insn_t insn
= SEM_INSN (sem_arg
);
1250 #define OPRND(f) par_exec->operands.fmt_cmp.f
1251 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1252 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1254 EXTRACT_FMT_CMP_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1255 EXTRACT_FMT_CMP_CODE
1258 UBI opval
= LTSI (OPRND (src1
), OPRND (src2
));
1259 CPU (h_cond
) = opval
;
1260 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
1263 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1265 #if WITH_PROFILE_MODEL_P
1266 if (PROFILE_MODEL_P (current_cpu
))
1268 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1269 m32rx_model_profile_insn (current_cpu
, abuf
);
1277 /* cmpi: cmpi $src2,$simm16. */
1280 SEM_FN_NAME (m32rx
,cmpi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1282 insn_t insn
= SEM_INSN (sem_arg
);
1283 #define OPRND(f) par_exec->operands.fmt_cmpi.f
1284 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1285 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1287 EXTRACT_FMT_CMPI_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1288 EXTRACT_FMT_CMPI_CODE
1291 UBI opval
= LTSI (OPRND (src2
), OPRND (simm16
));
1292 CPU (h_cond
) = opval
;
1293 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
1296 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1298 #if WITH_PROFILE_MODEL_P
1299 if (PROFILE_MODEL_P (current_cpu
))
1301 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1302 m32rx_model_profile_insn (current_cpu
, abuf
);
1310 /* cmpu: cmpu $src1,$src2. */
1313 SEM_FN_NAME (m32rx
,cmpu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1315 insn_t insn
= SEM_INSN (sem_arg
);
1316 #define OPRND(f) par_exec->operands.fmt_cmp.f
1317 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1318 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1320 EXTRACT_FMT_CMP_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1321 EXTRACT_FMT_CMP_CODE
1324 UBI opval
= LTUSI (OPRND (src1
), OPRND (src2
));
1325 CPU (h_cond
) = opval
;
1326 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
1329 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1331 #if WITH_PROFILE_MODEL_P
1332 if (PROFILE_MODEL_P (current_cpu
))
1334 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1335 m32rx_model_profile_insn (current_cpu
, abuf
);
1343 /* cmpui: cmpui $src2,$simm16. */
1346 SEM_FN_NAME (m32rx
,cmpui
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1348 insn_t insn
= SEM_INSN (sem_arg
);
1349 #define OPRND(f) par_exec->operands.fmt_cmpi.f
1350 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1351 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1353 EXTRACT_FMT_CMPI_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1354 EXTRACT_FMT_CMPI_CODE
1357 UBI opval
= LTUSI (OPRND (src2
), OPRND (simm16
));
1358 CPU (h_cond
) = opval
;
1359 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
1362 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1364 #if WITH_PROFILE_MODEL_P
1365 if (PROFILE_MODEL_P (current_cpu
))
1367 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1368 m32rx_model_profile_insn (current_cpu
, abuf
);
1376 /* cmpeq: cmpeq $src1,$src2. */
1379 SEM_FN_NAME (m32rx
,cmpeq
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1381 insn_t insn
= SEM_INSN (sem_arg
);
1382 #define OPRND(f) par_exec->operands.fmt_cmp.f
1383 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1384 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1386 EXTRACT_FMT_CMP_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1387 EXTRACT_FMT_CMP_CODE
1390 UBI opval
= EQSI (OPRND (src1
), OPRND (src2
));
1391 CPU (h_cond
) = opval
;
1392 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
1395 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1397 #if WITH_PROFILE_MODEL_P
1398 if (PROFILE_MODEL_P (current_cpu
))
1400 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1401 m32rx_model_profile_insn (current_cpu
, abuf
);
1409 /* cmpz: cmpz $src2. */
1412 SEM_FN_NAME (m32rx
,cmpz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1414 insn_t insn
= SEM_INSN (sem_arg
);
1415 #define OPRND(f) par_exec->operands.fmt_cmpz.f
1416 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1417 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1419 EXTRACT_FMT_CMPZ_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1420 EXTRACT_FMT_CMPZ_CODE
1423 UBI opval
= EQSI (OPRND (src2
), 0);
1424 CPU (h_cond
) = opval
;
1425 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
1428 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1430 #if WITH_PROFILE_MODEL_P
1431 if (PROFILE_MODEL_P (current_cpu
))
1433 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1434 m32rx_model_profile_insn (current_cpu
, abuf
);
1442 /* div: div $dr,$sr. */
1445 SEM_FN_NAME (m32rx
,div
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1447 insn_t insn
= SEM_INSN (sem_arg
);
1448 #define OPRND(f) par_exec->operands.fmt_div.f
1449 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1450 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1452 EXTRACT_FMT_DIV_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1453 EXTRACT_FMT_DIV_CODE
1455 if (NESI (OPRND (sr
), 0)) {
1457 SI opval
= DIVSI (OPRND (dr
), OPRND (sr
));
1458 CPU (h_gr
[f_r1
]) = opval
;
1459 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1463 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1465 #if WITH_PROFILE_MODEL_P
1466 if (PROFILE_MODEL_P (current_cpu
))
1468 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1469 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1470 m32rx_model_profile_insn (current_cpu
, abuf
);
1478 /* divu: divu $dr,$sr. */
1481 SEM_FN_NAME (m32rx
,divu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1483 insn_t insn
= SEM_INSN (sem_arg
);
1484 #define OPRND(f) par_exec->operands.fmt_div.f
1485 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1486 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1488 EXTRACT_FMT_DIV_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1489 EXTRACT_FMT_DIV_CODE
1491 if (NESI (OPRND (sr
), 0)) {
1493 SI opval
= UDIVSI (OPRND (dr
), OPRND (sr
));
1494 CPU (h_gr
[f_r1
]) = opval
;
1495 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1499 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1501 #if WITH_PROFILE_MODEL_P
1502 if (PROFILE_MODEL_P (current_cpu
))
1504 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1505 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1506 m32rx_model_profile_insn (current_cpu
, abuf
);
1514 /* rem: rem $dr,$sr. */
1517 SEM_FN_NAME (m32rx
,rem
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1519 insn_t insn
= SEM_INSN (sem_arg
);
1520 #define OPRND(f) par_exec->operands.fmt_div.f
1521 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1522 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1524 EXTRACT_FMT_DIV_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1525 EXTRACT_FMT_DIV_CODE
1527 if (NESI (OPRND (sr
), 0)) {
1529 SI opval
= MODSI (OPRND (dr
), OPRND (sr
));
1530 CPU (h_gr
[f_r1
]) = opval
;
1531 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1535 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1537 #if WITH_PROFILE_MODEL_P
1538 if (PROFILE_MODEL_P (current_cpu
))
1540 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1541 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1542 m32rx_model_profile_insn (current_cpu
, abuf
);
1550 /* remu: remu $dr,$sr. */
1553 SEM_FN_NAME (m32rx
,remu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1555 insn_t insn
= SEM_INSN (sem_arg
);
1556 #define OPRND(f) par_exec->operands.fmt_div.f
1557 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1558 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1560 EXTRACT_FMT_DIV_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1561 EXTRACT_FMT_DIV_CODE
1563 if (NESI (OPRND (sr
), 0)) {
1565 SI opval
= UMODSI (OPRND (dr
), OPRND (sr
));
1566 CPU (h_gr
[f_r1
]) = opval
;
1567 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1571 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1573 #if WITH_PROFILE_MODEL_P
1574 if (PROFILE_MODEL_P (current_cpu
))
1576 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1577 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1578 m32rx_model_profile_insn (current_cpu
, abuf
);
1586 /* divh: divh $dr,$sr. */
1589 SEM_FN_NAME (m32rx
,divh
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1591 insn_t insn
= SEM_INSN (sem_arg
);
1592 #define OPRND(f) par_exec->operands.fmt_div.f
1593 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1594 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1596 EXTRACT_FMT_DIV_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1597 EXTRACT_FMT_DIV_CODE
1599 if (NESI (OPRND (sr
), 0)) {
1601 SI opval
= DIVSI (EXTHISI (TRUNCSIHI (OPRND (dr
))), OPRND (sr
));
1602 CPU (h_gr
[f_r1
]) = opval
;
1603 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1607 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1609 #if WITH_PROFILE_MODEL_P
1610 if (PROFILE_MODEL_P (current_cpu
))
1612 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1613 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1614 m32rx_model_profile_insn (current_cpu
, abuf
);
1625 SEM_FN_NAME (m32rx
,jc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1627 insn_t insn
= SEM_INSN (sem_arg
);
1628 #define OPRND(f) par_exec->operands.fmt_jc.f
1629 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1630 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1633 EXTRACT_FMT_JC_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1636 if (OPRND (condbit
)) {
1638 USI opval
= ANDSI (OPRND (sr
), -4);
1639 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1641 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1645 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1647 #if WITH_PROFILE_MODEL_P
1648 if (PROFILE_MODEL_P (current_cpu
))
1650 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1651 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1662 SEM_FN_NAME (m32rx
,jnc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1664 insn_t insn
= SEM_INSN (sem_arg
);
1665 #define OPRND(f) par_exec->operands.fmt_jc.f
1666 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1667 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1670 EXTRACT_FMT_JC_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1673 if (NOTBI (OPRND (condbit
))) {
1675 USI opval
= ANDSI (OPRND (sr
), -4);
1676 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1678 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1682 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1684 #if WITH_PROFILE_MODEL_P
1685 if (PROFILE_MODEL_P (current_cpu
))
1687 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1688 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1699 SEM_FN_NAME (m32rx
,jl
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1701 insn_t insn
= SEM_INSN (sem_arg
);
1702 #define OPRND(f) par_exec->operands.fmt_jl.f
1703 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1704 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1707 EXTRACT_FMT_JL_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1712 temp0
= ADDSI (ANDSI (OPRND (pc
), -4), 4);
1713 temp1
= ANDSI (OPRND (sr
), -4);
1716 CPU (h_gr
[((HOSTUINT
) 14)]) = opval
;
1717 TRACE_RESULT (current_cpu
, "gr-14", 'x', opval
);
1721 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1723 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1727 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1729 #if WITH_PROFILE_MODEL_P
1730 if (PROFILE_MODEL_P (current_cpu
))
1732 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1733 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1734 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1745 SEM_FN_NAME (m32rx
,jmp
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1747 insn_t insn
= SEM_INSN (sem_arg
);
1748 #define OPRND(f) par_exec->operands.fmt_jmp.f
1749 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1750 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1753 EXTRACT_FMT_JMP_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1754 EXTRACT_FMT_JMP_CODE
1757 USI opval
= ANDSI (OPRND (sr
), -4);
1758 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
1760 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
1763 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1765 #if WITH_PROFILE_MODEL_P
1766 if (PROFILE_MODEL_P (current_cpu
))
1768 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1769 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
1777 /* ld: ld $dr,@$sr. */
1780 SEM_FN_NAME (m32rx
,ld
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1782 insn_t insn
= SEM_INSN (sem_arg
);
1783 #define OPRND(f) par_exec->operands.fmt_ld.f
1784 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1785 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1787 EXTRACT_FMT_LD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1791 SI opval
= OPRND (h_memory_sr
);
1792 CPU (h_gr
[f_r1
]) = opval
;
1793 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1796 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1798 #if WITH_PROFILE_MODEL_P
1799 if (PROFILE_MODEL_P (current_cpu
))
1801 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1802 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1803 m32rx_model_profile_insn (current_cpu
, abuf
);
1811 /* ld-d: ld $dr,@($slo16,$sr). */
1814 SEM_FN_NAME (m32rx
,ld_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1816 insn_t insn
= SEM_INSN (sem_arg
);
1817 #define OPRND(f) par_exec->operands.fmt_ld_d.f
1818 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1819 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1821 EXTRACT_FMT_LD_D_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1822 EXTRACT_FMT_LD_D_CODE
1825 SI opval
= OPRND (h_memory_add__VM_sr_slo16
);
1826 CPU (h_gr
[f_r1
]) = opval
;
1827 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1830 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1832 #if WITH_PROFILE_MODEL_P
1833 if (PROFILE_MODEL_P (current_cpu
))
1835 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1836 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1837 m32rx_model_profile_insn (current_cpu
, abuf
);
1845 /* ldb: ldb $dr,@$sr. */
1848 SEM_FN_NAME (m32rx
,ldb
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1850 insn_t insn
= SEM_INSN (sem_arg
);
1851 #define OPRND(f) par_exec->operands.fmt_ldb.f
1852 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1853 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1855 EXTRACT_FMT_LDB_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1856 EXTRACT_FMT_LDB_CODE
1859 SI opval
= EXTQISI (OPRND (h_memory_sr
));
1860 CPU (h_gr
[f_r1
]) = opval
;
1861 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1864 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1866 #if WITH_PROFILE_MODEL_P
1867 if (PROFILE_MODEL_P (current_cpu
))
1869 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1870 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1871 m32rx_model_profile_insn (current_cpu
, abuf
);
1879 /* ldb-d: ldb $dr,@($slo16,$sr). */
1882 SEM_FN_NAME (m32rx
,ldb_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1884 insn_t insn
= SEM_INSN (sem_arg
);
1885 #define OPRND(f) par_exec->operands.fmt_ldb_d.f
1886 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1887 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1889 EXTRACT_FMT_LDB_D_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1890 EXTRACT_FMT_LDB_D_CODE
1893 SI opval
= EXTQISI (OPRND (h_memory_add__VM_sr_slo16
));
1894 CPU (h_gr
[f_r1
]) = opval
;
1895 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1898 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1900 #if WITH_PROFILE_MODEL_P
1901 if (PROFILE_MODEL_P (current_cpu
))
1903 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1904 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1905 m32rx_model_profile_insn (current_cpu
, abuf
);
1913 /* ldh: ldh $dr,@$sr. */
1916 SEM_FN_NAME (m32rx
,ldh
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1918 insn_t insn
= SEM_INSN (sem_arg
);
1919 #define OPRND(f) par_exec->operands.fmt_ldh.f
1920 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1921 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1923 EXTRACT_FMT_LDH_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1924 EXTRACT_FMT_LDH_CODE
1927 SI opval
= EXTHISI (OPRND (h_memory_sr
));
1928 CPU (h_gr
[f_r1
]) = opval
;
1929 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1932 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1934 #if WITH_PROFILE_MODEL_P
1935 if (PROFILE_MODEL_P (current_cpu
))
1937 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1938 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1939 m32rx_model_profile_insn (current_cpu
, abuf
);
1947 /* ldh-d: ldh $dr,@($slo16,$sr). */
1950 SEM_FN_NAME (m32rx
,ldh_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1952 insn_t insn
= SEM_INSN (sem_arg
);
1953 #define OPRND(f) par_exec->operands.fmt_ldh_d.f
1954 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1955 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
1957 EXTRACT_FMT_LDH_D_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1958 EXTRACT_FMT_LDH_D_CODE
1961 SI opval
= EXTHISI (OPRND (h_memory_add__VM_sr_slo16
));
1962 CPU (h_gr
[f_r1
]) = opval
;
1963 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
1966 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
1968 #if WITH_PROFILE_MODEL_P
1969 if (PROFILE_MODEL_P (current_cpu
))
1971 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
1972 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
1973 m32rx_model_profile_insn (current_cpu
, abuf
);
1981 /* ldub: ldub $dr,@$sr. */
1984 SEM_FN_NAME (m32rx
,ldub
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
1986 insn_t insn
= SEM_INSN (sem_arg
);
1987 #define OPRND(f) par_exec->operands.fmt_ldb.f
1988 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1989 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
1991 EXTRACT_FMT_LDB_VARS
/* f-op1 f-r1 f-op2 f-r2 */
1992 EXTRACT_FMT_LDB_CODE
1995 SI opval
= ZEXTQISI (OPRND (h_memory_sr
));
1996 CPU (h_gr
[f_r1
]) = opval
;
1997 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2000 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2002 #if WITH_PROFILE_MODEL_P
2003 if (PROFILE_MODEL_P (current_cpu
))
2005 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2006 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2007 m32rx_model_profile_insn (current_cpu
, abuf
);
2015 /* ldub-d: ldub $dr,@($slo16,$sr). */
2018 SEM_FN_NAME (m32rx
,ldub_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2020 insn_t insn
= SEM_INSN (sem_arg
);
2021 #define OPRND(f) par_exec->operands.fmt_ldb_d.f
2022 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2023 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
2025 EXTRACT_FMT_LDB_D_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2026 EXTRACT_FMT_LDB_D_CODE
2029 SI opval
= ZEXTQISI (OPRND (h_memory_add__VM_sr_slo16
));
2030 CPU (h_gr
[f_r1
]) = opval
;
2031 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2034 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2036 #if WITH_PROFILE_MODEL_P
2037 if (PROFILE_MODEL_P (current_cpu
))
2039 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2040 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2041 m32rx_model_profile_insn (current_cpu
, abuf
);
2049 /* lduh: lduh $dr,@$sr. */
2052 SEM_FN_NAME (m32rx
,lduh
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2054 insn_t insn
= SEM_INSN (sem_arg
);
2055 #define OPRND(f) par_exec->operands.fmt_ldh.f
2056 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2057 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2059 EXTRACT_FMT_LDH_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2060 EXTRACT_FMT_LDH_CODE
2063 SI opval
= ZEXTHISI (OPRND (h_memory_sr
));
2064 CPU (h_gr
[f_r1
]) = opval
;
2065 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2068 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2070 #if WITH_PROFILE_MODEL_P
2071 if (PROFILE_MODEL_P (current_cpu
))
2073 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2074 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2075 m32rx_model_profile_insn (current_cpu
, abuf
);
2083 /* lduh-d: lduh $dr,@($slo16,$sr). */
2086 SEM_FN_NAME (m32rx
,lduh_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2088 insn_t insn
= SEM_INSN (sem_arg
);
2089 #define OPRND(f) par_exec->operands.fmt_ldh_d.f
2090 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2091 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
2093 EXTRACT_FMT_LDH_D_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2094 EXTRACT_FMT_LDH_D_CODE
2097 SI opval
= ZEXTHISI (OPRND (h_memory_add__VM_sr_slo16
));
2098 CPU (h_gr
[f_r1
]) = opval
;
2099 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2102 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2104 #if WITH_PROFILE_MODEL_P
2105 if (PROFILE_MODEL_P (current_cpu
))
2107 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2108 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2109 m32rx_model_profile_insn (current_cpu
, abuf
);
2117 /* ld-plus: ld $dr,@$sr+. */
2120 SEM_FN_NAME (m32rx
,ld_plus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2122 insn_t insn
= SEM_INSN (sem_arg
);
2123 #define OPRND(f) par_exec->operands.fmt_ld_plus.f
2124 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2125 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2127 EXTRACT_FMT_LD_PLUS_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2128 EXTRACT_FMT_LD_PLUS_CODE
2132 temp0
= OPRND (h_memory_sr
);
2133 temp1
= ADDSI (OPRND (sr
), 4);
2136 CPU (h_gr
[f_r1
]) = opval
;
2137 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2141 CPU (h_gr
[f_r2
]) = opval
;
2142 TRACE_RESULT (current_cpu
, "sr", 'x', opval
);
2146 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2148 #if WITH_PROFILE_MODEL_P
2149 if (PROFILE_MODEL_P (current_cpu
))
2151 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2152 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2153 m32rx_model_profile_insn (current_cpu
, abuf
);
2161 /* ld24: ld24 $dr,$uimm24. */
2164 SEM_FN_NAME (m32rx
,ld24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2166 insn_t insn
= SEM_INSN (sem_arg
);
2167 #define OPRND(f) par_exec->operands.fmt_ld24.f
2168 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2169 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
2171 EXTRACT_FMT_LD24_VARS
/* f-op1 f-r1 f-uimm24 */
2172 EXTRACT_FMT_LD24_CODE
2175 SI opval
= OPRND (uimm24
);
2176 CPU (h_gr
[f_r1
]) = opval
;
2177 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2180 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2182 #if WITH_PROFILE_MODEL_P
2183 if (PROFILE_MODEL_P (current_cpu
))
2185 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2186 m32rx_model_profile_insn (current_cpu
, abuf
);
2194 /* ldi8: ldi8 $dr,$simm8. */
2197 SEM_FN_NAME (m32rx
,ldi8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2199 insn_t insn
= SEM_INSN (sem_arg
);
2200 #define OPRND(f) par_exec->operands.fmt_ldi8.f
2201 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2202 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2204 EXTRACT_FMT_LDI8_VARS
/* f-op1 f-r1 f-simm8 */
2205 EXTRACT_FMT_LDI8_CODE
2208 SI opval
= OPRND (simm8
);
2209 CPU (h_gr
[f_r1
]) = opval
;
2210 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2213 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2215 #if WITH_PROFILE_MODEL_P
2216 if (PROFILE_MODEL_P (current_cpu
))
2218 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2219 m32rx_model_profile_insn (current_cpu
, abuf
);
2227 /* ldi16: ldi16 $dr,$hash$slo16. */
2230 SEM_FN_NAME (m32rx
,ldi16
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2232 insn_t insn
= SEM_INSN (sem_arg
);
2233 #define OPRND(f) par_exec->operands.fmt_ldi16.f
2234 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2235 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
2237 EXTRACT_FMT_LDI16_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2238 EXTRACT_FMT_LDI16_CODE
2241 SI opval
= OPRND (slo16
);
2242 CPU (h_gr
[f_r1
]) = opval
;
2243 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2246 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2248 #if WITH_PROFILE_MODEL_P
2249 if (PROFILE_MODEL_P (current_cpu
))
2251 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2252 m32rx_model_profile_insn (current_cpu
, abuf
);
2260 /* lock: lock $dr,@$sr. */
2263 SEM_FN_NAME (m32rx
,lock
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2265 insn_t insn
= SEM_INSN (sem_arg
);
2266 #define OPRND(f) par_exec->operands.fmt_lock.f
2267 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2268 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2270 EXTRACT_FMT_LOCK_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2271 EXTRACT_FMT_LOCK_CODE
2276 CPU (h_lock
) = opval
;
2277 TRACE_RESULT (current_cpu
, "lock-0", 'x', opval
);
2280 SI opval
= OPRND (h_memory_sr
);
2281 CPU (h_gr
[f_r1
]) = opval
;
2282 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2286 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2288 #if WITH_PROFILE_MODEL_P
2289 if (PROFILE_MODEL_P (current_cpu
))
2291 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2292 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2293 m32rx_model_profile_insn (current_cpu
, abuf
);
2301 /* machi-a: machi $src1,$src2,$acc. */
2304 SEM_FN_NAME (m32rx
,machi_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2306 insn_t insn
= SEM_INSN (sem_arg
);
2307 #define OPRND(f) par_exec->operands.fmt_machi_a.f
2308 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2309 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2311 EXTRACT_FMT_MACHI_A_VARS
/* f-op1 f-r1 f-acc f-op23 f-r2 */
2312 EXTRACT_FMT_MACHI_A_CODE
2315 DI opval
= SRADI (SLLDI (ADDDI (OPRND (acc
), MULDI (EXTSIDI (ANDSI (OPRND (src1
), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2
), 16))))), 8), 8);
2316 m32rx_h_accums_set (current_cpu
, f_acc
, opval
);
2317 TRACE_RESULT (current_cpu
, "acc", 'D', opval
);
2320 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2322 #if WITH_PROFILE_MODEL_P
2323 if (PROFILE_MODEL_P (current_cpu
))
2325 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2326 m32rx_model_profile_insn (current_cpu
, abuf
);
2334 /* maclo-a: maclo $src1,$src2,$acc. */
2337 SEM_FN_NAME (m32rx
,maclo_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2339 insn_t insn
= SEM_INSN (sem_arg
);
2340 #define OPRND(f) par_exec->operands.fmt_machi_a.f
2341 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2342 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2344 EXTRACT_FMT_MACHI_A_VARS
/* f-op1 f-r1 f-acc f-op23 f-r2 */
2345 EXTRACT_FMT_MACHI_A_CODE
2348 DI opval
= SRADI (SLLDI (ADDDI (OPRND (acc
), MULDI (EXTSIDI (SLLSI (OPRND (src1
), 16)), EXTHIDI (TRUNCSIHI (OPRND (src2
))))), 8), 8);
2349 m32rx_h_accums_set (current_cpu
, f_acc
, opval
);
2350 TRACE_RESULT (current_cpu
, "acc", 'D', opval
);
2353 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2355 #if WITH_PROFILE_MODEL_P
2356 if (PROFILE_MODEL_P (current_cpu
))
2358 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2359 m32rx_model_profile_insn (current_cpu
, abuf
);
2367 /* macwhi-a: macwhi $src1,$src2,$acc. */
2370 SEM_FN_NAME (m32rx
,macwhi_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2372 insn_t insn
= SEM_INSN (sem_arg
);
2373 #define OPRND(f) par_exec->operands.fmt_machi_a.f
2374 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2375 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2377 EXTRACT_FMT_MACHI_A_VARS
/* f-op1 f-r1 f-acc f-op23 f-r2 */
2378 EXTRACT_FMT_MACHI_A_CODE
2381 DI opval
= ADDDI (OPRND (acc
), MULDI (EXTSIDI (OPRND (src1
)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2
), 16)))));
2382 m32rx_h_accums_set (current_cpu
, f_acc
, opval
);
2383 TRACE_RESULT (current_cpu
, "acc", 'D', opval
);
2386 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2388 #if WITH_PROFILE_MODEL_P
2389 if (PROFILE_MODEL_P (current_cpu
))
2391 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2392 m32rx_model_profile_insn (current_cpu
, abuf
);
2400 /* macwlo-a: macwlo $src1,$src2,$acc. */
2403 SEM_FN_NAME (m32rx
,macwlo_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2405 insn_t insn
= SEM_INSN (sem_arg
);
2406 #define OPRND(f) par_exec->operands.fmt_machi_a.f
2407 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2408 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2410 EXTRACT_FMT_MACHI_A_VARS
/* f-op1 f-r1 f-acc f-op23 f-r2 */
2411 EXTRACT_FMT_MACHI_A_CODE
2414 DI opval
= ADDDI (OPRND (acc
), MULDI (EXTSIDI (OPRND (src1
)), EXTHIDI (TRUNCSIHI (OPRND (src2
)))));
2415 m32rx_h_accums_set (current_cpu
, f_acc
, opval
);
2416 TRACE_RESULT (current_cpu
, "acc", 'D', opval
);
2419 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2421 #if WITH_PROFILE_MODEL_P
2422 if (PROFILE_MODEL_P (current_cpu
))
2424 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2425 m32rx_model_profile_insn (current_cpu
, abuf
);
2433 /* mul: mul $dr,$sr. */
2436 SEM_FN_NAME (m32rx
,mul
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2438 insn_t insn
= SEM_INSN (sem_arg
);
2439 #define OPRND(f) par_exec->operands.fmt_add.f
2440 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2441 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2443 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2444 EXTRACT_FMT_ADD_CODE
2447 SI opval
= MULSI (OPRND (dr
), OPRND (sr
));
2448 CPU (h_gr
[f_r1
]) = opval
;
2449 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2452 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2454 #if WITH_PROFILE_MODEL_P
2455 if (PROFILE_MODEL_P (current_cpu
))
2457 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2458 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2459 m32rx_model_profile_insn (current_cpu
, abuf
);
2467 /* mulhi-a: mulhi $src1,$src2,$acc. */
2470 SEM_FN_NAME (m32rx
,mulhi_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2472 insn_t insn
= SEM_INSN (sem_arg
);
2473 #define OPRND(f) par_exec->operands.fmt_mulhi_a.f
2474 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2475 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2477 EXTRACT_FMT_MULHI_A_VARS
/* f-op1 f-r1 f-acc f-op23 f-r2 */
2478 EXTRACT_FMT_MULHI_A_CODE
2481 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (OPRND (src1
), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2
), 16)))), 16), 16);
2482 m32rx_h_accums_set (current_cpu
, f_acc
, opval
);
2483 TRACE_RESULT (current_cpu
, "acc", 'D', opval
);
2486 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2488 #if WITH_PROFILE_MODEL_P
2489 if (PROFILE_MODEL_P (current_cpu
))
2491 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2492 m32rx_model_profile_insn (current_cpu
, abuf
);
2500 /* mullo-a: mullo $src1,$src2,$acc. */
2503 SEM_FN_NAME (m32rx
,mullo_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2505 insn_t insn
= SEM_INSN (sem_arg
);
2506 #define OPRND(f) par_exec->operands.fmt_mulhi_a.f
2507 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2508 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2510 EXTRACT_FMT_MULHI_A_VARS
/* f-op1 f-r1 f-acc f-op23 f-r2 */
2511 EXTRACT_FMT_MULHI_A_CODE
2514 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (OPRND (src1
), 16)), EXTHIDI (TRUNCSIHI (OPRND (src2
)))), 16), 16);
2515 m32rx_h_accums_set (current_cpu
, f_acc
, opval
);
2516 TRACE_RESULT (current_cpu
, "acc", 'D', opval
);
2519 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2521 #if WITH_PROFILE_MODEL_P
2522 if (PROFILE_MODEL_P (current_cpu
))
2524 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2525 m32rx_model_profile_insn (current_cpu
, abuf
);
2533 /* mulwhi-a: mulwhi $src1,$src2,$acc. */
2536 SEM_FN_NAME (m32rx
,mulwhi_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2538 insn_t insn
= SEM_INSN (sem_arg
);
2539 #define OPRND(f) par_exec->operands.fmt_mulhi_a.f
2540 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2541 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2543 EXTRACT_FMT_MULHI_A_VARS
/* f-op1 f-r1 f-acc f-op23 f-r2 */
2544 EXTRACT_FMT_MULHI_A_CODE
2547 DI opval
= MULDI (EXTSIDI (OPRND (src1
)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2
), 16))));
2548 m32rx_h_accums_set (current_cpu
, f_acc
, opval
);
2549 TRACE_RESULT (current_cpu
, "acc", 'D', opval
);
2552 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2554 #if WITH_PROFILE_MODEL_P
2555 if (PROFILE_MODEL_P (current_cpu
))
2557 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2558 m32rx_model_profile_insn (current_cpu
, abuf
);
2566 /* mulwlo-a: mulwlo $src1,$src2,$acc. */
2569 SEM_FN_NAME (m32rx
,mulwlo_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2571 insn_t insn
= SEM_INSN (sem_arg
);
2572 #define OPRND(f) par_exec->operands.fmt_mulhi_a.f
2573 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2574 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2576 EXTRACT_FMT_MULHI_A_VARS
/* f-op1 f-r1 f-acc f-op23 f-r2 */
2577 EXTRACT_FMT_MULHI_A_CODE
2580 DI opval
= MULDI (EXTSIDI (OPRND (src1
)), EXTHIDI (TRUNCSIHI (OPRND (src2
))));
2581 m32rx_h_accums_set (current_cpu
, f_acc
, opval
);
2582 TRACE_RESULT (current_cpu
, "acc", 'D', opval
);
2585 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2587 #if WITH_PROFILE_MODEL_P
2588 if (PROFILE_MODEL_P (current_cpu
))
2590 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2591 m32rx_model_profile_insn (current_cpu
, abuf
);
2599 /* mv: mv $dr,$sr. */
2602 SEM_FN_NAME (m32rx
,mv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2604 insn_t insn
= SEM_INSN (sem_arg
);
2605 #define OPRND(f) par_exec->operands.fmt_mv.f
2606 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2607 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2609 EXTRACT_FMT_MV_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2613 SI opval
= OPRND (sr
);
2614 CPU (h_gr
[f_r1
]) = opval
;
2615 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2618 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2620 #if WITH_PROFILE_MODEL_P
2621 if (PROFILE_MODEL_P (current_cpu
))
2623 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2624 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2625 m32rx_model_profile_insn (current_cpu
, abuf
);
2633 /* mvfachi-a: mvfachi $dr,$accs. */
2636 SEM_FN_NAME (m32rx
,mvfachi_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2638 insn_t insn
= SEM_INSN (sem_arg
);
2639 #define OPRND(f) par_exec->operands.fmt_mvfachi_a.f
2640 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2641 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2643 EXTRACT_FMT_MVFACHI_A_VARS
/* f-op1 f-r1 f-op2 f-accs f-op3 */
2644 EXTRACT_FMT_MVFACHI_A_CODE
2647 SI opval
= TRUNCDISI (SRADI (OPRND (accs
), 32));
2648 CPU (h_gr
[f_r1
]) = opval
;
2649 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2652 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2654 #if WITH_PROFILE_MODEL_P
2655 if (PROFILE_MODEL_P (current_cpu
))
2657 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2658 m32rx_model_profile_insn (current_cpu
, abuf
);
2666 /* mvfaclo-a: mvfaclo $dr,$accs. */
2669 SEM_FN_NAME (m32rx
,mvfaclo_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2671 insn_t insn
= SEM_INSN (sem_arg
);
2672 #define OPRND(f) par_exec->operands.fmt_mvfachi_a.f
2673 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2674 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2676 EXTRACT_FMT_MVFACHI_A_VARS
/* f-op1 f-r1 f-op2 f-accs f-op3 */
2677 EXTRACT_FMT_MVFACHI_A_CODE
2680 SI opval
= TRUNCDISI (OPRND (accs
));
2681 CPU (h_gr
[f_r1
]) = opval
;
2682 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2685 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2687 #if WITH_PROFILE_MODEL_P
2688 if (PROFILE_MODEL_P (current_cpu
))
2690 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2691 m32rx_model_profile_insn (current_cpu
, abuf
);
2699 /* mvfacmi-a: mvfacmi $dr,$accs. */
2702 SEM_FN_NAME (m32rx
,mvfacmi_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2704 insn_t insn
= SEM_INSN (sem_arg
);
2705 #define OPRND(f) par_exec->operands.fmt_mvfachi_a.f
2706 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2707 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2709 EXTRACT_FMT_MVFACHI_A_VARS
/* f-op1 f-r1 f-op2 f-accs f-op3 */
2710 EXTRACT_FMT_MVFACHI_A_CODE
2713 SI opval
= TRUNCDISI (SRADI (OPRND (accs
), 16));
2714 CPU (h_gr
[f_r1
]) = opval
;
2715 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2718 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2720 #if WITH_PROFILE_MODEL_P
2721 if (PROFILE_MODEL_P (current_cpu
))
2723 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2724 m32rx_model_profile_insn (current_cpu
, abuf
);
2732 /* mvfc: mvfc $dr,$scr. */
2735 SEM_FN_NAME (m32rx
,mvfc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2737 insn_t insn
= SEM_INSN (sem_arg
);
2738 #define OPRND(f) par_exec->operands.fmt_mvfc.f
2739 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2740 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2742 EXTRACT_FMT_MVFC_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2743 EXTRACT_FMT_MVFC_CODE
2746 SI opval
= OPRND (scr
);
2747 CPU (h_gr
[f_r1
]) = opval
;
2748 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2751 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2753 #if WITH_PROFILE_MODEL_P
2754 if (PROFILE_MODEL_P (current_cpu
))
2756 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2757 m32rx_model_profile_insn (current_cpu
, abuf
);
2765 /* mvtachi-a: mvtachi $src1,$accs. */
2768 SEM_FN_NAME (m32rx
,mvtachi_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2770 insn_t insn
= SEM_INSN (sem_arg
);
2771 #define OPRND(f) par_exec->operands.fmt_mvtachi_a.f
2772 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2773 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2775 EXTRACT_FMT_MVTACHI_A_VARS
/* f-op1 f-r1 f-op2 f-accs f-op3 */
2776 EXTRACT_FMT_MVTACHI_A_CODE
2779 DI opval
= ORDI (ANDDI (OPRND (accs
), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (OPRND (src1
)), 32));
2780 m32rx_h_accums_set (current_cpu
, f_accs
, opval
);
2781 TRACE_RESULT (current_cpu
, "accs", 'D', opval
);
2784 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2786 #if WITH_PROFILE_MODEL_P
2787 if (PROFILE_MODEL_P (current_cpu
))
2789 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2790 m32rx_model_profile_insn (current_cpu
, abuf
);
2798 /* mvtaclo-a: mvtaclo $src1,$accs. */
2801 SEM_FN_NAME (m32rx
,mvtaclo_a
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2803 insn_t insn
= SEM_INSN (sem_arg
);
2804 #define OPRND(f) par_exec->operands.fmt_mvtachi_a.f
2805 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2806 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2808 EXTRACT_FMT_MVTACHI_A_VARS
/* f-op1 f-r1 f-op2 f-accs f-op3 */
2809 EXTRACT_FMT_MVTACHI_A_CODE
2812 DI opval
= ORDI (ANDDI (OPRND (accs
), MAKEDI (0xffffffff, 0)), ZEXTSIDI (OPRND (src1
)));
2813 m32rx_h_accums_set (current_cpu
, f_accs
, opval
);
2814 TRACE_RESULT (current_cpu
, "accs", 'D', opval
);
2817 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2819 #if WITH_PROFILE_MODEL_P
2820 if (PROFILE_MODEL_P (current_cpu
))
2822 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2823 m32rx_model_profile_insn (current_cpu
, abuf
);
2831 /* mvtc: mvtc $sr,$dcr. */
2834 SEM_FN_NAME (m32rx
,mvtc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2836 insn_t insn
= SEM_INSN (sem_arg
);
2837 #define OPRND(f) par_exec->operands.fmt_mvtc.f
2838 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2839 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2841 EXTRACT_FMT_MVTC_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2842 EXTRACT_FMT_MVTC_CODE
2845 USI opval
= OPRND (sr
);
2846 m32rx_h_cr_set (current_cpu
, f_r1
, opval
);
2847 TRACE_RESULT (current_cpu
, "dcr", 'x', opval
);
2850 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2852 #if WITH_PROFILE_MODEL_P
2853 if (PROFILE_MODEL_P (current_cpu
))
2855 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2856 m32rx_model_profile_insn (current_cpu
, abuf
);
2864 /* neg: neg $dr,$sr. */
2867 SEM_FN_NAME (m32rx
,neg
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2869 insn_t insn
= SEM_INSN (sem_arg
);
2870 #define OPRND(f) par_exec->operands.fmt_mv.f
2871 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2872 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2874 EXTRACT_FMT_MV_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2878 SI opval
= NEGSI (OPRND (sr
));
2879 CPU (h_gr
[f_r1
]) = opval
;
2880 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2883 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2885 #if WITH_PROFILE_MODEL_P
2886 if (PROFILE_MODEL_P (current_cpu
))
2888 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2889 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2890 m32rx_model_profile_insn (current_cpu
, abuf
);
2901 SEM_FN_NAME (m32rx
,nop
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2903 insn_t insn
= SEM_INSN (sem_arg
);
2904 #define OPRND(f) par_exec->operands.fmt_nop.f
2905 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2906 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2908 EXTRACT_FMT_NOP_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2909 EXTRACT_FMT_NOP_CODE
2911 PROFILE_COUNT_FILLNOPS (current_cpu
, abuf
->addr
);
2913 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2915 #if WITH_PROFILE_MODEL_P
2916 if (PROFILE_MODEL_P (current_cpu
))
2918 m32rx_model_profile_insn (current_cpu
, abuf
);
2926 /* not: not $dr,$sr. */
2929 SEM_FN_NAME (m32rx
,not) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2931 insn_t insn
= SEM_INSN (sem_arg
);
2932 #define OPRND(f) par_exec->operands.fmt_mv.f
2933 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2934 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2936 EXTRACT_FMT_MV_VARS
/* f-op1 f-r1 f-op2 f-r2 */
2940 SI opval
= INVSI (OPRND (sr
));
2941 CPU (h_gr
[f_r1
]) = opval
;
2942 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
2945 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2947 #if WITH_PROFILE_MODEL_P
2948 if (PROFILE_MODEL_P (current_cpu
))
2950 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
2951 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
2952 m32rx_model_profile_insn (current_cpu
, abuf
);
2960 /* rac-dsi: rac $accd,$accs,$imm1. */
2963 SEM_FN_NAME (m32rx
,rac_dsi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
2965 insn_t insn
= SEM_INSN (sem_arg
);
2966 #define OPRND(f) par_exec->operands.fmt_rac_dsi.f
2967 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2968 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
2970 EXTRACT_FMT_RAC_DSI_VARS
/* f-op1 f-accd f-bits67 f-op2 f-accs f-bit14 f-imm1 */
2971 EXTRACT_FMT_RAC_DSI_CODE
2975 tmp_tmp1
= SLLDI (OPRND (accs
), OPRND (imm1
));
2976 tmp_tmp1
= ADDDI (tmp_tmp1
, MAKEDI (0, 32768));
2978 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)));
2979 m32rx_h_accums_set (current_cpu
, f_accd
, opval
);
2980 TRACE_RESULT (current_cpu
, "accd", 'D', opval
);
2984 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
2986 #if WITH_PROFILE_MODEL_P
2987 if (PROFILE_MODEL_P (current_cpu
))
2989 m32rx_model_profile_insn (current_cpu
, abuf
);
2997 /* rach-dsi: rach $accd,$accs,$imm1. */
3000 SEM_FN_NAME (m32rx
,rach_dsi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3002 insn_t insn
= SEM_INSN (sem_arg
);
3003 #define OPRND(f) par_exec->operands.fmt_rac_dsi.f
3004 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3005 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3007 EXTRACT_FMT_RAC_DSI_VARS
/* f-op1 f-accd f-bits67 f-op2 f-accs f-bit14 f-imm1 */
3008 EXTRACT_FMT_RAC_DSI_CODE
3012 tmp_tmp1
= SLLDI (OPRND (accs
), OPRND (imm1
));
3013 tmp_tmp1
= ADDDI (tmp_tmp1
, MAKEDI (0, 0x80000000));
3015 DI opval
= (GTDI (tmp_tmp1
, MAKEDI (32767, 0))) ? (MAKEDI (32767, 0)) : (LTDI (tmp_tmp1
, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1
, MAKEDI (0xffffffff, 0)));
3016 m32rx_h_accums_set (current_cpu
, f_accd
, opval
);
3017 TRACE_RESULT (current_cpu
, "accd", 'D', opval
);
3021 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3023 #if WITH_PROFILE_MODEL_P
3024 if (PROFILE_MODEL_P (current_cpu
))
3026 m32rx_model_profile_insn (current_cpu
, abuf
);
3037 SEM_FN_NAME (m32rx
,rte
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3039 insn_t insn
= SEM_INSN (sem_arg
);
3040 #define OPRND(f) par_exec->operands.fmt_rte.f
3041 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3042 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3045 EXTRACT_FMT_RTE_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3046 EXTRACT_FMT_RTE_CODE
3050 UBI opval
= OPRND (h_bsm_0
);
3052 TRACE_RESULT (current_cpu
, "sm-0", 'x', opval
);
3055 UBI opval
= OPRND (h_bie_0
);
3057 TRACE_RESULT (current_cpu
, "ie-0", 'x', opval
);
3060 UBI opval
= OPRND (h_bcond_0
);
3061 CPU (h_cond
) = opval
;
3062 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
3065 USI opval
= ANDSI (OPRND (h_bpc_0
), -4);
3066 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
3068 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
3072 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3074 #if WITH_PROFILE_MODEL_P
3075 if (PROFILE_MODEL_P (current_cpu
))
3077 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
3085 /* seth: seth $dr,$hash$hi16. */
3088 SEM_FN_NAME (m32rx
,seth
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3090 insn_t insn
= SEM_INSN (sem_arg
);
3091 #define OPRND(f) par_exec->operands.fmt_seth.f
3092 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3093 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3095 EXTRACT_FMT_SETH_VARS
/* f-op1 f-r1 f-op2 f-r2 f-hi16 */
3096 EXTRACT_FMT_SETH_CODE
3099 SI opval
= SLLSI (OPRND (hi16
), 16);
3100 CPU (h_gr
[f_r1
]) = opval
;
3101 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3104 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3106 #if WITH_PROFILE_MODEL_P
3107 if (PROFILE_MODEL_P (current_cpu
))
3109 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3110 m32rx_model_profile_insn (current_cpu
, abuf
);
3118 /* sll: sll $dr,$sr. */
3121 SEM_FN_NAME (m32rx
,sll
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3123 insn_t insn
= SEM_INSN (sem_arg
);
3124 #define OPRND(f) par_exec->operands.fmt_add.f
3125 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3126 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3128 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3129 EXTRACT_FMT_ADD_CODE
3132 SI opval
= SLLSI (OPRND (dr
), ANDSI (OPRND (sr
), 31));
3133 CPU (h_gr
[f_r1
]) = opval
;
3134 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3137 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3139 #if WITH_PROFILE_MODEL_P
3140 if (PROFILE_MODEL_P (current_cpu
))
3142 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3143 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3144 m32rx_model_profile_insn (current_cpu
, abuf
);
3152 /* sll3: sll3 $dr,$sr,$simm16. */
3155 SEM_FN_NAME (m32rx
,sll3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3157 insn_t insn
= SEM_INSN (sem_arg
);
3158 #define OPRND(f) par_exec->operands.fmt_sll3.f
3159 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3160 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3162 EXTRACT_FMT_SLL3_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
3163 EXTRACT_FMT_SLL3_CODE
3166 SI opval
= SLLSI (OPRND (sr
), ANDSI (OPRND (simm16
), 31));
3167 CPU (h_gr
[f_r1
]) = opval
;
3168 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3171 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3173 #if WITH_PROFILE_MODEL_P
3174 if (PROFILE_MODEL_P (current_cpu
))
3176 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3177 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3178 m32rx_model_profile_insn (current_cpu
, abuf
);
3186 /* slli: slli $dr,$uimm5. */
3189 SEM_FN_NAME (m32rx
,slli
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3191 insn_t insn
= SEM_INSN (sem_arg
);
3192 #define OPRND(f) par_exec->operands.fmt_slli.f
3193 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3194 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3196 EXTRACT_FMT_SLLI_VARS
/* f-op1 f-r1 f-shift-op2 f-uimm5 */
3197 EXTRACT_FMT_SLLI_CODE
3200 SI opval
= SLLSI (OPRND (dr
), OPRND (uimm5
));
3201 CPU (h_gr
[f_r1
]) = opval
;
3202 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3205 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3207 #if WITH_PROFILE_MODEL_P
3208 if (PROFILE_MODEL_P (current_cpu
))
3210 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3211 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3212 m32rx_model_profile_insn (current_cpu
, abuf
);
3220 /* sra: sra $dr,$sr. */
3223 SEM_FN_NAME (m32rx
,sra
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3225 insn_t insn
= SEM_INSN (sem_arg
);
3226 #define OPRND(f) par_exec->operands.fmt_add.f
3227 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3228 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3230 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3231 EXTRACT_FMT_ADD_CODE
3234 SI opval
= SRASI (OPRND (dr
), ANDSI (OPRND (sr
), 31));
3235 CPU (h_gr
[f_r1
]) = opval
;
3236 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3239 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3241 #if WITH_PROFILE_MODEL_P
3242 if (PROFILE_MODEL_P (current_cpu
))
3244 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3245 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3246 m32rx_model_profile_insn (current_cpu
, abuf
);
3254 /* sra3: sra3 $dr,$sr,$simm16. */
3257 SEM_FN_NAME (m32rx
,sra3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3259 insn_t insn
= SEM_INSN (sem_arg
);
3260 #define OPRND(f) par_exec->operands.fmt_sll3.f
3261 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3262 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3264 EXTRACT_FMT_SLL3_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
3265 EXTRACT_FMT_SLL3_CODE
3268 SI opval
= SRASI (OPRND (sr
), ANDSI (OPRND (simm16
), 31));
3269 CPU (h_gr
[f_r1
]) = opval
;
3270 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3273 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3275 #if WITH_PROFILE_MODEL_P
3276 if (PROFILE_MODEL_P (current_cpu
))
3278 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3279 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3280 m32rx_model_profile_insn (current_cpu
, abuf
);
3288 /* srai: srai $dr,$uimm5. */
3291 SEM_FN_NAME (m32rx
,srai
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3293 insn_t insn
= SEM_INSN (sem_arg
);
3294 #define OPRND(f) par_exec->operands.fmt_slli.f
3295 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3296 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3298 EXTRACT_FMT_SLLI_VARS
/* f-op1 f-r1 f-shift-op2 f-uimm5 */
3299 EXTRACT_FMT_SLLI_CODE
3302 SI opval
= SRASI (OPRND (dr
), OPRND (uimm5
));
3303 CPU (h_gr
[f_r1
]) = opval
;
3304 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3307 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3309 #if WITH_PROFILE_MODEL_P
3310 if (PROFILE_MODEL_P (current_cpu
))
3312 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3313 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3314 m32rx_model_profile_insn (current_cpu
, abuf
);
3322 /* srl: srl $dr,$sr. */
3325 SEM_FN_NAME (m32rx
,srl
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3327 insn_t insn
= SEM_INSN (sem_arg
);
3328 #define OPRND(f) par_exec->operands.fmt_add.f
3329 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3330 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3332 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3333 EXTRACT_FMT_ADD_CODE
3336 SI opval
= SRLSI (OPRND (dr
), ANDSI (OPRND (sr
), 31));
3337 CPU (h_gr
[f_r1
]) = opval
;
3338 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3341 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3343 #if WITH_PROFILE_MODEL_P
3344 if (PROFILE_MODEL_P (current_cpu
))
3346 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3347 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3348 m32rx_model_profile_insn (current_cpu
, abuf
);
3356 /* srl3: srl3 $dr,$sr,$simm16. */
3359 SEM_FN_NAME (m32rx
,srl3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3361 insn_t insn
= SEM_INSN (sem_arg
);
3362 #define OPRND(f) par_exec->operands.fmt_sll3.f
3363 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3364 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3366 EXTRACT_FMT_SLL3_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
3367 EXTRACT_FMT_SLL3_CODE
3370 SI opval
= SRLSI (OPRND (sr
), ANDSI (OPRND (simm16
), 31));
3371 CPU (h_gr
[f_r1
]) = opval
;
3372 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3375 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3377 #if WITH_PROFILE_MODEL_P
3378 if (PROFILE_MODEL_P (current_cpu
))
3380 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3381 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3382 m32rx_model_profile_insn (current_cpu
, abuf
);
3390 /* srli: srli $dr,$uimm5. */
3393 SEM_FN_NAME (m32rx
,srli
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3395 insn_t insn
= SEM_INSN (sem_arg
);
3396 #define OPRND(f) par_exec->operands.fmt_slli.f
3397 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3398 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3400 EXTRACT_FMT_SLLI_VARS
/* f-op1 f-r1 f-shift-op2 f-uimm5 */
3401 EXTRACT_FMT_SLLI_CODE
3404 SI opval
= SRLSI (OPRND (dr
), OPRND (uimm5
));
3405 CPU (h_gr
[f_r1
]) = opval
;
3406 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3409 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3411 #if WITH_PROFILE_MODEL_P
3412 if (PROFILE_MODEL_P (current_cpu
))
3414 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3415 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3416 m32rx_model_profile_insn (current_cpu
, abuf
);
3424 /* st: st $src1,@$src2. */
3427 SEM_FN_NAME (m32rx
,st
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3429 insn_t insn
= SEM_INSN (sem_arg
);
3430 #define OPRND(f) par_exec->operands.fmt_st.f
3431 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3432 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3434 EXTRACT_FMT_ST_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3438 SI opval
= OPRND (src1
);
3439 SETMEMSI (current_cpu
, OPRND (src2
), opval
);
3440 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3443 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3445 #if WITH_PROFILE_MODEL_P
3446 if (PROFILE_MODEL_P (current_cpu
))
3448 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3449 m32rx_model_profile_insn (current_cpu
, abuf
);
3457 /* st-d: st $src1,@($slo16,$src2). */
3460 SEM_FN_NAME (m32rx
,st_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3462 insn_t insn
= SEM_INSN (sem_arg
);
3463 #define OPRND(f) par_exec->operands.fmt_st_d.f
3464 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3465 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3467 EXTRACT_FMT_ST_D_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
3468 EXTRACT_FMT_ST_D_CODE
3471 SI opval
= OPRND (src1
);
3472 SETMEMSI (current_cpu
, ADDSI (OPRND (src2
), OPRND (slo16
)), opval
);
3473 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3476 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3478 #if WITH_PROFILE_MODEL_P
3479 if (PROFILE_MODEL_P (current_cpu
))
3481 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3482 m32rx_model_profile_insn (current_cpu
, abuf
);
3490 /* stb: stb $src1,@$src2. */
3493 SEM_FN_NAME (m32rx
,stb
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3495 insn_t insn
= SEM_INSN (sem_arg
);
3496 #define OPRND(f) par_exec->operands.fmt_stb.f
3497 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3498 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3500 EXTRACT_FMT_STB_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3501 EXTRACT_FMT_STB_CODE
3504 QI opval
= OPRND (src1
);
3505 SETMEMQI (current_cpu
, OPRND (src2
), opval
);
3506 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3509 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3511 #if WITH_PROFILE_MODEL_P
3512 if (PROFILE_MODEL_P (current_cpu
))
3514 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3515 m32rx_model_profile_insn (current_cpu
, abuf
);
3523 /* stb-d: stb $src1,@($slo16,$src2). */
3526 SEM_FN_NAME (m32rx
,stb_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3528 insn_t insn
= SEM_INSN (sem_arg
);
3529 #define OPRND(f) par_exec->operands.fmt_stb_d.f
3530 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3531 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3533 EXTRACT_FMT_STB_D_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
3534 EXTRACT_FMT_STB_D_CODE
3537 QI opval
= OPRND (src1
);
3538 SETMEMQI (current_cpu
, ADDSI (OPRND (src2
), OPRND (slo16
)), opval
);
3539 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3542 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3544 #if WITH_PROFILE_MODEL_P
3545 if (PROFILE_MODEL_P (current_cpu
))
3547 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3548 m32rx_model_profile_insn (current_cpu
, abuf
);
3556 /* sth: sth $src1,@$src2. */
3559 SEM_FN_NAME (m32rx
,sth
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3561 insn_t insn
= SEM_INSN (sem_arg
);
3562 #define OPRND(f) par_exec->operands.fmt_sth.f
3563 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3564 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3566 EXTRACT_FMT_STH_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3567 EXTRACT_FMT_STH_CODE
3570 HI opval
= OPRND (src1
);
3571 SETMEMHI (current_cpu
, OPRND (src2
), opval
);
3572 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3575 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3577 #if WITH_PROFILE_MODEL_P
3578 if (PROFILE_MODEL_P (current_cpu
))
3580 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3581 m32rx_model_profile_insn (current_cpu
, abuf
);
3589 /* sth-d: sth $src1,@($slo16,$src2). */
3592 SEM_FN_NAME (m32rx
,sth_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3594 insn_t insn
= SEM_INSN (sem_arg
);
3595 #define OPRND(f) par_exec->operands.fmt_sth_d.f
3596 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3597 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3599 EXTRACT_FMT_STH_D_VARS
/* f-op1 f-r1 f-op2 f-r2 f-simm16 */
3600 EXTRACT_FMT_STH_D_CODE
3603 HI opval
= OPRND (src1
);
3604 SETMEMHI (current_cpu
, ADDSI (OPRND (src2
), OPRND (slo16
)), opval
);
3605 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3608 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3610 #if WITH_PROFILE_MODEL_P
3611 if (PROFILE_MODEL_P (current_cpu
))
3613 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3614 m32rx_model_profile_insn (current_cpu
, abuf
);
3622 /* st-plus: st $src1,@+$src2. */
3625 SEM_FN_NAME (m32rx
,st_plus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3627 insn_t insn
= SEM_INSN (sem_arg
);
3628 #define OPRND(f) par_exec->operands.fmt_st_plus.f
3629 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3630 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3632 EXTRACT_FMT_ST_PLUS_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3633 EXTRACT_FMT_ST_PLUS_CODE
3637 tmp_new_src2
= ADDSI (OPRND (src2
), 4);
3639 SI opval
= OPRND (src1
);
3640 SETMEMSI (current_cpu
, tmp_new_src2
, opval
);
3641 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3644 SI opval
= tmp_new_src2
;
3645 CPU (h_gr
[f_r2
]) = opval
;
3646 TRACE_RESULT (current_cpu
, "src2", 'x', opval
);
3650 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3652 #if WITH_PROFILE_MODEL_P
3653 if (PROFILE_MODEL_P (current_cpu
))
3655 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3656 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3657 m32rx_model_profile_insn (current_cpu
, abuf
);
3665 /* st-minus: st $src1,@-$src2. */
3668 SEM_FN_NAME (m32rx
,st_minus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3670 insn_t insn
= SEM_INSN (sem_arg
);
3671 #define OPRND(f) par_exec->operands.fmt_st_plus.f
3672 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3673 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3675 EXTRACT_FMT_ST_PLUS_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3676 EXTRACT_FMT_ST_PLUS_CODE
3680 tmp_new_src2
= SUBSI (OPRND (src2
), 4);
3682 SI opval
= OPRND (src1
);
3683 SETMEMSI (current_cpu
, tmp_new_src2
, opval
);
3684 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3687 SI opval
= tmp_new_src2
;
3688 CPU (h_gr
[f_r2
]) = opval
;
3689 TRACE_RESULT (current_cpu
, "src2", 'x', opval
);
3693 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3695 #if WITH_PROFILE_MODEL_P
3696 if (PROFILE_MODEL_P (current_cpu
))
3698 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3699 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3700 m32rx_model_profile_insn (current_cpu
, abuf
);
3708 /* sub: sub $dr,$sr. */
3711 SEM_FN_NAME (m32rx
,sub
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3713 insn_t insn
= SEM_INSN (sem_arg
);
3714 #define OPRND(f) par_exec->operands.fmt_add.f
3715 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3716 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3718 EXTRACT_FMT_ADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3719 EXTRACT_FMT_ADD_CODE
3722 SI opval
= SUBSI (OPRND (dr
), OPRND (sr
));
3723 CPU (h_gr
[f_r1
]) = opval
;
3724 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3727 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3729 #if WITH_PROFILE_MODEL_P
3730 if (PROFILE_MODEL_P (current_cpu
))
3732 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3733 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3734 m32rx_model_profile_insn (current_cpu
, abuf
);
3742 /* subv: subv $dr,$sr. */
3745 SEM_FN_NAME (m32rx
,subv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3747 insn_t insn
= SEM_INSN (sem_arg
);
3748 #define OPRND(f) par_exec->operands.fmt_addv.f
3749 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3750 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3752 EXTRACT_FMT_ADDV_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3753 EXTRACT_FMT_ADDV_CODE
3757 temp0
= SUBSI (OPRND (dr
), OPRND (sr
));
3758 temp1
= SUBOFSI (OPRND (dr
), OPRND (sr
), 0);
3761 CPU (h_gr
[f_r1
]) = opval
;
3762 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3766 CPU (h_cond
) = opval
;
3767 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
3771 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3773 #if WITH_PROFILE_MODEL_P
3774 if (PROFILE_MODEL_P (current_cpu
))
3776 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3777 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3778 m32rx_model_profile_insn (current_cpu
, abuf
);
3786 /* subx: subx $dr,$sr. */
3789 SEM_FN_NAME (m32rx
,subx
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3791 insn_t insn
= SEM_INSN (sem_arg
);
3792 #define OPRND(f) par_exec->operands.fmt_addx.f
3793 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3794 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3796 EXTRACT_FMT_ADDX_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3797 EXTRACT_FMT_ADDX_CODE
3801 temp0
= SUBCSI (OPRND (dr
), OPRND (sr
), OPRND (condbit
));
3802 temp1
= SUBCFSI (OPRND (dr
), OPRND (sr
), OPRND (condbit
));
3805 CPU (h_gr
[f_r1
]) = opval
;
3806 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3810 CPU (h_cond
) = opval
;
3811 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
3815 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3817 #if WITH_PROFILE_MODEL_P
3818 if (PROFILE_MODEL_P (current_cpu
))
3820 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3821 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3822 m32rx_model_profile_insn (current_cpu
, abuf
);
3830 /* trap: trap $uimm4. */
3833 SEM_FN_NAME (m32rx
,trap
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3835 insn_t insn
= SEM_INSN (sem_arg
);
3836 #define OPRND(f) par_exec->operands.fmt_trap.f
3837 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3838 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3841 EXTRACT_FMT_TRAP_VARS
/* f-op1 f-r1 f-op2 f-uimm4 */
3842 EXTRACT_FMT_TRAP_CODE
3846 USI opval
= ADDSI (OPRND (pc
), 4);
3847 m32rx_h_cr_set (current_cpu
, ((HOSTUINT
) 6), opval
);
3848 TRACE_RESULT (current_cpu
, "cr-6", 'x', opval
);
3851 USI opval
= ANDSI (SLLSI (OPRND (h_cr_0
), 8), 65408);
3852 m32rx_h_cr_set (current_cpu
, ((HOSTUINT
) 0), opval
);
3853 TRACE_RESULT (current_cpu
, "cr-0", 'x', opval
);
3856 SI opval
= m32r_trap (current_cpu
, OPRND (uimm4
));
3857 BRANCH_NEW_PC (new_pc
, SEM_BRANCH_VIA_ADDR (sem_arg
, opval
));
3859 TRACE_RESULT (current_cpu
, "pc", 'x', opval
);
3863 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3865 #if WITH_PROFILE_MODEL_P
3866 if (PROFILE_MODEL_P (current_cpu
))
3868 m32rx_model_profile_cti_insn (current_cpu
, abuf
, taken_p
);
3876 /* unlock: unlock $src1,@$src2. */
3879 SEM_FN_NAME (m32rx
,unlock
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3881 insn_t insn
= SEM_INSN (sem_arg
);
3882 #define OPRND(f) par_exec->operands.fmt_unlock.f
3883 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3884 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
3886 EXTRACT_FMT_UNLOCK_VARS
/* f-op1 f-r1 f-op2 f-r2 */
3887 EXTRACT_FMT_UNLOCK_CODE
3890 if (OPRND (h_lock_0
)) {
3892 SI opval
= OPRND (src1
);
3893 SETMEMSI (current_cpu
, OPRND (src2
), opval
);
3894 TRACE_RESULT (current_cpu
, "memory", 'x', opval
);
3899 CPU (h_lock
) = opval
;
3900 TRACE_RESULT (current_cpu
, "lock-0", 'x', opval
);
3904 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3906 #if WITH_PROFILE_MODEL_P
3907 if (PROFILE_MODEL_P (current_cpu
))
3909 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3910 m32rx_model_profile_insn (current_cpu
, abuf
);
3918 /* satb: satb $dr,$sr. */
3921 SEM_FN_NAME (m32rx
,satb
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3923 insn_t insn
= SEM_INSN (sem_arg
);
3924 #define OPRND(f) par_exec->operands.fmt_satb.f
3925 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3926 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3928 EXTRACT_FMT_SATB_VARS
/* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
3929 EXTRACT_FMT_SATB_CODE
3932 SI opval
= (GESI (OPRND (sr
), 127)) ? (127) : (LESI (OPRND (sr
), -128)) ? (-128) : (OPRND (sr
));
3933 CPU (h_gr
[f_r1
]) = opval
;
3934 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3937 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3939 #if WITH_PROFILE_MODEL_P
3940 if (PROFILE_MODEL_P (current_cpu
))
3942 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3943 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3944 m32rx_model_profile_insn (current_cpu
, abuf
);
3952 /* sath: sath $dr,$sr. */
3955 SEM_FN_NAME (m32rx
,sath
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3957 insn_t insn
= SEM_INSN (sem_arg
);
3958 #define OPRND(f) par_exec->operands.fmt_satb.f
3959 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3960 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3962 EXTRACT_FMT_SATB_VARS
/* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
3963 EXTRACT_FMT_SATB_CODE
3966 SI opval
= (GESI (OPRND (sr
), 32767)) ? (32767) : (LESI (OPRND (sr
), -32768)) ? (-32768) : (OPRND (sr
));
3967 CPU (h_gr
[f_r1
]) = opval
;
3968 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
3971 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
3973 #if WITH_PROFILE_MODEL_P
3974 if (PROFILE_MODEL_P (current_cpu
))
3976 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
3977 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
3978 m32rx_model_profile_insn (current_cpu
, abuf
);
3986 /* sat: sat $dr,$sr. */
3989 SEM_FN_NAME (m32rx
,sat
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
3991 insn_t insn
= SEM_INSN (sem_arg
);
3992 #define OPRND(f) par_exec->operands.fmt_sat.f
3993 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
3994 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 4);
3996 EXTRACT_FMT_SAT_VARS
/* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
3997 EXTRACT_FMT_SAT_CODE
4000 SI opval
= ((OPRND (condbit
)) ? (((LTSI (OPRND (sr
), 0)) ? (2147483647) : (0x80000000))) : (OPRND (sr
)));
4001 CPU (h_gr
[f_r1
]) = opval
;
4002 TRACE_RESULT (current_cpu
, "dr", 'x', opval
);
4005 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4007 #if WITH_PROFILE_MODEL_P
4008 if (PROFILE_MODEL_P (current_cpu
))
4010 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
4011 m32rx_model_mark_set_h_gr (current_cpu
, abuf
);
4012 m32rx_model_profile_insn (current_cpu
, abuf
);
4020 /* pcmpbz: pcmpbz $src2. */
4023 SEM_FN_NAME (m32rx
,pcmpbz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4025 insn_t insn
= SEM_INSN (sem_arg
);
4026 #define OPRND(f) par_exec->operands.fmt_cmpz.f
4027 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
4028 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
4030 EXTRACT_FMT_CMPZ_VARS
/* f-op1 f-r1 f-op2 f-r2 */
4031 EXTRACT_FMT_CMPZ_CODE
4034 UBI opval
= (EQSI (ANDSI (OPRND (src2
), 255), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2
), 65280), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2
), 16711680), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2
), 0xff000000), 0)) ? (1) : (0);
4035 CPU (h_cond
) = opval
;
4036 TRACE_RESULT (current_cpu
, "condbit", 'x', opval
);
4039 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4041 #if WITH_PROFILE_MODEL_P
4042 if (PROFILE_MODEL_P (current_cpu
))
4044 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
4045 m32rx_model_profile_insn (current_cpu
, abuf
);
4056 SEM_FN_NAME (m32rx
,sadd
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4058 insn_t insn
= SEM_INSN (sem_arg
);
4059 #define OPRND(f) par_exec->operands.fmt_sadd.f
4060 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
4061 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
4063 EXTRACT_FMT_SADD_VARS
/* f-op1 f-r1 f-op2 f-r2 */
4064 EXTRACT_FMT_SADD_CODE
4067 DI opval
= ADDDI (SRADI (OPRND (h_accums_1
), 16), OPRND (h_accums_0
));
4068 m32rx_h_accums_set (current_cpu
, ((HOSTUINT
) 0), opval
);
4069 TRACE_RESULT (current_cpu
, "accums-0", 'D', opval
);
4072 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4074 #if WITH_PROFILE_MODEL_P
4075 if (PROFILE_MODEL_P (current_cpu
))
4077 m32rx_model_profile_insn (current_cpu
, abuf
);
4085 /* macwu1: macwu1 $src1,$src2. */
4088 SEM_FN_NAME (m32rx
,macwu1
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4090 insn_t insn
= SEM_INSN (sem_arg
);
4091 #define OPRND(f) par_exec->operands.fmt_macwu1.f
4092 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
4093 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
4095 EXTRACT_FMT_MACWU1_VARS
/* f-op1 f-r1 f-op2 f-r2 */
4096 EXTRACT_FMT_MACWU1_CODE
4099 DI opval
= SRADI (SLLDI (ADDDI (OPRND (h_accums_1
), MULDI (EXTSIDI (OPRND (src1
)), EXTSIDI (ANDSI (OPRND (src2
), 65535)))), 8), 8);
4100 m32rx_h_accums_set (current_cpu
, ((HOSTUINT
) 1), opval
);
4101 TRACE_RESULT (current_cpu
, "accums-1", 'D', opval
);
4104 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4106 #if WITH_PROFILE_MODEL_P
4107 if (PROFILE_MODEL_P (current_cpu
))
4109 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
4110 m32rx_model_profile_insn (current_cpu
, abuf
);
4118 /* msblo: msblo $src1,$src2. */
4121 SEM_FN_NAME (m32rx
,msblo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4123 insn_t insn
= SEM_INSN (sem_arg
);
4124 #define OPRND(f) par_exec->operands.fmt_msblo.f
4125 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
4126 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
4128 EXTRACT_FMT_MSBLO_VARS
/* f-op1 f-r1 f-op2 f-r2 */
4129 EXTRACT_FMT_MSBLO_CODE
4132 DI opval
= SRADI (SLLDI (SUBDI (OPRND (accum
), SRADI (SLLDI (MULDI (EXTHIDI (TRUNCSIHI (OPRND (src1
))), EXTHIDI (TRUNCSIHI (OPRND (src2
)))), 32), 16)), 8), 8);
4133 m32rx_h_accum_set (current_cpu
, opval
);
4134 TRACE_RESULT (current_cpu
, "accum", 'D', opval
);
4137 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4139 #if WITH_PROFILE_MODEL_P
4140 if (PROFILE_MODEL_P (current_cpu
))
4142 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
4143 m32rx_model_profile_insn (current_cpu
, abuf
);
4151 /* mulwu1: mulwu1 $src1,$src2. */
4154 SEM_FN_NAME (m32rx
,mulwu1
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4156 insn_t insn
= SEM_INSN (sem_arg
);
4157 #define OPRND(f) par_exec->operands.fmt_mulwu1.f
4158 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
4159 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
4161 EXTRACT_FMT_MULWU1_VARS
/* f-op1 f-r1 f-op2 f-r2 */
4162 EXTRACT_FMT_MULWU1_CODE
4165 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (OPRND (src1
)), EXTSIDI (ANDSI (OPRND (src2
), 65535))), 16), 16);
4166 m32rx_h_accums_set (current_cpu
, ((HOSTUINT
) 1), opval
);
4167 TRACE_RESULT (current_cpu
, "accums-1", 'D', opval
);
4170 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4172 #if WITH_PROFILE_MODEL_P
4173 if (PROFILE_MODEL_P (current_cpu
))
4175 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
4176 m32rx_model_profile_insn (current_cpu
, abuf
);
4184 /* maclh1: maclh1 $src1,$src2. */
4187 SEM_FN_NAME (m32rx
,maclh1
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4189 insn_t insn
= SEM_INSN (sem_arg
);
4190 #define OPRND(f) par_exec->operands.fmt_macwu1.f
4191 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
4192 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
4194 EXTRACT_FMT_MACWU1_VARS
/* f-op1 f-r1 f-op2 f-r2 */
4195 EXTRACT_FMT_MACWU1_CODE
4198 DI opval
= SRADI (SLLDI (ADDDI (OPRND (h_accums_1
), SLLDI (EXTSIDI (MULSI (EXTHISI (TRUNCSIHI (OPRND (src1
))), SRASI (OPRND (src2
), 16))), 16)), 8), 8);
4199 m32rx_h_accums_set (current_cpu
, ((HOSTUINT
) 1), opval
);
4200 TRACE_RESULT (current_cpu
, "accums-1", 'D', opval
);
4203 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4205 #if WITH_PROFILE_MODEL_P
4206 if (PROFILE_MODEL_P (current_cpu
))
4208 m32rx_model_mark_get_h_gr (current_cpu
, abuf
);
4209 m32rx_model_profile_insn (current_cpu
, abuf
);
4220 SEM_FN_NAME (m32rx
,sc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4222 insn_t insn
= SEM_INSN (sem_arg
);
4223 #define OPRND(f) par_exec->operands.fmt_sc.f
4224 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
4225 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
4227 EXTRACT_FMT_SC_VARS
/* f-op1 f-r1 f-op2 f-r2 */
4230 if (OPRND (condbit
)) {
4231 BRANCH_NEW_PC (new_pc
, NEW_PC_SKIP
);
4234 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4236 #if WITH_PROFILE_MODEL_P
4237 if (PROFILE_MODEL_P (current_cpu
))
4239 m32rx_model_profile_insn (current_cpu
, abuf
);
4250 SEM_FN_NAME (m32rx
,snc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4252 insn_t insn
= SEM_INSN (sem_arg
);
4253 #define OPRND(f) par_exec->operands.fmt_sc.f
4254 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
4255 CIA new_pc
= SEM_NEXT_PC (sem_arg
, 2);
4257 EXTRACT_FMT_SC_VARS
/* f-op1 f-r1 f-op2 f-r2 */
4260 if (NOTBI (OPRND (condbit
))) {
4261 BRANCH_NEW_PC (new_pc
, NEW_PC_SKIP
);
4264 PROFILE_COUNT_INSN (current_cpu
, 0, abuf
->idesc
->num
);
4266 #if WITH_PROFILE_MODEL_P
4267 if (PROFILE_MODEL_P (current_cpu
))
4269 m32rx_model_profile_insn (current_cpu
, abuf
);
4278 SEM_FN_NAME (m32rx
,illegal
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
, PAREXEC
*par_exec
)
4280 sim_engine_illegal_insn (current_cpu
, NULL_CIA
/*FIXME*/);
4284 #endif /* WANT_CPU */