1 /* Simulator instruction semantics for m32r.
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.
33 #if ! defined (SCACHE_P) || (defined (SCACHE_P) && WITH_SCACHE)
36 #define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->opcode, CGEN_INSN_##attr)
38 /* Perform add: add $dr,$sr. */
40 SEM_FN_NAME (m32r,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
42 #define FLD(f) abuf->fields.fmt_0_add.f
43 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
44 CIA new_pc = SEM_NEXT_PC (sem_arg);
46 * FLD (f_r1) = ADDSI (* FLD (f_r1), * FLD (f_r2));
47 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
49 #if WITH_PROFILE_MODEL_P
50 if (PROFILE_MODEL_P (current_cpu))
52 m32r_model_mark_get_h_gr (current_cpu, abuf);
53 m32r_model_mark_set_h_gr (current_cpu, abuf);
54 m32r_model_profile_insn (current_cpu, abuf);
62 /* Perform add3: add3 $dr,$sr,#$slo16. */
64 SEM_FN_NAME (m32r,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
66 #define FLD(f) abuf->fields.fmt_1_add3.f
67 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
68 CIA new_pc = SEM_NEXT_PC (sem_arg);
70 * FLD (f_r1) = ADDSI (* FLD (f_r2), FLD (f_simm16));
71 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
73 #if WITH_PROFILE_MODEL_P
74 if (PROFILE_MODEL_P (current_cpu))
76 m32r_model_mark_get_h_gr (current_cpu, abuf);
77 m32r_model_mark_set_h_gr (current_cpu, abuf);
78 m32r_model_profile_insn (current_cpu, abuf);
86 /* Perform and: and $dr,$sr. */
88 SEM_FN_NAME (m32r,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
90 #define FLD(f) abuf->fields.fmt_0_add.f
91 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
92 CIA new_pc = SEM_NEXT_PC (sem_arg);
94 * FLD (f_r1) = ANDSI (* FLD (f_r1), * FLD (f_r2));
95 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
97 #if WITH_PROFILE_MODEL_P
98 if (PROFILE_MODEL_P (current_cpu))
100 m32r_model_mark_get_h_gr (current_cpu, abuf);
101 m32r_model_mark_set_h_gr (current_cpu, abuf);
102 m32r_model_profile_insn (current_cpu, abuf);
110 /* Perform and3: and3 $dr,$sr,#$uimm16. */
112 SEM_FN_NAME (m32r,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
114 #define FLD(f) abuf->fields.fmt_2_and3.f
115 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
116 CIA new_pc = SEM_NEXT_PC (sem_arg);
118 * FLD (f_r1) = ANDSI (* FLD (f_r2), FLD (f_uimm16));
119 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
121 #if WITH_PROFILE_MODEL_P
122 if (PROFILE_MODEL_P (current_cpu))
124 m32r_model_mark_get_h_gr (current_cpu, abuf);
125 m32r_model_mark_set_h_gr (current_cpu, abuf);
126 m32r_model_profile_insn (current_cpu, abuf);
134 /* Perform or: or $dr,$sr. */
136 SEM_FN_NAME (m32r,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
138 #define FLD(f) abuf->fields.fmt_0_add.f
139 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
140 CIA new_pc = SEM_NEXT_PC (sem_arg);
142 * FLD (f_r1) = ORSI (* FLD (f_r1), * FLD (f_r2));
143 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
145 #if WITH_PROFILE_MODEL_P
146 if (PROFILE_MODEL_P (current_cpu))
148 m32r_model_mark_get_h_gr (current_cpu, abuf);
149 m32r_model_mark_set_h_gr (current_cpu, abuf);
150 m32r_model_profile_insn (current_cpu, abuf);
158 /* Perform or3: or3 $dr,$sr,#$ulo16. */
160 SEM_FN_NAME (m32r,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
162 #define FLD(f) abuf->fields.fmt_3_or3.f
163 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
164 CIA new_pc = SEM_NEXT_PC (sem_arg);
166 * FLD (f_r1) = ORSI (* FLD (f_r2), FLD (f_uimm16));
167 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
169 #if WITH_PROFILE_MODEL_P
170 if (PROFILE_MODEL_P (current_cpu))
172 m32r_model_mark_get_h_gr (current_cpu, abuf);
173 m32r_model_mark_set_h_gr (current_cpu, abuf);
174 m32r_model_profile_insn (current_cpu, abuf);
182 /* Perform xor: xor $dr,$sr. */
184 SEM_FN_NAME (m32r,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
186 #define FLD(f) abuf->fields.fmt_0_add.f
187 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
188 CIA new_pc = SEM_NEXT_PC (sem_arg);
190 * FLD (f_r1) = XORSI (* FLD (f_r1), * FLD (f_r2));
191 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
193 #if WITH_PROFILE_MODEL_P
194 if (PROFILE_MODEL_P (current_cpu))
196 m32r_model_mark_get_h_gr (current_cpu, abuf);
197 m32r_model_mark_set_h_gr (current_cpu, abuf);
198 m32r_model_profile_insn (current_cpu, abuf);
206 /* Perform xor3: xor3 $dr,$sr,#$uimm16. */
208 SEM_FN_NAME (m32r,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
210 #define FLD(f) abuf->fields.fmt_2_and3.f
211 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
212 CIA new_pc = SEM_NEXT_PC (sem_arg);
214 * FLD (f_r1) = XORSI (* FLD (f_r2), FLD (f_uimm16));
215 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
217 #if WITH_PROFILE_MODEL_P
218 if (PROFILE_MODEL_P (current_cpu))
220 m32r_model_mark_get_h_gr (current_cpu, abuf);
221 m32r_model_mark_set_h_gr (current_cpu, abuf);
222 m32r_model_profile_insn (current_cpu, abuf);
230 /* Perform addi: addi $dr,#$simm8. */
232 SEM_FN_NAME (m32r,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
234 #define FLD(f) abuf->fields.fmt_4_addi.f
235 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
236 CIA new_pc = SEM_NEXT_PC (sem_arg);
238 * FLD (f_r1) = ADDSI (* FLD (f_r1), FLD (f_simm8));
239 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
241 #if WITH_PROFILE_MODEL_P
242 if (PROFILE_MODEL_P (current_cpu))
244 m32r_model_mark_get_h_gr (current_cpu, abuf);
245 m32r_model_mark_set_h_gr (current_cpu, abuf);
246 m32r_model_profile_insn (current_cpu, abuf);
254 /* Perform addv: addv $dr,$sr. */
256 SEM_FN_NAME (m32r,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
258 #define FLD(f) abuf->fields.fmt_0_add.f
259 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
260 CIA new_pc = SEM_NEXT_PC (sem_arg);
264 temp0 = ADDSI (* FLD (f_r1), * FLD (f_r2));
265 temp1 = ADDOFSI (* FLD (f_r1), * FLD (f_r2), 0);
266 * FLD (f_r1) = temp0;
267 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
268 CPU (h_cond) = temp1;
269 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
272 #if WITH_PROFILE_MODEL_P
273 if (PROFILE_MODEL_P (current_cpu))
275 m32r_model_mark_get_h_gr (current_cpu, abuf);
276 m32r_model_mark_set_h_gr (current_cpu, abuf);
277 m32r_model_profile_insn (current_cpu, abuf);
285 /* Perform addv3: addv3 $dr,$sr,#$simm16. */
287 SEM_FN_NAME (m32r,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
289 #define FLD(f) abuf->fields.fmt_5_addv3.f
290 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
291 CIA new_pc = SEM_NEXT_PC (sem_arg);
295 temp0 = ADDSI (* FLD (f_r2), FLD (f_simm16));
296 temp1 = ADDOFSI (* FLD (f_r2), FLD (f_simm16), 0);
297 * FLD (f_r1) = temp0;
298 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
299 CPU (h_cond) = temp1;
300 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
303 #if WITH_PROFILE_MODEL_P
304 if (PROFILE_MODEL_P (current_cpu))
306 m32r_model_mark_get_h_gr (current_cpu, abuf);
307 m32r_model_mark_set_h_gr (current_cpu, abuf);
308 m32r_model_profile_insn (current_cpu, abuf);
316 /* Perform addx: addx $dr,$sr. */
318 SEM_FN_NAME (m32r,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
320 #define FLD(f) abuf->fields.fmt_6_addx.f
321 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
322 CIA new_pc = SEM_NEXT_PC (sem_arg);
326 temp0 = ADDCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
327 temp1 = ADDCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
328 * FLD (f_r1) = temp0;
329 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
330 CPU (h_cond) = temp1;
331 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
334 #if WITH_PROFILE_MODEL_P
335 if (PROFILE_MODEL_P (current_cpu))
337 m32r_model_mark_get_h_gr (current_cpu, abuf);
338 m32r_model_mark_set_h_gr (current_cpu, abuf);
339 m32r_model_profile_insn (current_cpu, abuf);
347 /* Perform bc8: bc $disp8. */
349 SEM_FN_NAME (m32r,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
351 #define FLD(f) abuf->fields.fmt_7_bc8.f
352 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
353 CIA new_pc = SEM_NEXT_PC (sem_arg);
357 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8)));
361 #if WITH_PROFILE_MODEL_P
362 if (PROFILE_MODEL_P (current_cpu))
364 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
372 /* Perform bc24: bc $disp24. */
374 SEM_FN_NAME (m32r,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
376 #define FLD(f) abuf->fields.fmt_8_bc24.f
377 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
378 CIA new_pc = SEM_NEXT_PC (sem_arg);
382 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24)));
386 #if WITH_PROFILE_MODEL_P
387 if (PROFILE_MODEL_P (current_cpu))
389 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
397 /* Perform beq: beq $src1,$src2,$disp16. */
399 SEM_FN_NAME (m32r,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
401 #define FLD(f) abuf->fields.fmt_9_beq.f
402 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
403 CIA new_pc = SEM_NEXT_PC (sem_arg);
406 if (EQSI (* FLD (f_r1), * FLD (f_r2))) {
407 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
411 #if WITH_PROFILE_MODEL_P
412 if (PROFILE_MODEL_P (current_cpu))
414 m32r_model_mark_get_h_gr (current_cpu, abuf);
415 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
423 /* Perform beqz: beqz $src2,$disp16. */
425 SEM_FN_NAME (m32r,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
427 #define FLD(f) abuf->fields.fmt_10_beqz.f
428 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
429 CIA new_pc = SEM_NEXT_PC (sem_arg);
432 if (EQSI (* FLD (f_r2), 0)) {
433 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
437 #if WITH_PROFILE_MODEL_P
438 if (PROFILE_MODEL_P (current_cpu))
440 m32r_model_mark_get_h_gr (current_cpu, abuf);
441 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
449 /* Perform bgez: bgez $src2,$disp16. */
451 SEM_FN_NAME (m32r,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
453 #define FLD(f) abuf->fields.fmt_10_beqz.f
454 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
455 CIA new_pc = SEM_NEXT_PC (sem_arg);
458 if (GESI (* FLD (f_r2), 0)) {
459 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
463 #if WITH_PROFILE_MODEL_P
464 if (PROFILE_MODEL_P (current_cpu))
466 m32r_model_mark_get_h_gr (current_cpu, abuf);
467 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
475 /* Perform bgtz: bgtz $src2,$disp16. */
477 SEM_FN_NAME (m32r,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
479 #define FLD(f) abuf->fields.fmt_10_beqz.f
480 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
481 CIA new_pc = SEM_NEXT_PC (sem_arg);
484 if (GTSI (* FLD (f_r2), 0)) {
485 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
489 #if WITH_PROFILE_MODEL_P
490 if (PROFILE_MODEL_P (current_cpu))
492 m32r_model_mark_get_h_gr (current_cpu, abuf);
493 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
501 /* Perform blez: blez $src2,$disp16. */
503 SEM_FN_NAME (m32r,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
505 #define FLD(f) abuf->fields.fmt_10_beqz.f
506 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
507 CIA new_pc = SEM_NEXT_PC (sem_arg);
510 if (LESI (* FLD (f_r2), 0)) {
511 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
515 #if WITH_PROFILE_MODEL_P
516 if (PROFILE_MODEL_P (current_cpu))
518 m32r_model_mark_get_h_gr (current_cpu, abuf);
519 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
527 /* Perform bltz: bltz $src2,$disp16. */
529 SEM_FN_NAME (m32r,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
531 #define FLD(f) abuf->fields.fmt_10_beqz.f
532 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
533 CIA new_pc = SEM_NEXT_PC (sem_arg);
536 if (LTSI (* FLD (f_r2), 0)) {
537 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
541 #if WITH_PROFILE_MODEL_P
542 if (PROFILE_MODEL_P (current_cpu))
544 m32r_model_mark_get_h_gr (current_cpu, abuf);
545 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
553 /* Perform bnez: bnez $src2,$disp16. */
555 SEM_FN_NAME (m32r,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
557 #define FLD(f) abuf->fields.fmt_10_beqz.f
558 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
559 CIA new_pc = SEM_NEXT_PC (sem_arg);
562 if (NESI (* FLD (f_r2), 0)) {
563 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
567 #if WITH_PROFILE_MODEL_P
568 if (PROFILE_MODEL_P (current_cpu))
570 m32r_model_mark_get_h_gr (current_cpu, abuf);
571 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
579 /* Perform bl8: bl $disp8. */
581 SEM_FN_NAME (m32r,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
583 #define FLD(f) abuf->fields.fmt_11_bl8.f
584 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
585 CIA new_pc = SEM_NEXT_PC (sem_arg);
589 CPU (h_gr[14]) = ADDSI (ANDSI (CPU (h_pc), -4), 4);
590 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
591 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8)));
595 #if WITH_PROFILE_MODEL_P
596 if (PROFILE_MODEL_P (current_cpu))
598 m32r_model_mark_set_h_gr (current_cpu, abuf);
599 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
607 /* Perform bl24: bl $disp24. */
609 SEM_FN_NAME (m32r,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
611 #define FLD(f) abuf->fields.fmt_12_bl24.f
612 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
613 CIA new_pc = SEM_NEXT_PC (sem_arg);
617 CPU (h_gr[14]) = ADDSI (CPU (h_pc), 4);
618 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
619 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24)));
623 #if WITH_PROFILE_MODEL_P
624 if (PROFILE_MODEL_P (current_cpu))
626 m32r_model_mark_set_h_gr (current_cpu, abuf);
627 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
635 /* Perform bnc8: bnc $disp8. */
637 SEM_FN_NAME (m32r,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
639 #define FLD(f) abuf->fields.fmt_7_bc8.f
640 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
641 CIA new_pc = SEM_NEXT_PC (sem_arg);
644 if (NOTBI (CPU (h_cond))) {
645 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8)));
649 #if WITH_PROFILE_MODEL_P
650 if (PROFILE_MODEL_P (current_cpu))
652 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
660 /* Perform bnc24: bnc $disp24. */
662 SEM_FN_NAME (m32r,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
664 #define FLD(f) abuf->fields.fmt_8_bc24.f
665 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
666 CIA new_pc = SEM_NEXT_PC (sem_arg);
669 if (NOTBI (CPU (h_cond))) {
670 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24)));
674 #if WITH_PROFILE_MODEL_P
675 if (PROFILE_MODEL_P (current_cpu))
677 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
685 /* Perform bne: bne $src1,$src2,$disp16. */
687 SEM_FN_NAME (m32r,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
689 #define FLD(f) abuf->fields.fmt_9_beq.f
690 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
691 CIA new_pc = SEM_NEXT_PC (sem_arg);
694 if (NESI (* FLD (f_r1), * FLD (f_r2))) {
695 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
699 #if WITH_PROFILE_MODEL_P
700 if (PROFILE_MODEL_P (current_cpu))
702 m32r_model_mark_get_h_gr (current_cpu, abuf);
703 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
711 /* Perform bra8: bra $disp8. */
713 SEM_FN_NAME (m32r,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
715 #define FLD(f) abuf->fields.fmt_13_bra8.f
716 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
717 CIA new_pc = SEM_NEXT_PC (sem_arg);
720 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8)));
723 #if WITH_PROFILE_MODEL_P
724 if (PROFILE_MODEL_P (current_cpu))
726 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
734 /* Perform bra24: bra $disp24. */
736 SEM_FN_NAME (m32r,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
738 #define FLD(f) abuf->fields.fmt_14_bra24.f
739 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
740 CIA new_pc = SEM_NEXT_PC (sem_arg);
743 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24)));
746 #if WITH_PROFILE_MODEL_P
747 if (PROFILE_MODEL_P (current_cpu))
749 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
757 /* Perform cmp: cmp $src1,$src2. */
759 SEM_FN_NAME (m32r,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
761 #define FLD(f) abuf->fields.fmt_15_cmp.f
762 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
763 CIA new_pc = SEM_NEXT_PC (sem_arg);
765 CPU (h_cond) = LTSI (* FLD (f_r1), * FLD (f_r2));
766 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
768 #if WITH_PROFILE_MODEL_P
769 if (PROFILE_MODEL_P (current_cpu))
771 m32r_model_mark_get_h_gr (current_cpu, abuf);
772 m32r_model_profile_insn (current_cpu, abuf);
780 /* Perform cmpi: cmpi $src2,#$simm16. */
782 SEM_FN_NAME (m32r,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
784 #define FLD(f) abuf->fields.fmt_16_cmpi.f
785 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
786 CIA new_pc = SEM_NEXT_PC (sem_arg);
788 CPU (h_cond) = LTSI (* FLD (f_r2), FLD (f_simm16));
789 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
791 #if WITH_PROFILE_MODEL_P
792 if (PROFILE_MODEL_P (current_cpu))
794 m32r_model_mark_get_h_gr (current_cpu, abuf);
795 m32r_model_profile_insn (current_cpu, abuf);
803 /* Perform cmpu: cmpu $src1,$src2. */
805 SEM_FN_NAME (m32r,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
807 #define FLD(f) abuf->fields.fmt_15_cmp.f
808 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
809 CIA new_pc = SEM_NEXT_PC (sem_arg);
811 CPU (h_cond) = LTUSI (* FLD (f_r1), * FLD (f_r2));
812 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
814 #if WITH_PROFILE_MODEL_P
815 if (PROFILE_MODEL_P (current_cpu))
817 m32r_model_mark_get_h_gr (current_cpu, abuf);
818 m32r_model_profile_insn (current_cpu, abuf);
826 /* Perform cmpui: cmpui $src2,#$uimm16. */
828 SEM_FN_NAME (m32r,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
830 #define FLD(f) abuf->fields.fmt_17_cmpui.f
831 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
832 CIA new_pc = SEM_NEXT_PC (sem_arg);
834 CPU (h_cond) = LTUSI (* FLD (f_r2), FLD (f_uimm16));
835 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
837 #if WITH_PROFILE_MODEL_P
838 if (PROFILE_MODEL_P (current_cpu))
840 m32r_model_mark_get_h_gr (current_cpu, abuf);
841 m32r_model_profile_insn (current_cpu, abuf);
849 /* Perform div: div $dr,$sr. */
851 SEM_FN_NAME (m32r,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
853 #define FLD(f) abuf->fields.fmt_18_div.f
854 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
855 CIA new_pc = SEM_NEXT_PC (sem_arg);
857 if (NESI (* FLD (f_r2), 0)) {
858 * FLD (f_r1) = DIVSI (* FLD (f_r1), * FLD (f_r2));
859 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
862 #if WITH_PROFILE_MODEL_P
863 if (PROFILE_MODEL_P (current_cpu))
865 m32r_model_mark_get_h_gr (current_cpu, abuf);
866 m32r_model_mark_set_h_gr (current_cpu, abuf);
867 m32r_model_profile_insn (current_cpu, abuf);
875 /* Perform divu: divu $dr,$sr. */
877 SEM_FN_NAME (m32r,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
879 #define FLD(f) abuf->fields.fmt_18_div.f
880 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
881 CIA new_pc = SEM_NEXT_PC (sem_arg);
883 if (NESI (* FLD (f_r2), 0)) {
884 * FLD (f_r1) = UDIVSI (* FLD (f_r1), * FLD (f_r2));
885 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
888 #if WITH_PROFILE_MODEL_P
889 if (PROFILE_MODEL_P (current_cpu))
891 m32r_model_mark_get_h_gr (current_cpu, abuf);
892 m32r_model_mark_set_h_gr (current_cpu, abuf);
893 m32r_model_profile_insn (current_cpu, abuf);
901 /* Perform rem: rem $dr,$sr. */
903 SEM_FN_NAME (m32r,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
905 #define FLD(f) abuf->fields.fmt_18_div.f
906 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
907 CIA new_pc = SEM_NEXT_PC (sem_arg);
909 if (NESI (* FLD (f_r2), 0)) {
910 * FLD (f_r1) = MODSI (* FLD (f_r1), * FLD (f_r2));
911 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
914 #if WITH_PROFILE_MODEL_P
915 if (PROFILE_MODEL_P (current_cpu))
917 m32r_model_mark_get_h_gr (current_cpu, abuf);
918 m32r_model_mark_set_h_gr (current_cpu, abuf);
919 m32r_model_profile_insn (current_cpu, abuf);
927 /* Perform remu: remu $dr,$sr. */
929 SEM_FN_NAME (m32r,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
931 #define FLD(f) abuf->fields.fmt_18_div.f
932 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
933 CIA new_pc = SEM_NEXT_PC (sem_arg);
935 if (NESI (* FLD (f_r2), 0)) {
936 * FLD (f_r1) = UMODSI (* FLD (f_r1), * FLD (f_r2));
937 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
940 #if WITH_PROFILE_MODEL_P
941 if (PROFILE_MODEL_P (current_cpu))
943 m32r_model_mark_get_h_gr (current_cpu, abuf);
944 m32r_model_mark_set_h_gr (current_cpu, abuf);
945 m32r_model_profile_insn (current_cpu, abuf);
953 /* Perform jl: jl $sr. */
955 SEM_FN_NAME (m32r,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
957 #define FLD(f) abuf->fields.fmt_19_jl.f
958 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
959 CIA new_pc = SEM_NEXT_PC (sem_arg);
964 temp0 = ADDSI (ANDSI (CPU (h_pc), -4), 4);
965 temp1 = * FLD (f_r2);
966 CPU (h_gr[14]) = temp0;
967 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
968 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, temp1));
972 #if WITH_PROFILE_MODEL_P
973 if (PROFILE_MODEL_P (current_cpu))
975 m32r_model_mark_get_h_gr (current_cpu, abuf);
976 m32r_model_mark_set_h_gr (current_cpu, abuf);
977 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
985 /* Perform jmp: jmp $sr. */
987 SEM_FN_NAME (m32r,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
989 #define FLD(f) abuf->fields.fmt_20_jmp.f
990 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
991 CIA new_pc = SEM_NEXT_PC (sem_arg);
994 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, * FLD (f_r2)));
997 #if WITH_PROFILE_MODEL_P
998 if (PROFILE_MODEL_P (current_cpu))
1000 m32r_model_mark_get_h_gr (current_cpu, abuf);
1001 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
1009 /* Perform ld: ld $dr,@$sr. */
1011 SEM_FN_NAME (m32r,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1013 #define FLD(f) abuf->fields.fmt_21_ld.f
1014 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1015 CIA new_pc = SEM_NEXT_PC (sem_arg);
1017 * FLD (f_r1) = GETMEMSI (current_cpu, * FLD (f_r2));
1018 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1020 #if WITH_PROFILE_MODEL_P
1021 if (PROFILE_MODEL_P (current_cpu))
1023 m32r_model_mark_get_h_gr (current_cpu, abuf);
1024 m32r_model_mark_set_h_gr (current_cpu, abuf);
1025 m32r_model_profile_insn (current_cpu, abuf);
1033 /* Perform ld-d: ld $dr,@($slo16,$sr). */
1035 SEM_FN_NAME (m32r,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1037 #define FLD(f) abuf->fields.fmt_22_ld_d.f
1038 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1039 CIA new_pc = SEM_NEXT_PC (sem_arg);
1041 * FLD (f_r1) = GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)));
1042 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1044 #if WITH_PROFILE_MODEL_P
1045 if (PROFILE_MODEL_P (current_cpu))
1047 m32r_model_mark_get_h_gr (current_cpu, abuf);
1048 m32r_model_mark_set_h_gr (current_cpu, abuf);
1049 m32r_model_profile_insn (current_cpu, abuf);
1057 /* Perform ldb: ldb $dr,@$sr. */
1059 SEM_FN_NAME (m32r,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1061 #define FLD(f) abuf->fields.fmt_23_ldb.f
1062 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1063 CIA new_pc = SEM_NEXT_PC (sem_arg);
1065 * FLD (f_r1) = EXTQISI (GETMEMQI (current_cpu, * FLD (f_r2)));
1066 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1068 #if WITH_PROFILE_MODEL_P
1069 if (PROFILE_MODEL_P (current_cpu))
1071 m32r_model_mark_get_h_gr (current_cpu, abuf);
1072 m32r_model_mark_set_h_gr (current_cpu, abuf);
1073 m32r_model_profile_insn (current_cpu, abuf);
1081 /* Perform ldb-d: ldb $dr,@($slo16,$sr). */
1083 SEM_FN_NAME (m32r,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1085 #define FLD(f) abuf->fields.fmt_24_ldb_d.f
1086 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1087 CIA new_pc = SEM_NEXT_PC (sem_arg);
1089 * FLD (f_r1) = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
1090 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1092 #if WITH_PROFILE_MODEL_P
1093 if (PROFILE_MODEL_P (current_cpu))
1095 m32r_model_mark_get_h_gr (current_cpu, abuf);
1096 m32r_model_mark_set_h_gr (current_cpu, abuf);
1097 m32r_model_profile_insn (current_cpu, abuf);
1105 /* Perform ldh: ldh $dr,@$sr. */
1107 SEM_FN_NAME (m32r,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1109 #define FLD(f) abuf->fields.fmt_25_ldh.f
1110 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1111 CIA new_pc = SEM_NEXT_PC (sem_arg);
1113 * FLD (f_r1) = EXTHISI (GETMEMHI (current_cpu, * FLD (f_r2)));
1114 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1116 #if WITH_PROFILE_MODEL_P
1117 if (PROFILE_MODEL_P (current_cpu))
1119 m32r_model_mark_get_h_gr (current_cpu, abuf);
1120 m32r_model_mark_set_h_gr (current_cpu, abuf);
1121 m32r_model_profile_insn (current_cpu, abuf);
1129 /* Perform ldh-d: ldh $dr,@($slo16,$sr). */
1131 SEM_FN_NAME (m32r,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1133 #define FLD(f) abuf->fields.fmt_26_ldh_d.f
1134 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1135 CIA new_pc = SEM_NEXT_PC (sem_arg);
1137 * FLD (f_r1) = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
1138 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1140 #if WITH_PROFILE_MODEL_P
1141 if (PROFILE_MODEL_P (current_cpu))
1143 m32r_model_mark_get_h_gr (current_cpu, abuf);
1144 m32r_model_mark_set_h_gr (current_cpu, abuf);
1145 m32r_model_profile_insn (current_cpu, abuf);
1153 /* Perform ldub: ldub $dr,@$sr. */
1155 SEM_FN_NAME (m32r,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1157 #define FLD(f) abuf->fields.fmt_23_ldb.f
1158 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1159 CIA new_pc = SEM_NEXT_PC (sem_arg);
1161 * FLD (f_r1) = ZEXTQISI (GETMEMQI (current_cpu, * FLD (f_r2)));
1162 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1164 #if WITH_PROFILE_MODEL_P
1165 if (PROFILE_MODEL_P (current_cpu))
1167 m32r_model_mark_get_h_gr (current_cpu, abuf);
1168 m32r_model_mark_set_h_gr (current_cpu, abuf);
1169 m32r_model_profile_insn (current_cpu, abuf);
1177 /* Perform ldub-d: ldub $dr,@($slo16,$sr). */
1179 SEM_FN_NAME (m32r,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1181 #define FLD(f) abuf->fields.fmt_24_ldb_d.f
1182 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1183 CIA new_pc = SEM_NEXT_PC (sem_arg);
1185 * FLD (f_r1) = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
1186 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1188 #if WITH_PROFILE_MODEL_P
1189 if (PROFILE_MODEL_P (current_cpu))
1191 m32r_model_mark_get_h_gr (current_cpu, abuf);
1192 m32r_model_mark_set_h_gr (current_cpu, abuf);
1193 m32r_model_profile_insn (current_cpu, abuf);
1201 /* Perform lduh: lduh $dr,@$sr. */
1203 SEM_FN_NAME (m32r,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1205 #define FLD(f) abuf->fields.fmt_25_ldh.f
1206 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1207 CIA new_pc = SEM_NEXT_PC (sem_arg);
1209 * FLD (f_r1) = ZEXTHISI (GETMEMHI (current_cpu, * FLD (f_r2)));
1210 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1212 #if WITH_PROFILE_MODEL_P
1213 if (PROFILE_MODEL_P (current_cpu))
1215 m32r_model_mark_get_h_gr (current_cpu, abuf);
1216 m32r_model_mark_set_h_gr (current_cpu, abuf);
1217 m32r_model_profile_insn (current_cpu, abuf);
1225 /* Perform lduh-d: lduh $dr,@($slo16,$sr). */
1227 SEM_FN_NAME (m32r,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1229 #define FLD(f) abuf->fields.fmt_26_ldh_d.f
1230 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1231 CIA new_pc = SEM_NEXT_PC (sem_arg);
1233 * FLD (f_r1) = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
1234 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1236 #if WITH_PROFILE_MODEL_P
1237 if (PROFILE_MODEL_P (current_cpu))
1239 m32r_model_mark_get_h_gr (current_cpu, abuf);
1240 m32r_model_mark_set_h_gr (current_cpu, abuf);
1241 m32r_model_profile_insn (current_cpu, abuf);
1249 /* Perform ld-plus: ld $dr,@$sr+. */
1251 SEM_FN_NAME (m32r,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1253 #define FLD(f) abuf->fields.fmt_21_ld.f
1254 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1255 CIA new_pc = SEM_NEXT_PC (sem_arg);
1259 temp0 = GETMEMSI (current_cpu, * FLD (f_r2));
1260 temp1 = ADDSI (* FLD (f_r2), 4);
1261 * FLD (f_r1) = temp0;
1262 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1263 * FLD (f_r2) = temp1;
1264 TRACE_RESULT (current_cpu, "sr", 'x', * FLD (f_r2));
1267 #if WITH_PROFILE_MODEL_P
1268 if (PROFILE_MODEL_P (current_cpu))
1270 m32r_model_mark_get_h_gr (current_cpu, abuf);
1271 m32r_model_mark_set_h_gr (current_cpu, abuf);
1272 m32r_model_profile_insn (current_cpu, abuf);
1280 /* Perform ld24: ld24 $dr,#$uimm24. */
1282 SEM_FN_NAME (m32r,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1284 #define FLD(f) abuf->fields.fmt_27_ld24.f
1285 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1286 CIA new_pc = SEM_NEXT_PC (sem_arg);
1288 * FLD (f_r1) = FLD (f_uimm24);
1289 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1291 #if WITH_PROFILE_MODEL_P
1292 if (PROFILE_MODEL_P (current_cpu))
1294 m32r_model_mark_set_h_gr (current_cpu, abuf);
1295 m32r_model_profile_insn (current_cpu, abuf);
1303 /* Perform ldi8: ldi $dr,#$simm8. */
1305 SEM_FN_NAME (m32r,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1307 #define FLD(f) abuf->fields.fmt_28_ldi8.f
1308 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1309 CIA new_pc = SEM_NEXT_PC (sem_arg);
1311 * FLD (f_r1) = FLD (f_simm8);
1312 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1314 #if WITH_PROFILE_MODEL_P
1315 if (PROFILE_MODEL_P (current_cpu))
1317 m32r_model_mark_set_h_gr (current_cpu, abuf);
1318 m32r_model_profile_insn (current_cpu, abuf);
1326 /* Perform ldi16: ldi $dr,$slo16. */
1328 SEM_FN_NAME (m32r,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1330 #define FLD(f) abuf->fields.fmt_29_ldi16.f
1331 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1332 CIA new_pc = SEM_NEXT_PC (sem_arg);
1334 * FLD (f_r1) = FLD (f_simm16);
1335 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1337 #if WITH_PROFILE_MODEL_P
1338 if (PROFILE_MODEL_P (current_cpu))
1340 m32r_model_mark_set_h_gr (current_cpu, abuf);
1341 m32r_model_profile_insn (current_cpu, abuf);
1349 /* Perform lock: lock $dr,@$sr. */
1351 SEM_FN_NAME (m32r,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1353 #define FLD(f) abuf->fields.fmt_0_add.f
1354 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1355 CIA new_pc = SEM_NEXT_PC (sem_arg);
1357 do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2));
1359 #if WITH_PROFILE_MODEL_P
1360 if (PROFILE_MODEL_P (current_cpu))
1362 m32r_model_mark_get_h_gr (current_cpu, abuf);
1363 m32r_model_mark_set_h_gr (current_cpu, abuf);
1364 m32r_model_profile_insn (current_cpu, abuf);
1372 /* Perform machi: machi $src1,$src2. */
1374 SEM_FN_NAME (m32r,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1376 #define FLD(f) abuf->fields.fmt_30_machi.f
1377 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1378 CIA new_pc = SEM_NEXT_PC (sem_arg);
1380 CPU (h_accum) = SRADI (SLLDI (ADDDI (CPU (h_accum), MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8);
1381 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1383 #if WITH_PROFILE_MODEL_P
1384 if (PROFILE_MODEL_P (current_cpu))
1386 m32r_model_mark_get_h_gr (current_cpu, abuf);
1387 m32r_model_profile_insn (current_cpu, abuf);
1395 /* Perform maclo: maclo $src1,$src2. */
1397 SEM_FN_NAME (m32r,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1399 #define FLD(f) abuf->fields.fmt_30_machi.f
1400 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1401 CIA new_pc = SEM_NEXT_PC (sem_arg);
1403 CPU (h_accum) = SRADI (SLLDI (ADDDI (CPU (h_accum), MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8);
1404 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1406 #if WITH_PROFILE_MODEL_P
1407 if (PROFILE_MODEL_P (current_cpu))
1409 m32r_model_mark_get_h_gr (current_cpu, abuf);
1410 m32r_model_profile_insn (current_cpu, abuf);
1418 /* Perform macwhi: macwhi $src1,$src2. */
1420 SEM_FN_NAME (m32r,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1422 #define FLD(f) abuf->fields.fmt_30_machi.f
1423 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1424 CIA new_pc = SEM_NEXT_PC (sem_arg);
1426 CPU (h_accum) = SRADI (SLLDI (ADDDI (CPU (h_accum), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8);
1427 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1429 #if WITH_PROFILE_MODEL_P
1430 if (PROFILE_MODEL_P (current_cpu))
1432 m32r_model_mark_get_h_gr (current_cpu, abuf);
1433 m32r_model_profile_insn (current_cpu, abuf);
1441 /* Perform macwlo: macwlo $src1,$src2. */
1443 SEM_FN_NAME (m32r,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1445 #define FLD(f) abuf->fields.fmt_30_machi.f
1446 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1447 CIA new_pc = SEM_NEXT_PC (sem_arg);
1449 CPU (h_accum) = SRADI (SLLDI (ADDDI (CPU (h_accum), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8);
1450 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1452 #if WITH_PROFILE_MODEL_P
1453 if (PROFILE_MODEL_P (current_cpu))
1455 m32r_model_mark_get_h_gr (current_cpu, abuf);
1456 m32r_model_profile_insn (current_cpu, abuf);
1464 /* Perform mul: mul $dr,$sr. */
1466 SEM_FN_NAME (m32r,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1468 #define FLD(f) abuf->fields.fmt_0_add.f
1469 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1470 CIA new_pc = SEM_NEXT_PC (sem_arg);
1472 * FLD (f_r1) = MULSI (* FLD (f_r1), * FLD (f_r2));
1473 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1475 #if WITH_PROFILE_MODEL_P
1476 if (PROFILE_MODEL_P (current_cpu))
1478 m32r_model_mark_get_h_gr (current_cpu, abuf);
1479 m32r_model_mark_set_h_gr (current_cpu, abuf);
1480 m32r_model_profile_insn (current_cpu, abuf);
1488 /* Perform mulhi: mulhi $src1,$src2. */
1490 SEM_FN_NAME (m32r,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1492 #define FLD(f) abuf->fields.fmt_15_cmp.f
1493 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1494 CIA new_pc = SEM_NEXT_PC (sem_arg);
1496 CPU (h_accum) = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 16), 16);
1497 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1499 #if WITH_PROFILE_MODEL_P
1500 if (PROFILE_MODEL_P (current_cpu))
1502 m32r_model_mark_get_h_gr (current_cpu, abuf);
1503 m32r_model_profile_insn (current_cpu, abuf);
1511 /* Perform mullo: mullo $src1,$src2. */
1513 SEM_FN_NAME (m32r,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1515 #define FLD(f) abuf->fields.fmt_15_cmp.f
1516 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1517 CIA new_pc = SEM_NEXT_PC (sem_arg);
1519 CPU (h_accum) = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 16), 16);
1520 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1522 #if WITH_PROFILE_MODEL_P
1523 if (PROFILE_MODEL_P (current_cpu))
1525 m32r_model_mark_get_h_gr (current_cpu, abuf);
1526 m32r_model_profile_insn (current_cpu, abuf);
1534 /* Perform mulwhi: mulwhi $src1,$src2. */
1536 SEM_FN_NAME (m32r,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1538 #define FLD(f) abuf->fields.fmt_15_cmp.f
1539 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1540 CIA new_pc = SEM_NEXT_PC (sem_arg);
1542 CPU (h_accum) = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 8), 8);
1543 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1545 #if WITH_PROFILE_MODEL_P
1546 if (PROFILE_MODEL_P (current_cpu))
1548 m32r_model_mark_get_h_gr (current_cpu, abuf);
1549 m32r_model_profile_insn (current_cpu, abuf);
1557 /* Perform mulwlo: mulwlo $src1,$src2. */
1559 SEM_FN_NAME (m32r,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1561 #define FLD(f) abuf->fields.fmt_15_cmp.f
1562 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1563 CIA new_pc = SEM_NEXT_PC (sem_arg);
1565 CPU (h_accum) = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 8), 8);
1566 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1568 #if WITH_PROFILE_MODEL_P
1569 if (PROFILE_MODEL_P (current_cpu))
1571 m32r_model_mark_get_h_gr (current_cpu, abuf);
1572 m32r_model_profile_insn (current_cpu, abuf);
1580 /* Perform mv: mv $dr,$sr. */
1582 SEM_FN_NAME (m32r,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1584 #define FLD(f) abuf->fields.fmt_31_mv.f
1585 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1586 CIA new_pc = SEM_NEXT_PC (sem_arg);
1588 * FLD (f_r1) = * FLD (f_r2);
1589 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1591 #if WITH_PROFILE_MODEL_P
1592 if (PROFILE_MODEL_P (current_cpu))
1594 m32r_model_mark_get_h_gr (current_cpu, abuf);
1595 m32r_model_mark_set_h_gr (current_cpu, abuf);
1596 m32r_model_profile_insn (current_cpu, abuf);
1604 /* Perform mvfachi: mvfachi $dr. */
1606 SEM_FN_NAME (m32r,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1608 #define FLD(f) abuf->fields.fmt_32_mvfachi.f
1609 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1610 CIA new_pc = SEM_NEXT_PC (sem_arg);
1612 * FLD (f_r1) = TRUNCDISI (SRADI (CPU (h_accum), 32));
1613 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1615 #if WITH_PROFILE_MODEL_P
1616 if (PROFILE_MODEL_P (current_cpu))
1618 m32r_model_mark_set_h_gr (current_cpu, abuf);
1619 m32r_model_profile_insn (current_cpu, abuf);
1627 /* Perform mvfaclo: mvfaclo $dr. */
1629 SEM_FN_NAME (m32r,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1631 #define FLD(f) abuf->fields.fmt_32_mvfachi.f
1632 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1633 CIA new_pc = SEM_NEXT_PC (sem_arg);
1635 * FLD (f_r1) = TRUNCDISI (CPU (h_accum));
1636 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1638 #if WITH_PROFILE_MODEL_P
1639 if (PROFILE_MODEL_P (current_cpu))
1641 m32r_model_mark_set_h_gr (current_cpu, abuf);
1642 m32r_model_profile_insn (current_cpu, abuf);
1650 /* Perform mvfacmi: mvfacmi $dr. */
1652 SEM_FN_NAME (m32r,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1654 #define FLD(f) abuf->fields.fmt_32_mvfachi.f
1655 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1656 CIA new_pc = SEM_NEXT_PC (sem_arg);
1658 * FLD (f_r1) = TRUNCDISI (SRADI (CPU (h_accum), 16));
1659 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1661 #if WITH_PROFILE_MODEL_P
1662 if (PROFILE_MODEL_P (current_cpu))
1664 m32r_model_mark_set_h_gr (current_cpu, abuf);
1665 m32r_model_profile_insn (current_cpu, abuf);
1673 /* Perform mvfc: mvfc $dr,$scr. */
1675 SEM_FN_NAME (m32r,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1677 #define FLD(f) abuf->fields.fmt_33_mvfc.f
1678 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1679 CIA new_pc = SEM_NEXT_PC (sem_arg);
1681 * FLD (f_r1) = m32r_h_cr_get (current_cpu, FLD (f_r2));
1682 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1684 #if WITH_PROFILE_MODEL_P
1685 if (PROFILE_MODEL_P (current_cpu))
1687 m32r_model_mark_set_h_gr (current_cpu, abuf);
1688 m32r_model_profile_insn (current_cpu, abuf);
1696 /* Perform mvtachi: mvtachi $src1. */
1698 SEM_FN_NAME (m32r,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1700 #define FLD(f) abuf->fields.fmt_34_mvtachi.f
1701 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1702 CIA new_pc = SEM_NEXT_PC (sem_arg);
1704 CPU (h_accum) = ORDI (ANDDI (CPU (h_accum), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (f_r1)), 32));
1705 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1707 #if WITH_PROFILE_MODEL_P
1708 if (PROFILE_MODEL_P (current_cpu))
1710 m32r_model_mark_get_h_gr (current_cpu, abuf);
1711 m32r_model_profile_insn (current_cpu, abuf);
1719 /* Perform mvtaclo: mvtaclo $src1. */
1721 SEM_FN_NAME (m32r,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1723 #define FLD(f) abuf->fields.fmt_34_mvtachi.f
1724 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1725 CIA new_pc = SEM_NEXT_PC (sem_arg);
1727 CPU (h_accum) = ORDI (ANDDI (CPU (h_accum), MAKEDI (0xffffffff, 0)), EXTSIDI (* FLD (f_r1)));
1728 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1730 #if WITH_PROFILE_MODEL_P
1731 if (PROFILE_MODEL_P (current_cpu))
1733 m32r_model_mark_get_h_gr (current_cpu, abuf);
1734 m32r_model_profile_insn (current_cpu, abuf);
1742 /* Perform mvtc: mvtc $sr,$dcr. */
1744 SEM_FN_NAME (m32r,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1746 #define FLD(f) abuf->fields.fmt_35_mvtc.f
1747 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1748 CIA new_pc = SEM_NEXT_PC (sem_arg);
1750 m32r_h_cr_set (current_cpu, FLD (f_r1), * FLD (f_r2));
1751 TRACE_RESULT (current_cpu, "dcr", 'x', m32r_h_cr_get (current_cpu, FLD (f_r1)));
1753 #if WITH_PROFILE_MODEL_P
1754 if (PROFILE_MODEL_P (current_cpu))
1756 m32r_model_mark_get_h_gr (current_cpu, abuf);
1757 m32r_model_profile_insn (current_cpu, abuf);
1765 /* Perform neg: neg $dr,$sr. */
1767 SEM_FN_NAME (m32r,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1769 #define FLD(f) abuf->fields.fmt_31_mv.f
1770 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1771 CIA new_pc = SEM_NEXT_PC (sem_arg);
1773 * FLD (f_r1) = NEGSI (* FLD (f_r2));
1774 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1776 #if WITH_PROFILE_MODEL_P
1777 if (PROFILE_MODEL_P (current_cpu))
1779 m32r_model_mark_get_h_gr (current_cpu, abuf);
1780 m32r_model_mark_set_h_gr (current_cpu, abuf);
1781 m32r_model_profile_insn (current_cpu, abuf);
1789 /* Perform nop: nop. */
1791 SEM_FN_NAME (m32r,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1793 #define FLD(f) abuf->fields.fmt_36_nop.f
1794 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1795 CIA new_pc = SEM_NEXT_PC (sem_arg);
1797 PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
1799 #if WITH_PROFILE_MODEL_P
1800 if (PROFILE_MODEL_P (current_cpu))
1802 m32r_model_profile_insn (current_cpu, abuf);
1810 /* Perform not: not $dr,$sr. */
1812 SEM_FN_NAME (m32r,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1814 #define FLD(f) abuf->fields.fmt_31_mv.f
1815 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1816 CIA new_pc = SEM_NEXT_PC (sem_arg);
1818 * FLD (f_r1) = INVSI (* FLD (f_r2));
1819 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1821 #if WITH_PROFILE_MODEL_P
1822 if (PROFILE_MODEL_P (current_cpu))
1824 m32r_model_mark_get_h_gr (current_cpu, abuf);
1825 m32r_model_mark_set_h_gr (current_cpu, abuf);
1826 m32r_model_profile_insn (current_cpu, abuf);
1834 /* Perform rac: rac. */
1836 SEM_FN_NAME (m32r,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1838 #define FLD(f) abuf->fields.fmt_37_rac.f
1839 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1840 CIA new_pc = SEM_NEXT_PC (sem_arg);
1844 tmp_tmp1 = ANDDI (CPU (h_accum), MAKEDI (16777215, 0xffffffff));
1845 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (16383, 0xffff8000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
1846 tmp_tmp1 = MAKEDI (16383, 0xffff8000);
1848 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
1849 tmp_tmp1 = MAKEDI (16760832, 0);
1851 tmp_tmp1 = ANDDI (ADDDI (CPU (h_accum), MAKEDI (0, 16384)), MAKEDI (16777215, 0xffff8000));
1854 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
1855 CPU (h_accum) = SRADI (SLLDI (tmp_tmp1, 7), 7);
1856 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1859 #if WITH_PROFILE_MODEL_P
1860 if (PROFILE_MODEL_P (current_cpu))
1862 m32r_model_profile_insn (current_cpu, abuf);
1870 /* Perform rach: rach. */
1872 SEM_FN_NAME (m32r,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1874 #define FLD(f) abuf->fields.fmt_37_rac.f
1875 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1876 CIA new_pc = SEM_NEXT_PC (sem_arg);
1880 tmp_tmp1 = ANDDI (CPU (h_accum), MAKEDI (16777215, 0xffffffff));
1881 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
1882 tmp_tmp1 = MAKEDI (16383, 0x80000000);
1884 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
1885 tmp_tmp1 = MAKEDI (16760832, 0);
1887 tmp_tmp1 = ANDDI (ADDDI (CPU (h_accum), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
1890 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
1891 CPU (h_accum) = SRADI (SLLDI (tmp_tmp1, 7), 7);
1892 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
1895 #if WITH_PROFILE_MODEL_P
1896 if (PROFILE_MODEL_P (current_cpu))
1898 m32r_model_profile_insn (current_cpu, abuf);
1906 /* Perform rte: rte. */
1908 SEM_FN_NAME (m32r,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1910 #define FLD(f) abuf->fields.fmt_38_rte.f
1911 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1912 CIA new_pc = SEM_NEXT_PC (sem_arg);
1916 CPU (h_sm) = CPU (h_bsm);
1917 TRACE_RESULT (current_cpu, "h-sm-0", 'x', CPU (h_sm));
1918 CPU (h_ie) = CPU (h_bie);
1919 TRACE_RESULT (current_cpu, "h-ie-0", 'x', CPU (h_ie));
1920 CPU (h_cond) = CPU (h_bcond);
1921 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1922 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, CPU (h_bpc)));
1924 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
1927 #if WITH_PROFILE_MODEL_P
1928 if (PROFILE_MODEL_P (current_cpu))
1930 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
1938 /* Perform seth: seth $dr,#$hi16. */
1940 SEM_FN_NAME (m32r,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1942 #define FLD(f) abuf->fields.fmt_39_seth.f
1943 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1944 CIA new_pc = SEM_NEXT_PC (sem_arg);
1946 * FLD (f_r1) = SLLSI (FLD (f_hi16), 16);
1947 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1949 #if WITH_PROFILE_MODEL_P
1950 if (PROFILE_MODEL_P (current_cpu))
1952 m32r_model_mark_set_h_gr (current_cpu, abuf);
1953 m32r_model_profile_insn (current_cpu, abuf);
1961 /* Perform sll: sll $dr,$sr. */
1963 SEM_FN_NAME (m32r,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1965 #define FLD(f) abuf->fields.fmt_0_add.f
1966 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1967 CIA new_pc = SEM_NEXT_PC (sem_arg);
1969 * FLD (f_r1) = SLLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
1970 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1972 #if WITH_PROFILE_MODEL_P
1973 if (PROFILE_MODEL_P (current_cpu))
1975 m32r_model_mark_get_h_gr (current_cpu, abuf);
1976 m32r_model_mark_set_h_gr (current_cpu, abuf);
1977 m32r_model_profile_insn (current_cpu, abuf);
1985 /* Perform sll3: sll3 $dr,$sr,#$simm16. */
1987 SEM_FN_NAME (m32r,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1989 #define FLD(f) abuf->fields.fmt_5_addv3.f
1990 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1991 CIA new_pc = SEM_NEXT_PC (sem_arg);
1993 * FLD (f_r1) = SLLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
1994 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1996 #if WITH_PROFILE_MODEL_P
1997 if (PROFILE_MODEL_P (current_cpu))
1999 m32r_model_mark_get_h_gr (current_cpu, abuf);
2000 m32r_model_mark_set_h_gr (current_cpu, abuf);
2001 m32r_model_profile_insn (current_cpu, abuf);
2009 /* Perform slli: slli $dr,#$uimm5. */
2011 SEM_FN_NAME (m32r,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2013 #define FLD(f) abuf->fields.fmt_40_slli.f
2014 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2015 CIA new_pc = SEM_NEXT_PC (sem_arg);
2017 * FLD (f_r1) = SLLSI (* FLD (f_r1), FLD (f_uimm5));
2018 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2020 #if WITH_PROFILE_MODEL_P
2021 if (PROFILE_MODEL_P (current_cpu))
2023 m32r_model_mark_get_h_gr (current_cpu, abuf);
2024 m32r_model_mark_set_h_gr (current_cpu, abuf);
2025 m32r_model_profile_insn (current_cpu, abuf);
2033 /* Perform sra: sra $dr,$sr. */
2035 SEM_FN_NAME (m32r,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2037 #define FLD(f) abuf->fields.fmt_0_add.f
2038 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2039 CIA new_pc = SEM_NEXT_PC (sem_arg);
2041 * FLD (f_r1) = SRASI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
2042 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2044 #if WITH_PROFILE_MODEL_P
2045 if (PROFILE_MODEL_P (current_cpu))
2047 m32r_model_mark_get_h_gr (current_cpu, abuf);
2048 m32r_model_mark_set_h_gr (current_cpu, abuf);
2049 m32r_model_profile_insn (current_cpu, abuf);
2057 /* Perform sra3: sra3 $dr,$sr,#$simm16. */
2059 SEM_FN_NAME (m32r,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2061 #define FLD(f) abuf->fields.fmt_5_addv3.f
2062 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2063 CIA new_pc = SEM_NEXT_PC (sem_arg);
2065 * FLD (f_r1) = SRASI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
2066 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2068 #if WITH_PROFILE_MODEL_P
2069 if (PROFILE_MODEL_P (current_cpu))
2071 m32r_model_mark_get_h_gr (current_cpu, abuf);
2072 m32r_model_mark_set_h_gr (current_cpu, abuf);
2073 m32r_model_profile_insn (current_cpu, abuf);
2081 /* Perform srai: srai $dr,#$uimm5. */
2083 SEM_FN_NAME (m32r,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2085 #define FLD(f) abuf->fields.fmt_40_slli.f
2086 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2087 CIA new_pc = SEM_NEXT_PC (sem_arg);
2089 * FLD (f_r1) = SRASI (* FLD (f_r1), FLD (f_uimm5));
2090 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2092 #if WITH_PROFILE_MODEL_P
2093 if (PROFILE_MODEL_P (current_cpu))
2095 m32r_model_mark_get_h_gr (current_cpu, abuf);
2096 m32r_model_mark_set_h_gr (current_cpu, abuf);
2097 m32r_model_profile_insn (current_cpu, abuf);
2105 /* Perform srl: srl $dr,$sr. */
2107 SEM_FN_NAME (m32r,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2109 #define FLD(f) abuf->fields.fmt_0_add.f
2110 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2111 CIA new_pc = SEM_NEXT_PC (sem_arg);
2113 * FLD (f_r1) = SRLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
2114 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2116 #if WITH_PROFILE_MODEL_P
2117 if (PROFILE_MODEL_P (current_cpu))
2119 m32r_model_mark_get_h_gr (current_cpu, abuf);
2120 m32r_model_mark_set_h_gr (current_cpu, abuf);
2121 m32r_model_profile_insn (current_cpu, abuf);
2129 /* Perform srl3: srl3 $dr,$sr,#$simm16. */
2131 SEM_FN_NAME (m32r,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2133 #define FLD(f) abuf->fields.fmt_5_addv3.f
2134 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2135 CIA new_pc = SEM_NEXT_PC (sem_arg);
2137 * FLD (f_r1) = SRLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
2138 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2140 #if WITH_PROFILE_MODEL_P
2141 if (PROFILE_MODEL_P (current_cpu))
2143 m32r_model_mark_get_h_gr (current_cpu, abuf);
2144 m32r_model_mark_set_h_gr (current_cpu, abuf);
2145 m32r_model_profile_insn (current_cpu, abuf);
2153 /* Perform srli: srli $dr,#$uimm5. */
2155 SEM_FN_NAME (m32r,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2157 #define FLD(f) abuf->fields.fmt_40_slli.f
2158 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2159 CIA new_pc = SEM_NEXT_PC (sem_arg);
2161 * FLD (f_r1) = SRLSI (* FLD (f_r1), FLD (f_uimm5));
2162 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2164 #if WITH_PROFILE_MODEL_P
2165 if (PROFILE_MODEL_P (current_cpu))
2167 m32r_model_mark_get_h_gr (current_cpu, abuf);
2168 m32r_model_mark_set_h_gr (current_cpu, abuf);
2169 m32r_model_profile_insn (current_cpu, abuf);
2177 /* Perform st: st $src1,@$src2. */
2179 SEM_FN_NAME (m32r,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2181 #define FLD(f) abuf->fields.fmt_15_cmp.f
2182 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2183 CIA new_pc = SEM_NEXT_PC (sem_arg);
2185 SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2186 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2)));
2188 #if WITH_PROFILE_MODEL_P
2189 if (PROFILE_MODEL_P (current_cpu))
2191 m32r_model_mark_get_h_gr (current_cpu, abuf);
2192 m32r_model_profile_insn (current_cpu, abuf);
2200 /* Perform st-d: st $src1,@($slo16,$src2). */
2202 SEM_FN_NAME (m32r,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2204 #define FLD(f) abuf->fields.fmt_41_st_d.f
2205 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2206 CIA new_pc = SEM_NEXT_PC (sem_arg);
2208 SETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1));
2209 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
2211 #if WITH_PROFILE_MODEL_P
2212 if (PROFILE_MODEL_P (current_cpu))
2214 m32r_model_mark_get_h_gr (current_cpu, abuf);
2215 m32r_model_profile_insn (current_cpu, abuf);
2223 /* Perform stb: stb $src1,@$src2. */
2225 SEM_FN_NAME (m32r,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2227 #define FLD(f) abuf->fields.fmt_15_cmp.f
2228 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2229 CIA new_pc = SEM_NEXT_PC (sem_arg);
2231 SETMEMQI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2232 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMQI (current_cpu, * FLD (f_r2)));
2234 #if WITH_PROFILE_MODEL_P
2235 if (PROFILE_MODEL_P (current_cpu))
2237 m32r_model_mark_get_h_gr (current_cpu, abuf);
2238 m32r_model_profile_insn (current_cpu, abuf);
2246 /* Perform stb-d: stb $src1,@($slo16,$src2). */
2248 SEM_FN_NAME (m32r,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2250 #define FLD(f) abuf->fields.fmt_41_st_d.f
2251 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2252 CIA new_pc = SEM_NEXT_PC (sem_arg);
2254 SETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1));
2255 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
2257 #if WITH_PROFILE_MODEL_P
2258 if (PROFILE_MODEL_P (current_cpu))
2260 m32r_model_mark_get_h_gr (current_cpu, abuf);
2261 m32r_model_profile_insn (current_cpu, abuf);
2269 /* Perform sth: sth $src1,@$src2. */
2271 SEM_FN_NAME (m32r,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2273 #define FLD(f) abuf->fields.fmt_15_cmp.f
2274 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2275 CIA new_pc = SEM_NEXT_PC (sem_arg);
2277 SETMEMHI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2278 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMHI (current_cpu, * FLD (f_r2)));
2280 #if WITH_PROFILE_MODEL_P
2281 if (PROFILE_MODEL_P (current_cpu))
2283 m32r_model_mark_get_h_gr (current_cpu, abuf);
2284 m32r_model_profile_insn (current_cpu, abuf);
2292 /* Perform sth-d: sth $src1,@($slo16,$src2). */
2294 SEM_FN_NAME (m32r,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2296 #define FLD(f) abuf->fields.fmt_41_st_d.f
2297 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2298 CIA new_pc = SEM_NEXT_PC (sem_arg);
2300 SETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1));
2301 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
2303 #if WITH_PROFILE_MODEL_P
2304 if (PROFILE_MODEL_P (current_cpu))
2306 m32r_model_mark_get_h_gr (current_cpu, abuf);
2307 m32r_model_profile_insn (current_cpu, abuf);
2315 /* Perform st-plus: st $src1,@+$src2. */
2317 SEM_FN_NAME (m32r,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2319 #define FLD(f) abuf->fields.fmt_15_cmp.f
2320 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2321 CIA new_pc = SEM_NEXT_PC (sem_arg);
2324 * FLD (f_r2) = ADDSI (* FLD (f_r2), 4);
2325 TRACE_RESULT (current_cpu, "src2", 'x', * FLD (f_r2));
2326 SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2327 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2)));
2330 #if WITH_PROFILE_MODEL_P
2331 if (PROFILE_MODEL_P (current_cpu))
2333 m32r_model_mark_get_h_gr (current_cpu, abuf);
2334 m32r_model_profile_insn (current_cpu, abuf);
2342 /* Perform st-minus: st $src1,@-$src2. */
2344 SEM_FN_NAME (m32r,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2346 #define FLD(f) abuf->fields.fmt_15_cmp.f
2347 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2348 CIA new_pc = SEM_NEXT_PC (sem_arg);
2351 * FLD (f_r2) = SUBSI (* FLD (f_r2), 4);
2352 TRACE_RESULT (current_cpu, "src2", 'x', * FLD (f_r2));
2353 SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2354 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2)));
2357 #if WITH_PROFILE_MODEL_P
2358 if (PROFILE_MODEL_P (current_cpu))
2360 m32r_model_mark_get_h_gr (current_cpu, abuf);
2361 m32r_model_profile_insn (current_cpu, abuf);
2369 /* Perform sub: sub $dr,$sr. */
2371 SEM_FN_NAME (m32r,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2373 #define FLD(f) abuf->fields.fmt_0_add.f
2374 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2375 CIA new_pc = SEM_NEXT_PC (sem_arg);
2377 * FLD (f_r1) = SUBSI (* FLD (f_r1), * FLD (f_r2));
2378 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2380 #if WITH_PROFILE_MODEL_P
2381 if (PROFILE_MODEL_P (current_cpu))
2383 m32r_model_mark_get_h_gr (current_cpu, abuf);
2384 m32r_model_mark_set_h_gr (current_cpu, abuf);
2385 m32r_model_profile_insn (current_cpu, abuf);
2393 /* Perform subv: subv $dr,$sr. */
2395 SEM_FN_NAME (m32r,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2397 #define FLD(f) abuf->fields.fmt_0_add.f
2398 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2399 CIA new_pc = SEM_NEXT_PC (sem_arg);
2403 temp0 = SUBSI (* FLD (f_r1), * FLD (f_r2));
2404 temp1 = SUBOFSI (* FLD (f_r1), * FLD (f_r2), 0);
2405 * FLD (f_r1) = temp0;
2406 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2407 CPU (h_cond) = temp1;
2408 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2411 #if WITH_PROFILE_MODEL_P
2412 if (PROFILE_MODEL_P (current_cpu))
2414 m32r_model_mark_get_h_gr (current_cpu, abuf);
2415 m32r_model_mark_set_h_gr (current_cpu, abuf);
2416 m32r_model_profile_insn (current_cpu, abuf);
2424 /* Perform subx: subx $dr,$sr. */
2426 SEM_FN_NAME (m32r,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2428 #define FLD(f) abuf->fields.fmt_6_addx.f
2429 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2430 CIA new_pc = SEM_NEXT_PC (sem_arg);
2434 temp0 = SUBCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
2435 temp1 = SUBCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
2436 * FLD (f_r1) = temp0;
2437 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2438 CPU (h_cond) = temp1;
2439 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2442 #if WITH_PROFILE_MODEL_P
2443 if (PROFILE_MODEL_P (current_cpu))
2445 m32r_model_mark_get_h_gr (current_cpu, abuf);
2446 m32r_model_mark_set_h_gr (current_cpu, abuf);
2447 m32r_model_profile_insn (current_cpu, abuf);
2455 /* Perform trap: trap #$uimm4. */
2457 SEM_FN_NAME (m32r,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2459 #define FLD(f) abuf->fields.fmt_42_trap.f
2460 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2461 CIA new_pc = SEM_NEXT_PC (sem_arg);
2464 do_trap (current_cpu, FLD (f_uimm4));
2466 #if WITH_PROFILE_MODEL_P
2467 if (PROFILE_MODEL_P (current_cpu))
2469 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
2477 /* Perform unlock: unlock $src1,@$src2. */
2479 SEM_FN_NAME (m32r,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2481 #define FLD(f) abuf->fields.fmt_15_cmp.f
2482 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2483 CIA new_pc = SEM_NEXT_PC (sem_arg);
2485 do_unlock (current_cpu, * FLD (f_r1), * FLD (f_r2));
2487 #if WITH_PROFILE_MODEL_P
2488 if (PROFILE_MODEL_P (current_cpu))
2490 m32r_model_mark_get_h_gr (current_cpu, abuf);
2491 m32r_model_profile_insn (current_cpu, abuf);
2499 /* FIXME: Add "no return" attribute to illegal insn handlers.
2500 They all call longjmp. */
2503 SEM_FN_NAME (m32r,illegal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2505 sim_engine_illegal_insn (current_cpu, NULL_CIA /*FIXME*/);
2509 #endif /* ! defined (SCACHE_P) || (defined (SCACHE_P) && WITH_SCACHE) */