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_add.f
43 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
44 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
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,$hash$slo16. */
64 SEM_FN_NAME (m32r,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
66 #define FLD(f) abuf->fields.fmt_add3.f
67 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
68 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
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_add.f
91 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
92 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
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_and3.f
115 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
116 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
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_add.f
139 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
140 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
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,$hash$ulo16. */
160 SEM_FN_NAME (m32r,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
162 #define FLD(f) abuf->fields.fmt_or3.f
163 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
164 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
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_add.f
187 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
188 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
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_and3.f
211 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
212 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
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_addi.f
235 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
236 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
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_addv.f
259 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
260 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
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_addv3.f
290 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
291 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
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_addx.f
321 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
322 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
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_bc8.f
352 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
353 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
357 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8)));
359 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
362 #if WITH_PROFILE_MODEL_P
363 if (PROFILE_MODEL_P (current_cpu))
365 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
373 /* Perform bc24: bc $disp24. */
375 SEM_FN_NAME (m32r,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
377 #define FLD(f) abuf->fields.fmt_bc24.f
378 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
379 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
383 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24)));
385 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
388 #if WITH_PROFILE_MODEL_P
389 if (PROFILE_MODEL_P (current_cpu))
391 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
399 /* Perform beq: beq $src1,$src2,$disp16. */
401 SEM_FN_NAME (m32r,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
403 #define FLD(f) abuf->fields.fmt_beq.f
404 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
405 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
408 if (EQSI (* FLD (f_r1), * FLD (f_r2))) {
409 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
411 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
414 #if WITH_PROFILE_MODEL_P
415 if (PROFILE_MODEL_P (current_cpu))
417 m32r_model_mark_get_h_gr (current_cpu, abuf);
418 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
426 /* Perform beqz: beqz $src2,$disp16. */
428 SEM_FN_NAME (m32r,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
430 #define FLD(f) abuf->fields.fmt_beqz.f
431 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
432 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
435 if (EQSI (* FLD (f_r2), 0)) {
436 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
438 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
441 #if WITH_PROFILE_MODEL_P
442 if (PROFILE_MODEL_P (current_cpu))
444 m32r_model_mark_get_h_gr (current_cpu, abuf);
445 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
453 /* Perform bgez: bgez $src2,$disp16. */
455 SEM_FN_NAME (m32r,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
457 #define FLD(f) abuf->fields.fmt_beqz.f
458 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
459 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
462 if (GESI (* FLD (f_r2), 0)) {
463 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
465 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
468 #if WITH_PROFILE_MODEL_P
469 if (PROFILE_MODEL_P (current_cpu))
471 m32r_model_mark_get_h_gr (current_cpu, abuf);
472 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
480 /* Perform bgtz: bgtz $src2,$disp16. */
482 SEM_FN_NAME (m32r,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
484 #define FLD(f) abuf->fields.fmt_beqz.f
485 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
486 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
489 if (GTSI (* FLD (f_r2), 0)) {
490 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
492 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
495 #if WITH_PROFILE_MODEL_P
496 if (PROFILE_MODEL_P (current_cpu))
498 m32r_model_mark_get_h_gr (current_cpu, abuf);
499 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
507 /* Perform blez: blez $src2,$disp16. */
509 SEM_FN_NAME (m32r,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
511 #define FLD(f) abuf->fields.fmt_beqz.f
512 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
513 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
516 if (LESI (* FLD (f_r2), 0)) {
517 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
519 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
522 #if WITH_PROFILE_MODEL_P
523 if (PROFILE_MODEL_P (current_cpu))
525 m32r_model_mark_get_h_gr (current_cpu, abuf);
526 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
534 /* Perform bltz: bltz $src2,$disp16. */
536 SEM_FN_NAME (m32r,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
538 #define FLD(f) abuf->fields.fmt_beqz.f
539 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
540 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
543 if (LTSI (* FLD (f_r2), 0)) {
544 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
546 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
549 #if WITH_PROFILE_MODEL_P
550 if (PROFILE_MODEL_P (current_cpu))
552 m32r_model_mark_get_h_gr (current_cpu, abuf);
553 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
561 /* Perform bnez: bnez $src2,$disp16. */
563 SEM_FN_NAME (m32r,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
565 #define FLD(f) abuf->fields.fmt_beqz.f
566 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
567 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
570 if (NESI (* FLD (f_r2), 0)) {
571 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
573 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
576 #if WITH_PROFILE_MODEL_P
577 if (PROFILE_MODEL_P (current_cpu))
579 m32r_model_mark_get_h_gr (current_cpu, abuf);
580 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
588 /* Perform bl8: bl $disp8. */
590 SEM_FN_NAME (m32r,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
592 #define FLD(f) abuf->fields.fmt_bl8.f
593 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
594 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
598 CPU (h_gr[14]) = ADDSI (ANDSI (CPU (h_pc), -4), 4);
599 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
600 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8)));
602 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
605 #if WITH_PROFILE_MODEL_P
606 if (PROFILE_MODEL_P (current_cpu))
608 m32r_model_mark_set_h_gr (current_cpu, abuf);
609 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
617 /* Perform bl24: bl $disp24. */
619 SEM_FN_NAME (m32r,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
621 #define FLD(f) abuf->fields.fmt_bl24.f
622 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
623 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
627 CPU (h_gr[14]) = ADDSI (CPU (h_pc), 4);
628 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
629 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24)));
631 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
634 #if WITH_PROFILE_MODEL_P
635 if (PROFILE_MODEL_P (current_cpu))
637 m32r_model_mark_set_h_gr (current_cpu, abuf);
638 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
646 /* Perform bnc8: bnc $disp8. */
648 SEM_FN_NAME (m32r,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
650 #define FLD(f) abuf->fields.fmt_bc8.f
651 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
652 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
655 if (NOTBI (CPU (h_cond))) {
656 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8)));
658 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
661 #if WITH_PROFILE_MODEL_P
662 if (PROFILE_MODEL_P (current_cpu))
664 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
672 /* Perform bnc24: bnc $disp24. */
674 SEM_FN_NAME (m32r,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
676 #define FLD(f) abuf->fields.fmt_bc24.f
677 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
678 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
681 if (NOTBI (CPU (h_cond))) {
682 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24)));
684 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
687 #if WITH_PROFILE_MODEL_P
688 if (PROFILE_MODEL_P (current_cpu))
690 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
698 /* Perform bne: bne $src1,$src2,$disp16. */
700 SEM_FN_NAME (m32r,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
702 #define FLD(f) abuf->fields.fmt_beq.f
703 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
704 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
707 if (NESI (* FLD (f_r1), * FLD (f_r2))) {
708 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16)));
710 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
713 #if WITH_PROFILE_MODEL_P
714 if (PROFILE_MODEL_P (current_cpu))
716 m32r_model_mark_get_h_gr (current_cpu, abuf);
717 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
725 /* Perform bra8: bra $disp8. */
727 SEM_FN_NAME (m32r,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
729 #define FLD(f) abuf->fields.fmt_bra8.f
730 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
731 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
734 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8)));
736 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
738 #if WITH_PROFILE_MODEL_P
739 if (PROFILE_MODEL_P (current_cpu))
741 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
749 /* Perform bra24: bra $disp24. */
751 SEM_FN_NAME (m32r,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
753 #define FLD(f) abuf->fields.fmt_bra24.f
754 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
755 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
758 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24)));
760 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
762 #if WITH_PROFILE_MODEL_P
763 if (PROFILE_MODEL_P (current_cpu))
765 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
773 /* Perform cmp: cmp $src1,$src2. */
775 SEM_FN_NAME (m32r,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
777 #define FLD(f) abuf->fields.fmt_cmp.f
778 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
779 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
781 CPU (h_cond) = LTSI (* FLD (f_r1), * FLD (f_r2));
782 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
784 #if WITH_PROFILE_MODEL_P
785 if (PROFILE_MODEL_P (current_cpu))
787 m32r_model_mark_get_h_gr (current_cpu, abuf);
788 m32r_model_profile_insn (current_cpu, abuf);
796 /* Perform cmpi: cmpi $src2,$simm16. */
798 SEM_FN_NAME (m32r,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
800 #define FLD(f) abuf->fields.fmt_cmpi.f
801 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
802 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
804 CPU (h_cond) = LTSI (* FLD (f_r2), FLD (f_simm16));
805 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
807 #if WITH_PROFILE_MODEL_P
808 if (PROFILE_MODEL_P (current_cpu))
810 m32r_model_mark_get_h_gr (current_cpu, abuf);
811 m32r_model_profile_insn (current_cpu, abuf);
819 /* Perform cmpu: cmpu $src1,$src2. */
821 SEM_FN_NAME (m32r,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
823 #define FLD(f) abuf->fields.fmt_cmp.f
824 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
825 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
827 CPU (h_cond) = LTUSI (* FLD (f_r1), * FLD (f_r2));
828 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
830 #if WITH_PROFILE_MODEL_P
831 if (PROFILE_MODEL_P (current_cpu))
833 m32r_model_mark_get_h_gr (current_cpu, abuf);
834 m32r_model_profile_insn (current_cpu, abuf);
842 /* Perform cmpui: cmpui $src2,$simm16. */
844 SEM_FN_NAME (m32r,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
846 #define FLD(f) abuf->fields.fmt_cmpi.f
847 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
848 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
850 CPU (h_cond) = LTUSI (* FLD (f_r2), FLD (f_simm16));
851 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
853 #if WITH_PROFILE_MODEL_P
854 if (PROFILE_MODEL_P (current_cpu))
856 m32r_model_mark_get_h_gr (current_cpu, abuf);
857 m32r_model_profile_insn (current_cpu, abuf);
865 /* Perform div: div $dr,$sr. */
867 SEM_FN_NAME (m32r,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
869 #define FLD(f) abuf->fields.fmt_div.f
870 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
871 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
873 if (NESI (* FLD (f_r2), 0)) {
874 * FLD (f_r1) = DIVSI (* FLD (f_r1), * FLD (f_r2));
875 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
878 #if WITH_PROFILE_MODEL_P
879 if (PROFILE_MODEL_P (current_cpu))
881 m32r_model_mark_get_h_gr (current_cpu, abuf);
882 m32r_model_mark_set_h_gr (current_cpu, abuf);
883 m32r_model_profile_insn (current_cpu, abuf);
891 /* Perform divu: divu $dr,$sr. */
893 SEM_FN_NAME (m32r,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
895 #define FLD(f) abuf->fields.fmt_div.f
896 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
897 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
899 if (NESI (* FLD (f_r2), 0)) {
900 * FLD (f_r1) = UDIVSI (* FLD (f_r1), * FLD (f_r2));
901 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
904 #if WITH_PROFILE_MODEL_P
905 if (PROFILE_MODEL_P (current_cpu))
907 m32r_model_mark_get_h_gr (current_cpu, abuf);
908 m32r_model_mark_set_h_gr (current_cpu, abuf);
909 m32r_model_profile_insn (current_cpu, abuf);
917 /* Perform rem: rem $dr,$sr. */
919 SEM_FN_NAME (m32r,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
921 #define FLD(f) abuf->fields.fmt_div.f
922 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
923 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
925 if (NESI (* FLD (f_r2), 0)) {
926 * FLD (f_r1) = MODSI (* FLD (f_r1), * FLD (f_r2));
927 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
930 #if WITH_PROFILE_MODEL_P
931 if (PROFILE_MODEL_P (current_cpu))
933 m32r_model_mark_get_h_gr (current_cpu, abuf);
934 m32r_model_mark_set_h_gr (current_cpu, abuf);
935 m32r_model_profile_insn (current_cpu, abuf);
943 /* Perform remu: remu $dr,$sr. */
945 SEM_FN_NAME (m32r,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
947 #define FLD(f) abuf->fields.fmt_div.f
948 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
949 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
951 if (NESI (* FLD (f_r2), 0)) {
952 * FLD (f_r1) = UMODSI (* FLD (f_r1), * FLD (f_r2));
953 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
956 #if WITH_PROFILE_MODEL_P
957 if (PROFILE_MODEL_P (current_cpu))
959 m32r_model_mark_get_h_gr (current_cpu, abuf);
960 m32r_model_mark_set_h_gr (current_cpu, abuf);
961 m32r_model_profile_insn (current_cpu, abuf);
969 /* Perform jl: jl $sr. */
971 SEM_FN_NAME (m32r,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
973 #define FLD(f) abuf->fields.fmt_jl.f
974 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
975 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
980 temp0 = ADDSI (ANDSI (CPU (h_pc), -4), 4);
981 temp1 = * FLD (f_r2);
982 CPU (h_gr[14]) = temp0;
983 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
984 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, temp1));
986 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
989 #if WITH_PROFILE_MODEL_P
990 if (PROFILE_MODEL_P (current_cpu))
992 m32r_model_mark_get_h_gr (current_cpu, abuf);
993 m32r_model_mark_set_h_gr (current_cpu, abuf);
994 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
1002 /* Perform jmp: jmp $sr. */
1004 SEM_FN_NAME (m32r,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1006 #define FLD(f) abuf->fields.fmt_jmp.f
1007 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1008 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1011 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, * FLD (f_r2)));
1013 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
1015 #if WITH_PROFILE_MODEL_P
1016 if (PROFILE_MODEL_P (current_cpu))
1018 m32r_model_mark_get_h_gr (current_cpu, abuf);
1019 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
1027 /* Perform ld: ld $dr,@$sr. */
1029 SEM_FN_NAME (m32r,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1031 #define FLD(f) abuf->fields.fmt_ld.f
1032 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1033 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1035 * FLD (f_r1) = GETMEMSI (current_cpu, * FLD (f_r2));
1036 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1038 #if WITH_PROFILE_MODEL_P
1039 if (PROFILE_MODEL_P (current_cpu))
1041 m32r_model_mark_get_h_gr (current_cpu, abuf);
1042 m32r_model_mark_set_h_gr (current_cpu, abuf);
1043 m32r_model_profile_insn (current_cpu, abuf);
1051 /* Perform ld-d: ld $dr,@($slo16,$sr). */
1053 SEM_FN_NAME (m32r,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1055 #define FLD(f) abuf->fields.fmt_ld_d.f
1056 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1057 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1059 * FLD (f_r1) = GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)));
1060 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1062 #if WITH_PROFILE_MODEL_P
1063 if (PROFILE_MODEL_P (current_cpu))
1065 m32r_model_mark_get_h_gr (current_cpu, abuf);
1066 m32r_model_mark_set_h_gr (current_cpu, abuf);
1067 m32r_model_profile_insn (current_cpu, abuf);
1075 /* Perform ldb: ldb $dr,@$sr. */
1077 SEM_FN_NAME (m32r,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1079 #define FLD(f) abuf->fields.fmt_ldb.f
1080 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1081 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1083 * FLD (f_r1) = EXTQISI (GETMEMQI (current_cpu, * FLD (f_r2)));
1084 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1086 #if WITH_PROFILE_MODEL_P
1087 if (PROFILE_MODEL_P (current_cpu))
1089 m32r_model_mark_get_h_gr (current_cpu, abuf);
1090 m32r_model_mark_set_h_gr (current_cpu, abuf);
1091 m32r_model_profile_insn (current_cpu, abuf);
1099 /* Perform ldb-d: ldb $dr,@($slo16,$sr). */
1101 SEM_FN_NAME (m32r,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1103 #define FLD(f) abuf->fields.fmt_ldb_d.f
1104 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1105 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1107 * FLD (f_r1) = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
1108 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1110 #if WITH_PROFILE_MODEL_P
1111 if (PROFILE_MODEL_P (current_cpu))
1113 m32r_model_mark_get_h_gr (current_cpu, abuf);
1114 m32r_model_mark_set_h_gr (current_cpu, abuf);
1115 m32r_model_profile_insn (current_cpu, abuf);
1123 /* Perform ldh: ldh $dr,@$sr. */
1125 SEM_FN_NAME (m32r,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1127 #define FLD(f) abuf->fields.fmt_ldh.f
1128 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1129 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1131 * FLD (f_r1) = EXTHISI (GETMEMHI (current_cpu, * FLD (f_r2)));
1132 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1134 #if WITH_PROFILE_MODEL_P
1135 if (PROFILE_MODEL_P (current_cpu))
1137 m32r_model_mark_get_h_gr (current_cpu, abuf);
1138 m32r_model_mark_set_h_gr (current_cpu, abuf);
1139 m32r_model_profile_insn (current_cpu, abuf);
1147 /* Perform ldh-d: ldh $dr,@($slo16,$sr). */
1149 SEM_FN_NAME (m32r,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1151 #define FLD(f) abuf->fields.fmt_ldh_d.f
1152 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1153 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1155 * FLD (f_r1) = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
1156 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1158 #if WITH_PROFILE_MODEL_P
1159 if (PROFILE_MODEL_P (current_cpu))
1161 m32r_model_mark_get_h_gr (current_cpu, abuf);
1162 m32r_model_mark_set_h_gr (current_cpu, abuf);
1163 m32r_model_profile_insn (current_cpu, abuf);
1171 /* Perform ldub: ldub $dr,@$sr. */
1173 SEM_FN_NAME (m32r,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1175 #define FLD(f) abuf->fields.fmt_ldb.f
1176 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1177 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1179 * FLD (f_r1) = ZEXTQISI (GETMEMQI (current_cpu, * FLD (f_r2)));
1180 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1182 #if WITH_PROFILE_MODEL_P
1183 if (PROFILE_MODEL_P (current_cpu))
1185 m32r_model_mark_get_h_gr (current_cpu, abuf);
1186 m32r_model_mark_set_h_gr (current_cpu, abuf);
1187 m32r_model_profile_insn (current_cpu, abuf);
1195 /* Perform ldub-d: ldub $dr,@($slo16,$sr). */
1197 SEM_FN_NAME (m32r,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1199 #define FLD(f) abuf->fields.fmt_ldb_d.f
1200 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1201 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1203 * FLD (f_r1) = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
1204 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1206 #if WITH_PROFILE_MODEL_P
1207 if (PROFILE_MODEL_P (current_cpu))
1209 m32r_model_mark_get_h_gr (current_cpu, abuf);
1210 m32r_model_mark_set_h_gr (current_cpu, abuf);
1211 m32r_model_profile_insn (current_cpu, abuf);
1219 /* Perform lduh: lduh $dr,@$sr. */
1221 SEM_FN_NAME (m32r,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1223 #define FLD(f) abuf->fields.fmt_ldh.f
1224 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1225 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1227 * FLD (f_r1) = ZEXTHISI (GETMEMHI (current_cpu, * FLD (f_r2)));
1228 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1230 #if WITH_PROFILE_MODEL_P
1231 if (PROFILE_MODEL_P (current_cpu))
1233 m32r_model_mark_get_h_gr (current_cpu, abuf);
1234 m32r_model_mark_set_h_gr (current_cpu, abuf);
1235 m32r_model_profile_insn (current_cpu, abuf);
1243 /* Perform lduh-d: lduh $dr,@($slo16,$sr). */
1245 SEM_FN_NAME (m32r,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1247 #define FLD(f) abuf->fields.fmt_ldh_d.f
1248 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1249 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1251 * FLD (f_r1) = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
1252 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1254 #if WITH_PROFILE_MODEL_P
1255 if (PROFILE_MODEL_P (current_cpu))
1257 m32r_model_mark_get_h_gr (current_cpu, abuf);
1258 m32r_model_mark_set_h_gr (current_cpu, abuf);
1259 m32r_model_profile_insn (current_cpu, abuf);
1267 /* Perform ld-plus: ld $dr,@$sr+. */
1269 SEM_FN_NAME (m32r,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1271 #define FLD(f) abuf->fields.fmt_ld_plus.f
1272 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1273 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1277 temp0 = GETMEMSI (current_cpu, * FLD (f_r2));
1278 temp1 = ADDSI (* FLD (f_r2), 4);
1279 * FLD (f_r1) = temp0;
1280 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1281 * FLD (f_r2) = temp1;
1282 TRACE_RESULT (current_cpu, "sr", 'x', * FLD (f_r2));
1285 #if WITH_PROFILE_MODEL_P
1286 if (PROFILE_MODEL_P (current_cpu))
1288 m32r_model_mark_get_h_gr (current_cpu, abuf);
1289 m32r_model_mark_set_h_gr (current_cpu, abuf);
1290 m32r_model_profile_insn (current_cpu, abuf);
1298 /* Perform ld24: ld24 $dr,$uimm24. */
1300 SEM_FN_NAME (m32r,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1302 #define FLD(f) abuf->fields.fmt_ld24.f
1303 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1304 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1306 * FLD (f_r1) = FLD (f_uimm24);
1307 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1309 #if WITH_PROFILE_MODEL_P
1310 if (PROFILE_MODEL_P (current_cpu))
1312 m32r_model_mark_set_h_gr (current_cpu, abuf);
1313 m32r_model_profile_insn (current_cpu, abuf);
1321 /* Perform ldi8: ldi $dr,$simm8. */
1323 SEM_FN_NAME (m32r,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1325 #define FLD(f) abuf->fields.fmt_ldi8.f
1326 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1327 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1329 * FLD (f_r1) = FLD (f_simm8);
1330 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1332 #if WITH_PROFILE_MODEL_P
1333 if (PROFILE_MODEL_P (current_cpu))
1335 m32r_model_mark_set_h_gr (current_cpu, abuf);
1336 m32r_model_profile_insn (current_cpu, abuf);
1344 /* Perform ldi16: ldi $dr,$hash$slo16. */
1346 SEM_FN_NAME (m32r,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1348 #define FLD(f) abuf->fields.fmt_ldi16.f
1349 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1350 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1352 * FLD (f_r1) = FLD (f_simm16);
1353 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1355 #if WITH_PROFILE_MODEL_P
1356 if (PROFILE_MODEL_P (current_cpu))
1358 m32r_model_mark_set_h_gr (current_cpu, abuf);
1359 m32r_model_profile_insn (current_cpu, abuf);
1367 /* Perform lock: lock $dr,@$sr. */
1369 SEM_FN_NAME (m32r,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1371 #define FLD(f) abuf->fields.fmt_lock.f
1372 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1373 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1377 TRACE_RESULT (current_cpu, "h-lock-0", 'x', CPU (h_lock));
1378 * FLD (f_r1) = GETMEMSI (current_cpu, * FLD (f_r2));
1379 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1382 #if WITH_PROFILE_MODEL_P
1383 if (PROFILE_MODEL_P (current_cpu))
1385 m32r_model_mark_get_h_gr (current_cpu, abuf);
1386 m32r_model_mark_set_h_gr (current_cpu, abuf);
1387 m32r_model_profile_insn (current_cpu, abuf);
1395 /* Perform machi: machi $src1,$src2. */
1397 SEM_FN_NAME (m32r,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1399 #define FLD(f) abuf->fields.fmt_machi.f
1400 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1401 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1403 m32r_h_accum_set (current_cpu, SRADI (SLLDI (ADDDI (m32r_h_accum_get (current_cpu), MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8));
1404 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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 maclo: maclo $src1,$src2. */
1420 SEM_FN_NAME (m32r,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1422 #define FLD(f) abuf->fields.fmt_machi.f
1423 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1424 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1426 m32r_h_accum_set (current_cpu, SRADI (SLLDI (ADDDI (m32r_h_accum_get (current_cpu), MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8));
1427 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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 macwhi: macwhi $src1,$src2. */
1443 SEM_FN_NAME (m32r,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1445 #define FLD(f) abuf->fields.fmt_machi.f
1446 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1447 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1449 m32r_h_accum_set (current_cpu, SRADI (SLLDI (ADDDI (m32r_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8));
1450 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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 macwlo: macwlo $src1,$src2. */
1466 SEM_FN_NAME (m32r,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1468 #define FLD(f) abuf->fields.fmt_machi.f
1469 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1470 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1472 m32r_h_accum_set (current_cpu, SRADI (SLLDI (ADDDI (m32r_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8));
1473 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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_profile_insn (current_cpu, abuf);
1487 /* Perform mul: mul $dr,$sr. */
1489 SEM_FN_NAME (m32r,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1491 #define FLD(f) abuf->fields.fmt_add.f
1492 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1493 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1495 * FLD (f_r1) = MULSI (* FLD (f_r1), * FLD (f_r2));
1496 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1498 #if WITH_PROFILE_MODEL_P
1499 if (PROFILE_MODEL_P (current_cpu))
1501 m32r_model_mark_get_h_gr (current_cpu, abuf);
1502 m32r_model_mark_set_h_gr (current_cpu, abuf);
1503 m32r_model_profile_insn (current_cpu, abuf);
1511 /* Perform mulhi: mulhi $src1,$src2. */
1513 SEM_FN_NAME (m32r,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1515 #define FLD(f) abuf->fields.fmt_mulhi.f
1516 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1517 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1519 m32r_h_accum_set (current_cpu, SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 16), 16));
1520 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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 mullo: mullo $src1,$src2. */
1536 SEM_FN_NAME (m32r,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1538 #define FLD(f) abuf->fields.fmt_mulhi.f
1539 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1540 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1542 m32r_h_accum_set (current_cpu, SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 16), 16));
1543 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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 mulwhi: mulwhi $src1,$src2. */
1559 SEM_FN_NAME (m32r,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1561 #define FLD(f) abuf->fields.fmt_mulhi.f
1562 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1563 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1565 m32r_h_accum_set (current_cpu, SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 8), 8));
1566 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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 mulwlo: mulwlo $src1,$src2. */
1582 SEM_FN_NAME (m32r,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1584 #define FLD(f) abuf->fields.fmt_mulhi.f
1585 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1586 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1588 m32r_h_accum_set (current_cpu, SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 8), 8));
1589 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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_profile_insn (current_cpu, abuf);
1603 /* Perform mv: mv $dr,$sr. */
1605 SEM_FN_NAME (m32r,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1607 #define FLD(f) abuf->fields.fmt_mv.f
1608 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1609 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1611 * FLD (f_r1) = * FLD (f_r2);
1612 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1614 #if WITH_PROFILE_MODEL_P
1615 if (PROFILE_MODEL_P (current_cpu))
1617 m32r_model_mark_get_h_gr (current_cpu, abuf);
1618 m32r_model_mark_set_h_gr (current_cpu, abuf);
1619 m32r_model_profile_insn (current_cpu, abuf);
1627 /* Perform mvfachi: mvfachi $dr. */
1629 SEM_FN_NAME (m32r,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1631 #define FLD(f) abuf->fields.fmt_mvfachi.f
1632 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1633 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1635 * FLD (f_r1) = TRUNCDISI (SRADI (m32r_h_accum_get (current_cpu), 32));
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 mvfaclo: mvfaclo $dr. */
1652 SEM_FN_NAME (m32r,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1654 #define FLD(f) abuf->fields.fmt_mvfachi.f
1655 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1656 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1658 * FLD (f_r1) = TRUNCDISI (m32r_h_accum_get (current_cpu));
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 mvfacmi: mvfacmi $dr. */
1675 SEM_FN_NAME (m32r,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1677 #define FLD(f) abuf->fields.fmt_mvfachi.f
1678 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1679 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1681 * FLD (f_r1) = TRUNCDISI (SRADI (m32r_h_accum_get (current_cpu), 16));
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 mvfc: mvfc $dr,$scr. */
1698 SEM_FN_NAME (m32r,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1700 #define FLD(f) abuf->fields.fmt_mvfc.f
1701 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1702 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1704 * FLD (f_r1) = m32r_h_cr_get (current_cpu, FLD (f_r2));
1705 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1707 #if WITH_PROFILE_MODEL_P
1708 if (PROFILE_MODEL_P (current_cpu))
1710 m32r_model_mark_set_h_gr (current_cpu, abuf);
1711 m32r_model_profile_insn (current_cpu, abuf);
1719 /* Perform mvtachi: mvtachi $src1. */
1721 SEM_FN_NAME (m32r,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1723 #define FLD(f) abuf->fields.fmt_mvtachi.f
1724 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1725 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1727 m32r_h_accum_set (current_cpu, ORDI (ANDDI (m32r_h_accum_get (current_cpu), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (f_r1)), 32)));
1728 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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 mvtaclo: mvtaclo $src1. */
1744 SEM_FN_NAME (m32r,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1746 #define FLD(f) abuf->fields.fmt_mvtachi.f
1747 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1748 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1750 m32r_h_accum_set (current_cpu, ORDI (ANDDI (m32r_h_accum_get (current_cpu), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (f_r1))));
1751 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
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 mvtc: mvtc $sr,$dcr. */
1767 SEM_FN_NAME (m32r,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1769 #define FLD(f) abuf->fields.fmt_mvtc.f
1770 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1771 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1773 m32r_h_cr_set (current_cpu, FLD (f_r1), * FLD (f_r2));
1774 TRACE_RESULT (current_cpu, "dcr", 'x', m32r_h_cr_get (current_cpu, 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_profile_insn (current_cpu, abuf);
1788 /* Perform neg: neg $dr,$sr. */
1790 SEM_FN_NAME (m32r,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1792 #define FLD(f) abuf->fields.fmt_mv.f
1793 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1794 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1796 * FLD (f_r1) = NEGSI (* FLD (f_r2));
1797 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1799 #if WITH_PROFILE_MODEL_P
1800 if (PROFILE_MODEL_P (current_cpu))
1802 m32r_model_mark_get_h_gr (current_cpu, abuf);
1803 m32r_model_mark_set_h_gr (current_cpu, abuf);
1804 m32r_model_profile_insn (current_cpu, abuf);
1812 /* Perform nop: nop. */
1814 SEM_FN_NAME (m32r,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1816 #define FLD(f) abuf->fields.fmt_nop.f
1817 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1818 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1820 PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
1822 #if WITH_PROFILE_MODEL_P
1823 if (PROFILE_MODEL_P (current_cpu))
1825 m32r_model_profile_insn (current_cpu, abuf);
1833 /* Perform not: not $dr,$sr. */
1835 SEM_FN_NAME (m32r,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1837 #define FLD(f) abuf->fields.fmt_mv.f
1838 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1839 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1841 * FLD (f_r1) = INVSI (* FLD (f_r2));
1842 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1844 #if WITH_PROFILE_MODEL_P
1845 if (PROFILE_MODEL_P (current_cpu))
1847 m32r_model_mark_get_h_gr (current_cpu, abuf);
1848 m32r_model_mark_set_h_gr (current_cpu, abuf);
1849 m32r_model_profile_insn (current_cpu, abuf);
1857 /* Perform rac: rac. */
1859 SEM_FN_NAME (m32r,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1861 #define FLD(f) abuf->fields.fmt_rac.f
1862 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1863 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1867 tmp_tmp1 = SLLDI (m32r_h_accum_get (current_cpu), 1);
1868 tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768));
1869 m32r_h_accum_set (current_cpu, (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000))));
1870 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
1873 #if WITH_PROFILE_MODEL_P
1874 if (PROFILE_MODEL_P (current_cpu))
1876 m32r_model_profile_insn (current_cpu, abuf);
1884 /* Perform rach: rach. */
1886 SEM_FN_NAME (m32r,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1888 #define FLD(f) abuf->fields.fmt_rac.f
1889 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1890 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1894 tmp_tmp1 = ANDDI (m32r_h_accum_get (current_cpu), MAKEDI (16777215, 0xffffffff));
1895 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
1896 tmp_tmp1 = MAKEDI (16383, 0x80000000);
1898 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
1899 tmp_tmp1 = MAKEDI (16760832, 0);
1901 tmp_tmp1 = ANDDI (ADDDI (m32r_h_accum_get (current_cpu), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
1904 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
1905 m32r_h_accum_set (current_cpu, SRADI (SLLDI (tmp_tmp1, 7), 7));
1906 TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu));
1909 #if WITH_PROFILE_MODEL_P
1910 if (PROFILE_MODEL_P (current_cpu))
1912 m32r_model_profile_insn (current_cpu, abuf);
1920 /* Perform rte: rte. */
1922 SEM_FN_NAME (m32r,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1924 #define FLD(f) abuf->fields.fmt_rte.f
1925 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1926 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1930 CPU (h_sm) = CPU (h_bsm);
1931 TRACE_RESULT (current_cpu, "h-sm-0", 'x', CPU (h_sm));
1932 CPU (h_ie) = CPU (h_bie);
1933 TRACE_RESULT (current_cpu, "h-ie-0", 'x', CPU (h_ie));
1934 CPU (h_cond) = CPU (h_bcond);
1935 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1936 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, ANDSI (CPU (h_bpc), -4)));
1938 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
1941 #if WITH_PROFILE_MODEL_P
1942 if (PROFILE_MODEL_P (current_cpu))
1944 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
1952 /* Perform seth: seth $dr,$hash$hi16. */
1954 SEM_FN_NAME (m32r,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1956 #define FLD(f) abuf->fields.fmt_seth.f
1957 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1958 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1960 * FLD (f_r1) = SLLSI (FLD (f_hi16), 16);
1961 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1963 #if WITH_PROFILE_MODEL_P
1964 if (PROFILE_MODEL_P (current_cpu))
1966 m32r_model_mark_set_h_gr (current_cpu, abuf);
1967 m32r_model_profile_insn (current_cpu, abuf);
1975 /* Perform sll: sll $dr,$sr. */
1977 SEM_FN_NAME (m32r,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1979 #define FLD(f) abuf->fields.fmt_add.f
1980 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1981 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1983 * FLD (f_r1) = SLLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
1984 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
1986 #if WITH_PROFILE_MODEL_P
1987 if (PROFILE_MODEL_P (current_cpu))
1989 m32r_model_mark_get_h_gr (current_cpu, abuf);
1990 m32r_model_mark_set_h_gr (current_cpu, abuf);
1991 m32r_model_profile_insn (current_cpu, abuf);
1999 /* Perform sll3: sll3 $dr,$sr,$simm16. */
2001 SEM_FN_NAME (m32r,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2003 #define FLD(f) abuf->fields.fmt_sll3.f
2004 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2005 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2007 * FLD (f_r1) = SLLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
2008 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2010 #if WITH_PROFILE_MODEL_P
2011 if (PROFILE_MODEL_P (current_cpu))
2013 m32r_model_mark_get_h_gr (current_cpu, abuf);
2014 m32r_model_mark_set_h_gr (current_cpu, abuf);
2015 m32r_model_profile_insn (current_cpu, abuf);
2023 /* Perform slli: slli $dr,$uimm5. */
2025 SEM_FN_NAME (m32r,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2027 #define FLD(f) abuf->fields.fmt_slli.f
2028 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2029 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2031 * FLD (f_r1) = SLLSI (* FLD (f_r1), FLD (f_uimm5));
2032 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2034 #if WITH_PROFILE_MODEL_P
2035 if (PROFILE_MODEL_P (current_cpu))
2037 m32r_model_mark_get_h_gr (current_cpu, abuf);
2038 m32r_model_mark_set_h_gr (current_cpu, abuf);
2039 m32r_model_profile_insn (current_cpu, abuf);
2047 /* Perform sra: sra $dr,$sr. */
2049 SEM_FN_NAME (m32r,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2051 #define FLD(f) abuf->fields.fmt_add.f
2052 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2053 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2055 * FLD (f_r1) = SRASI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
2056 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2058 #if WITH_PROFILE_MODEL_P
2059 if (PROFILE_MODEL_P (current_cpu))
2061 m32r_model_mark_get_h_gr (current_cpu, abuf);
2062 m32r_model_mark_set_h_gr (current_cpu, abuf);
2063 m32r_model_profile_insn (current_cpu, abuf);
2071 /* Perform sra3: sra3 $dr,$sr,$simm16. */
2073 SEM_FN_NAME (m32r,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2075 #define FLD(f) abuf->fields.fmt_sll3.f
2076 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2077 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2079 * FLD (f_r1) = SRASI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
2080 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2082 #if WITH_PROFILE_MODEL_P
2083 if (PROFILE_MODEL_P (current_cpu))
2085 m32r_model_mark_get_h_gr (current_cpu, abuf);
2086 m32r_model_mark_set_h_gr (current_cpu, abuf);
2087 m32r_model_profile_insn (current_cpu, abuf);
2095 /* Perform srai: srai $dr,$uimm5. */
2097 SEM_FN_NAME (m32r,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2099 #define FLD(f) abuf->fields.fmt_slli.f
2100 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2101 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2103 * FLD (f_r1) = SRASI (* FLD (f_r1), FLD (f_uimm5));
2104 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2106 #if WITH_PROFILE_MODEL_P
2107 if (PROFILE_MODEL_P (current_cpu))
2109 m32r_model_mark_get_h_gr (current_cpu, abuf);
2110 m32r_model_mark_set_h_gr (current_cpu, abuf);
2111 m32r_model_profile_insn (current_cpu, abuf);
2119 /* Perform srl: srl $dr,$sr. */
2121 SEM_FN_NAME (m32r,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2123 #define FLD(f) abuf->fields.fmt_add.f
2124 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2125 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2127 * FLD (f_r1) = SRLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
2128 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2130 #if WITH_PROFILE_MODEL_P
2131 if (PROFILE_MODEL_P (current_cpu))
2133 m32r_model_mark_get_h_gr (current_cpu, abuf);
2134 m32r_model_mark_set_h_gr (current_cpu, abuf);
2135 m32r_model_profile_insn (current_cpu, abuf);
2143 /* Perform srl3: srl3 $dr,$sr,$simm16. */
2145 SEM_FN_NAME (m32r,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2147 #define FLD(f) abuf->fields.fmt_sll3.f
2148 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2149 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2151 * FLD (f_r1) = SRLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
2152 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2154 #if WITH_PROFILE_MODEL_P
2155 if (PROFILE_MODEL_P (current_cpu))
2157 m32r_model_mark_get_h_gr (current_cpu, abuf);
2158 m32r_model_mark_set_h_gr (current_cpu, abuf);
2159 m32r_model_profile_insn (current_cpu, abuf);
2167 /* Perform srli: srli $dr,$uimm5. */
2169 SEM_FN_NAME (m32r,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2171 #define FLD(f) abuf->fields.fmt_slli.f
2172 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2173 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2175 * FLD (f_r1) = SRLSI (* FLD (f_r1), FLD (f_uimm5));
2176 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2178 #if WITH_PROFILE_MODEL_P
2179 if (PROFILE_MODEL_P (current_cpu))
2181 m32r_model_mark_get_h_gr (current_cpu, abuf);
2182 m32r_model_mark_set_h_gr (current_cpu, abuf);
2183 m32r_model_profile_insn (current_cpu, abuf);
2191 /* Perform st: st $src1,@$src2. */
2193 SEM_FN_NAME (m32r,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2195 #define FLD(f) abuf->fields.fmt_st.f
2196 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2197 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2199 SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2200 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2)));
2202 #if WITH_PROFILE_MODEL_P
2203 if (PROFILE_MODEL_P (current_cpu))
2205 m32r_model_mark_get_h_gr (current_cpu, abuf);
2206 m32r_model_profile_insn (current_cpu, abuf);
2214 /* Perform st-d: st $src1,@($slo16,$src2). */
2216 SEM_FN_NAME (m32r,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2218 #define FLD(f) abuf->fields.fmt_st_d.f
2219 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2220 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2222 SETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1));
2223 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
2225 #if WITH_PROFILE_MODEL_P
2226 if (PROFILE_MODEL_P (current_cpu))
2228 m32r_model_mark_get_h_gr (current_cpu, abuf);
2229 m32r_model_profile_insn (current_cpu, abuf);
2237 /* Perform stb: stb $src1,@$src2. */
2239 SEM_FN_NAME (m32r,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2241 #define FLD(f) abuf->fields.fmt_stb.f
2242 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2243 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2245 SETMEMQI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2246 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMQI (current_cpu, * FLD (f_r2)));
2248 #if WITH_PROFILE_MODEL_P
2249 if (PROFILE_MODEL_P (current_cpu))
2251 m32r_model_mark_get_h_gr (current_cpu, abuf);
2252 m32r_model_profile_insn (current_cpu, abuf);
2260 /* Perform stb-d: stb $src1,@($slo16,$src2). */
2262 SEM_FN_NAME (m32r,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2264 #define FLD(f) abuf->fields.fmt_stb_d.f
2265 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2266 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2268 SETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1));
2269 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
2271 #if WITH_PROFILE_MODEL_P
2272 if (PROFILE_MODEL_P (current_cpu))
2274 m32r_model_mark_get_h_gr (current_cpu, abuf);
2275 m32r_model_profile_insn (current_cpu, abuf);
2283 /* Perform sth: sth $src1,@$src2. */
2285 SEM_FN_NAME (m32r,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2287 #define FLD(f) abuf->fields.fmt_sth.f
2288 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2289 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2291 SETMEMHI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2292 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMHI (current_cpu, * FLD (f_r2)));
2294 #if WITH_PROFILE_MODEL_P
2295 if (PROFILE_MODEL_P (current_cpu))
2297 m32r_model_mark_get_h_gr (current_cpu, abuf);
2298 m32r_model_profile_insn (current_cpu, abuf);
2306 /* Perform sth-d: sth $src1,@($slo16,$src2). */
2308 SEM_FN_NAME (m32r,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2310 #define FLD(f) abuf->fields.fmt_sth_d.f
2311 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2312 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2314 SETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1));
2315 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
2317 #if WITH_PROFILE_MODEL_P
2318 if (PROFILE_MODEL_P (current_cpu))
2320 m32r_model_mark_get_h_gr (current_cpu, abuf);
2321 m32r_model_profile_insn (current_cpu, abuf);
2329 /* Perform st-plus: st $src1,@+$src2. */
2331 SEM_FN_NAME (m32r,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2333 #define FLD(f) abuf->fields.fmt_st_plus.f
2334 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2335 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2339 tmp_new_src2 = ADDSI (* FLD (f_r2), 4);
2340 SETMEMSI (current_cpu, tmp_new_src2, * FLD (f_r1));
2341 TRACE_RESULT (current_cpu, "h-memory-new-src2", 'x', GETMEMSI (current_cpu, tmp_new_src2));
2342 * FLD (f_r2) = tmp_new_src2;
2343 TRACE_RESULT (current_cpu, "src2", 'x', * FLD (f_r2));
2346 #if WITH_PROFILE_MODEL_P
2347 if (PROFILE_MODEL_P (current_cpu))
2349 m32r_model_mark_get_h_gr (current_cpu, abuf);
2350 m32r_model_mark_set_h_gr (current_cpu, abuf);
2351 m32r_model_profile_insn (current_cpu, abuf);
2359 /* Perform st-minus: st $src1,@-$src2. */
2361 SEM_FN_NAME (m32r,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2363 #define FLD(f) abuf->fields.fmt_st_plus.f
2364 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2365 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2369 tmp_new_src2 = SUBSI (* FLD (f_r2), 4);
2370 SETMEMSI (current_cpu, tmp_new_src2, * FLD (f_r1));
2371 TRACE_RESULT (current_cpu, "h-memory-new-src2", 'x', GETMEMSI (current_cpu, tmp_new_src2));
2372 * FLD (f_r2) = tmp_new_src2;
2373 TRACE_RESULT (current_cpu, "src2", 'x', * FLD (f_r2));
2376 #if WITH_PROFILE_MODEL_P
2377 if (PROFILE_MODEL_P (current_cpu))
2379 m32r_model_mark_get_h_gr (current_cpu, abuf);
2380 m32r_model_mark_set_h_gr (current_cpu, abuf);
2381 m32r_model_profile_insn (current_cpu, abuf);
2389 /* Perform sub: sub $dr,$sr. */
2391 SEM_FN_NAME (m32r,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2393 #define FLD(f) abuf->fields.fmt_add.f
2394 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2395 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2397 * FLD (f_r1) = SUBSI (* FLD (f_r1), * FLD (f_r2));
2398 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2400 #if WITH_PROFILE_MODEL_P
2401 if (PROFILE_MODEL_P (current_cpu))
2403 m32r_model_mark_get_h_gr (current_cpu, abuf);
2404 m32r_model_mark_set_h_gr (current_cpu, abuf);
2405 m32r_model_profile_insn (current_cpu, abuf);
2413 /* Perform subv: subv $dr,$sr. */
2415 SEM_FN_NAME (m32r,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2417 #define FLD(f) abuf->fields.fmt_addv.f
2418 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2419 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2423 temp0 = SUBSI (* FLD (f_r1), * FLD (f_r2));
2424 temp1 = SUBOFSI (* FLD (f_r1), * FLD (f_r2), 0);
2425 * FLD (f_r1) = temp0;
2426 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2427 CPU (h_cond) = temp1;
2428 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2431 #if WITH_PROFILE_MODEL_P
2432 if (PROFILE_MODEL_P (current_cpu))
2434 m32r_model_mark_get_h_gr (current_cpu, abuf);
2435 m32r_model_mark_set_h_gr (current_cpu, abuf);
2436 m32r_model_profile_insn (current_cpu, abuf);
2444 /* Perform subx: subx $dr,$sr. */
2446 SEM_FN_NAME (m32r,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2448 #define FLD(f) abuf->fields.fmt_addx.f
2449 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2450 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2454 temp0 = SUBCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
2455 temp1 = SUBCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
2456 * FLD (f_r1) = temp0;
2457 TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1));
2458 CPU (h_cond) = temp1;
2459 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2462 #if WITH_PROFILE_MODEL_P
2463 if (PROFILE_MODEL_P (current_cpu))
2465 m32r_model_mark_get_h_gr (current_cpu, abuf);
2466 m32r_model_mark_set_h_gr (current_cpu, abuf);
2467 m32r_model_profile_insn (current_cpu, abuf);
2475 /* Perform trap: trap $uimm4. */
2477 SEM_FN_NAME (m32r,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2479 #define FLD(f) abuf->fields.fmt_trap.f
2480 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2481 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2485 m32r_h_cr_set (current_cpu, 6, ADDSI (CPU (h_pc), 4));
2486 TRACE_RESULT (current_cpu, "h-cr-6", 'x', m32r_h_cr_get (current_cpu, 6));
2487 m32r_h_cr_set (current_cpu, 0, ANDSI (SLLSI (m32r_h_cr_get (current_cpu, 0), 8), 65408));
2488 TRACE_RESULT (current_cpu, "h-cr-0", 'x', m32r_h_cr_get (current_cpu, 0));
2489 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, do_trap (current_cpu, FLD (f_uimm4))));
2491 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
2494 #if WITH_PROFILE_MODEL_P
2495 if (PROFILE_MODEL_P (current_cpu))
2497 m32r_model_profile_cti_insn (current_cpu, abuf, taken_p);
2505 /* Perform unlock: unlock $src1,@$src2. */
2507 SEM_FN_NAME (m32r,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2509 #define FLD(f) abuf->fields.fmt_unlock.f
2510 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2511 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2515 SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1));
2516 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2)));
2519 TRACE_RESULT (current_cpu, "h-lock-0", 'x', CPU (h_lock));
2522 #if WITH_PROFILE_MODEL_P
2523 if (PROFILE_MODEL_P (current_cpu))
2525 m32r_model_mark_get_h_gr (current_cpu, abuf);
2526 m32r_model_profile_insn (current_cpu, abuf);
2535 SEM_FN_NAME (m32r,illegal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2537 sim_engine_illegal_insn (current_cpu, NULL_CIA /*FIXME*/);
2541 #endif /* ! defined (SCACHE_P) || (defined (SCACHE_P) && WITH_SCACHE) */