1 /* Simulator instruction semantics for m32rx.
3 This file is machine generated with CGEN.
5 Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
7 This file is part of the GNU Simulators.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #define WANT_CPU_M32RX
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 (m32rx,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
42 insn_t insn = SEM_INSN (sem_arg);
43 #define OPRND(f) par_exec->operands.fmt_0_add.f
44 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
45 CIA new_pc = CPU (h_pc) + 2;
46 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
47 EXTRACT_FMT_0_ADD_CODE
49 CPU (h_gr[f_r1]) = ADDSI (OPRND (dr), OPRND (sr));
50 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
52 #if WITH_PROFILE_MODEL_P
53 if (PROFILE_MODEL_P (current_cpu))
55 m32rx_model_mark_get_h_gr (current_cpu, abuf);
56 m32rx_model_mark_set_h_gr (current_cpu, abuf);
57 m32rx_model_profile_insn (current_cpu, abuf);
65 /* Perform add3: add3 $dr,$sr,#$slo16. */
67 SEM_FN_NAME (m32rx,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
69 insn_t insn = SEM_INSN (sem_arg);
70 #define OPRND(f) par_exec->operands.fmt_1_add3.f
71 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
72 CIA new_pc = CPU (h_pc) + 4;
73 EXTRACT_FMT_1_ADD3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
74 EXTRACT_FMT_1_ADD3_CODE
76 CPU (h_gr[f_r1]) = ADDSI (OPRND (sr), OPRND (slo16));
77 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
79 #if WITH_PROFILE_MODEL_P
80 if (PROFILE_MODEL_P (current_cpu))
82 m32rx_model_mark_get_h_gr (current_cpu, abuf);
83 m32rx_model_mark_set_h_gr (current_cpu, abuf);
84 m32rx_model_profile_insn (current_cpu, abuf);
92 /* Perform and: and $dr,$sr. */
94 SEM_FN_NAME (m32rx,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
96 insn_t insn = SEM_INSN (sem_arg);
97 #define OPRND(f) par_exec->operands.fmt_0_add.f
98 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99 CIA new_pc = CPU (h_pc) + 2;
100 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
101 EXTRACT_FMT_0_ADD_CODE
103 CPU (h_gr[f_r1]) = ANDSI (OPRND (dr), OPRND (sr));
104 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
106 #if WITH_PROFILE_MODEL_P
107 if (PROFILE_MODEL_P (current_cpu))
109 m32rx_model_mark_get_h_gr (current_cpu, abuf);
110 m32rx_model_mark_set_h_gr (current_cpu, abuf);
111 m32rx_model_profile_insn (current_cpu, abuf);
119 /* Perform and3: and3 $dr,$sr,#$uimm16. */
121 SEM_FN_NAME (m32rx,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
123 insn_t insn = SEM_INSN (sem_arg);
124 #define OPRND(f) par_exec->operands.fmt_2_and3.f
125 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
126 CIA new_pc = CPU (h_pc) + 4;
127 EXTRACT_FMT_2_AND3_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
128 EXTRACT_FMT_2_AND3_CODE
130 CPU (h_gr[f_r1]) = ANDSI (OPRND (sr), OPRND (uimm16));
131 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
133 #if WITH_PROFILE_MODEL_P
134 if (PROFILE_MODEL_P (current_cpu))
136 m32rx_model_mark_get_h_gr (current_cpu, abuf);
137 m32rx_model_mark_set_h_gr (current_cpu, abuf);
138 m32rx_model_profile_insn (current_cpu, abuf);
146 /* Perform or: or $dr,$sr. */
148 SEM_FN_NAME (m32rx,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
150 insn_t insn = SEM_INSN (sem_arg);
151 #define OPRND(f) par_exec->operands.fmt_0_add.f
152 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
153 CIA new_pc = CPU (h_pc) + 2;
154 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
155 EXTRACT_FMT_0_ADD_CODE
157 CPU (h_gr[f_r1]) = ORSI (OPRND (dr), OPRND (sr));
158 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
160 #if WITH_PROFILE_MODEL_P
161 if (PROFILE_MODEL_P (current_cpu))
163 m32rx_model_mark_get_h_gr (current_cpu, abuf);
164 m32rx_model_mark_set_h_gr (current_cpu, abuf);
165 m32rx_model_profile_insn (current_cpu, abuf);
173 /* Perform or3: or3 $dr,$sr,#$ulo16. */
175 SEM_FN_NAME (m32rx,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
177 insn_t insn = SEM_INSN (sem_arg);
178 #define OPRND(f) par_exec->operands.fmt_3_or3.f
179 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
180 CIA new_pc = CPU (h_pc) + 4;
181 EXTRACT_FMT_3_OR3_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
182 EXTRACT_FMT_3_OR3_CODE
184 CPU (h_gr[f_r1]) = ORSI (OPRND (sr), OPRND (ulo16));
185 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
187 #if WITH_PROFILE_MODEL_P
188 if (PROFILE_MODEL_P (current_cpu))
190 m32rx_model_mark_get_h_gr (current_cpu, abuf);
191 m32rx_model_mark_set_h_gr (current_cpu, abuf);
192 m32rx_model_profile_insn (current_cpu, abuf);
200 /* Perform xor: xor $dr,$sr. */
202 SEM_FN_NAME (m32rx,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
204 insn_t insn = SEM_INSN (sem_arg);
205 #define OPRND(f) par_exec->operands.fmt_0_add.f
206 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
207 CIA new_pc = CPU (h_pc) + 2;
208 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
209 EXTRACT_FMT_0_ADD_CODE
211 CPU (h_gr[f_r1]) = XORSI (OPRND (dr), OPRND (sr));
212 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
214 #if WITH_PROFILE_MODEL_P
215 if (PROFILE_MODEL_P (current_cpu))
217 m32rx_model_mark_get_h_gr (current_cpu, abuf);
218 m32rx_model_mark_set_h_gr (current_cpu, abuf);
219 m32rx_model_profile_insn (current_cpu, abuf);
227 /* Perform xor3: xor3 $dr,$sr,#$uimm16. */
229 SEM_FN_NAME (m32rx,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
231 insn_t insn = SEM_INSN (sem_arg);
232 #define OPRND(f) par_exec->operands.fmt_2_and3.f
233 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
234 CIA new_pc = CPU (h_pc) + 4;
235 EXTRACT_FMT_2_AND3_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
236 EXTRACT_FMT_2_AND3_CODE
238 CPU (h_gr[f_r1]) = XORSI (OPRND (sr), OPRND (uimm16));
239 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
241 #if WITH_PROFILE_MODEL_P
242 if (PROFILE_MODEL_P (current_cpu))
244 m32rx_model_mark_get_h_gr (current_cpu, abuf);
245 m32rx_model_mark_set_h_gr (current_cpu, abuf);
246 m32rx_model_profile_insn (current_cpu, abuf);
254 /* Perform addi: addi $dr,#$simm8. */
256 SEM_FN_NAME (m32rx,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
258 insn_t insn = SEM_INSN (sem_arg);
259 #define OPRND(f) par_exec->operands.fmt_4_addi.f
260 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
261 CIA new_pc = CPU (h_pc) + 2;
262 EXTRACT_FMT_4_ADDI_VARS /* f-op1 f-r1 f-simm8 */
263 EXTRACT_FMT_4_ADDI_CODE
265 CPU (h_gr[f_r1]) = ADDSI (OPRND (dr), OPRND (simm8));
266 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
268 #if WITH_PROFILE_MODEL_P
269 if (PROFILE_MODEL_P (current_cpu))
271 m32rx_model_mark_get_h_gr (current_cpu, abuf);
272 m32rx_model_mark_set_h_gr (current_cpu, abuf);
273 m32rx_model_profile_insn (current_cpu, abuf);
281 /* Perform addv: addv $dr,$sr. */
283 SEM_FN_NAME (m32rx,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
285 insn_t insn = SEM_INSN (sem_arg);
286 #define OPRND(f) par_exec->operands.fmt_0_add.f
287 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
288 CIA new_pc = CPU (h_pc) + 2;
289 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
290 EXTRACT_FMT_0_ADD_CODE
294 temp0 = ADDSI (OPRND (dr), OPRND (sr));
295 temp1 = ADDOFSI (OPRND (dr), OPRND (sr), 0);
296 CPU (h_gr[f_r1]) = temp0;
297 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
298 CPU (h_cond) = temp1;
299 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
302 #if WITH_PROFILE_MODEL_P
303 if (PROFILE_MODEL_P (current_cpu))
305 m32rx_model_mark_get_h_gr (current_cpu, abuf);
306 m32rx_model_mark_set_h_gr (current_cpu, abuf);
307 m32rx_model_profile_insn (current_cpu, abuf);
315 /* Perform addv3: addv3 $dr,$sr,#$simm16. */
317 SEM_FN_NAME (m32rx,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
319 insn_t insn = SEM_INSN (sem_arg);
320 #define OPRND(f) par_exec->operands.fmt_5_addv3.f
321 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
322 CIA new_pc = CPU (h_pc) + 4;
323 EXTRACT_FMT_5_ADDV3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
324 EXTRACT_FMT_5_ADDV3_CODE
328 temp0 = ADDSI (OPRND (sr), OPRND (simm16));
329 temp1 = ADDOFSI (OPRND (sr), OPRND (simm16), 0);
330 CPU (h_gr[f_r1]) = temp0;
331 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
332 CPU (h_cond) = temp1;
333 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
336 #if WITH_PROFILE_MODEL_P
337 if (PROFILE_MODEL_P (current_cpu))
339 m32rx_model_mark_get_h_gr (current_cpu, abuf);
340 m32rx_model_mark_set_h_gr (current_cpu, abuf);
341 m32rx_model_profile_insn (current_cpu, abuf);
349 /* Perform addx: addx $dr,$sr. */
351 SEM_FN_NAME (m32rx,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
353 insn_t insn = SEM_INSN (sem_arg);
354 #define OPRND(f) par_exec->operands.fmt_6_addx.f
355 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
356 CIA new_pc = CPU (h_pc) + 2;
357 EXTRACT_FMT_6_ADDX_VARS /* f-op1 f-r1 f-op2 f-r2 */
358 EXTRACT_FMT_6_ADDX_CODE
362 temp0 = ADDCSI (OPRND (dr), OPRND (sr), OPRND (condbit));
363 temp1 = ADDCFSI (OPRND (dr), OPRND (sr), OPRND (condbit));
364 CPU (h_gr[f_r1]) = temp0;
365 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
366 CPU (h_cond) = temp1;
367 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
370 #if WITH_PROFILE_MODEL_P
371 if (PROFILE_MODEL_P (current_cpu))
373 m32rx_model_mark_get_h_gr (current_cpu, abuf);
374 m32rx_model_mark_set_h_gr (current_cpu, abuf);
375 m32rx_model_profile_insn (current_cpu, abuf);
383 /* Perform bc8: bc $disp8. */
385 SEM_FN_NAME (m32rx,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
387 insn_t insn = SEM_INSN (sem_arg);
388 #define OPRND(f) par_exec->operands.fmt_7_bc8.f
389 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
390 CIA new_pc = CPU (h_pc) + 2;
392 EXTRACT_FMT_7_BC8_VARS /* f-op1 f-r1 f-disp8 */
393 EXTRACT_FMT_7_BC8_CODE
395 if (OPRND (condbit)) {
396 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
399 #if WITH_PROFILE_MODEL_P
400 if (PROFILE_MODEL_P (current_cpu))
402 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
410 /* Perform bc24: bc $disp24. */
412 SEM_FN_NAME (m32rx,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
414 insn_t insn = SEM_INSN (sem_arg);
415 #define OPRND(f) par_exec->operands.fmt_8_bc24.f
416 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
417 CIA new_pc = CPU (h_pc) + 4;
419 EXTRACT_FMT_8_BC24_VARS /* f-op1 f-r1 f-disp24 */
420 EXTRACT_FMT_8_BC24_CODE
422 if (OPRND (condbit)) {
423 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
426 #if WITH_PROFILE_MODEL_P
427 if (PROFILE_MODEL_P (current_cpu))
429 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
437 /* Perform beq: beq $src1,$src2,$disp16. */
439 SEM_FN_NAME (m32rx,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
441 insn_t insn = SEM_INSN (sem_arg);
442 #define OPRND(f) par_exec->operands.fmt_9_beq.f
443 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
444 CIA new_pc = CPU (h_pc) + 4;
446 EXTRACT_FMT_9_BEQ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
447 EXTRACT_FMT_9_BEQ_CODE
449 if (EQSI (OPRND (src1), OPRND (src2))) {
450 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
453 #if WITH_PROFILE_MODEL_P
454 if (PROFILE_MODEL_P (current_cpu))
456 m32rx_model_mark_get_h_gr (current_cpu, abuf);
457 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
465 /* Perform beqz: beqz $src2,$disp16. */
467 SEM_FN_NAME (m32rx,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
469 insn_t insn = SEM_INSN (sem_arg);
470 #define OPRND(f) par_exec->operands.fmt_10_beqz.f
471 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
472 CIA new_pc = CPU (h_pc) + 4;
474 EXTRACT_FMT_10_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
475 EXTRACT_FMT_10_BEQZ_CODE
477 if (EQSI (OPRND (src2), 0)) {
478 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
481 #if WITH_PROFILE_MODEL_P
482 if (PROFILE_MODEL_P (current_cpu))
484 m32rx_model_mark_get_h_gr (current_cpu, abuf);
485 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
493 /* Perform bgez: bgez $src2,$disp16. */
495 SEM_FN_NAME (m32rx,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
497 insn_t insn = SEM_INSN (sem_arg);
498 #define OPRND(f) par_exec->operands.fmt_10_beqz.f
499 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
500 CIA new_pc = CPU (h_pc) + 4;
502 EXTRACT_FMT_10_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
503 EXTRACT_FMT_10_BEQZ_CODE
505 if (GESI (OPRND (src2), 0)) {
506 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
509 #if WITH_PROFILE_MODEL_P
510 if (PROFILE_MODEL_P (current_cpu))
512 m32rx_model_mark_get_h_gr (current_cpu, abuf);
513 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
521 /* Perform bgtz: bgtz $src2,$disp16. */
523 SEM_FN_NAME (m32rx,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
525 insn_t insn = SEM_INSN (sem_arg);
526 #define OPRND(f) par_exec->operands.fmt_10_beqz.f
527 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
528 CIA new_pc = CPU (h_pc) + 4;
530 EXTRACT_FMT_10_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
531 EXTRACT_FMT_10_BEQZ_CODE
533 if (GTSI (OPRND (src2), 0)) {
534 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
537 #if WITH_PROFILE_MODEL_P
538 if (PROFILE_MODEL_P (current_cpu))
540 m32rx_model_mark_get_h_gr (current_cpu, abuf);
541 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
549 /* Perform blez: blez $src2,$disp16. */
551 SEM_FN_NAME (m32rx,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
553 insn_t insn = SEM_INSN (sem_arg);
554 #define OPRND(f) par_exec->operands.fmt_10_beqz.f
555 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
556 CIA new_pc = CPU (h_pc) + 4;
558 EXTRACT_FMT_10_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
559 EXTRACT_FMT_10_BEQZ_CODE
561 if (LESI (OPRND (src2), 0)) {
562 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
565 #if WITH_PROFILE_MODEL_P
566 if (PROFILE_MODEL_P (current_cpu))
568 m32rx_model_mark_get_h_gr (current_cpu, abuf);
569 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
577 /* Perform bltz: bltz $src2,$disp16. */
579 SEM_FN_NAME (m32rx,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
581 insn_t insn = SEM_INSN (sem_arg);
582 #define OPRND(f) par_exec->operands.fmt_10_beqz.f
583 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
584 CIA new_pc = CPU (h_pc) + 4;
586 EXTRACT_FMT_10_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
587 EXTRACT_FMT_10_BEQZ_CODE
589 if (LTSI (OPRND (src2), 0)) {
590 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
593 #if WITH_PROFILE_MODEL_P
594 if (PROFILE_MODEL_P (current_cpu))
596 m32rx_model_mark_get_h_gr (current_cpu, abuf);
597 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
605 /* Perform bnez: bnez $src2,$disp16. */
607 SEM_FN_NAME (m32rx,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
609 insn_t insn = SEM_INSN (sem_arg);
610 #define OPRND(f) par_exec->operands.fmt_10_beqz.f
611 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
612 CIA new_pc = CPU (h_pc) + 4;
614 EXTRACT_FMT_10_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
615 EXTRACT_FMT_10_BEQZ_CODE
617 if (NESI (OPRND (src2), 0)) {
618 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
621 #if WITH_PROFILE_MODEL_P
622 if (PROFILE_MODEL_P (current_cpu))
624 m32rx_model_mark_get_h_gr (current_cpu, abuf);
625 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
633 /* Perform bl8: bl $disp8. */
635 SEM_FN_NAME (m32rx,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
637 insn_t insn = SEM_INSN (sem_arg);
638 #define OPRND(f) par_exec->operands.fmt_11_bl8.f
639 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
640 CIA new_pc = CPU (h_pc) + 2;
642 EXTRACT_FMT_11_BL8_VARS /* f-op1 f-r1 f-disp8 */
643 EXTRACT_FMT_11_BL8_CODE
646 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
647 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
648 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
651 #if WITH_PROFILE_MODEL_P
652 if (PROFILE_MODEL_P (current_cpu))
654 m32rx_model_mark_set_h_gr (current_cpu, abuf);
655 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
663 /* Perform bl24: bl $disp24. */
665 SEM_FN_NAME (m32rx,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
667 insn_t insn = SEM_INSN (sem_arg);
668 #define OPRND(f) par_exec->operands.fmt_12_bl24.f
669 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
670 CIA new_pc = CPU (h_pc) + 4;
672 EXTRACT_FMT_12_BL24_VARS /* f-op1 f-r1 f-disp24 */
673 EXTRACT_FMT_12_BL24_CODE
676 CPU (h_gr[14]) = ADDSI (OPRND (pc), 4);
677 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
678 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
681 #if WITH_PROFILE_MODEL_P
682 if (PROFILE_MODEL_P (current_cpu))
684 m32rx_model_mark_set_h_gr (current_cpu, abuf);
685 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
693 /* Perform bcl8: bcl $disp8. */
695 SEM_FN_NAME (m32rx,bcl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
697 insn_t insn = SEM_INSN (sem_arg);
698 #define OPRND(f) par_exec->operands.fmt_13_bcl8.f
699 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
700 CIA new_pc = CPU (h_pc) + 2;
702 EXTRACT_FMT_13_BCL8_VARS /* f-op1 f-r1 f-disp8 */
703 EXTRACT_FMT_13_BCL8_CODE
705 if (OPRND (condbit)) {
707 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
708 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
709 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
713 #if WITH_PROFILE_MODEL_P
714 if (PROFILE_MODEL_P (current_cpu))
716 m32rx_model_mark_set_h_gr (current_cpu, abuf);
717 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
725 /* Perform bcl24: bcl $disp24. */
727 SEM_FN_NAME (m32rx,bcl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
729 insn_t insn = SEM_INSN (sem_arg);
730 #define OPRND(f) par_exec->operands.fmt_14_bcl24.f
731 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
732 CIA new_pc = CPU (h_pc) + 4;
734 EXTRACT_FMT_14_BCL24_VARS /* f-op1 f-r1 f-disp24 */
735 EXTRACT_FMT_14_BCL24_CODE
737 if (OPRND (condbit)) {
739 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
740 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
741 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
745 #if WITH_PROFILE_MODEL_P
746 if (PROFILE_MODEL_P (current_cpu))
748 m32rx_model_mark_set_h_gr (current_cpu, abuf);
749 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
757 /* Perform bnc8: bnc $disp8. */
759 SEM_FN_NAME (m32rx,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
761 insn_t insn = SEM_INSN (sem_arg);
762 #define OPRND(f) par_exec->operands.fmt_7_bc8.f
763 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
764 CIA new_pc = CPU (h_pc) + 2;
766 EXTRACT_FMT_7_BC8_VARS /* f-op1 f-r1 f-disp8 */
767 EXTRACT_FMT_7_BC8_CODE
769 if (NOTBI (OPRND (condbit))) {
770 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
773 #if WITH_PROFILE_MODEL_P
774 if (PROFILE_MODEL_P (current_cpu))
776 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
784 /* Perform bnc24: bnc $disp24. */
786 SEM_FN_NAME (m32rx,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
788 insn_t insn = SEM_INSN (sem_arg);
789 #define OPRND(f) par_exec->operands.fmt_8_bc24.f
790 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
791 CIA new_pc = CPU (h_pc) + 4;
793 EXTRACT_FMT_8_BC24_VARS /* f-op1 f-r1 f-disp24 */
794 EXTRACT_FMT_8_BC24_CODE
796 if (NOTBI (OPRND (condbit))) {
797 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
800 #if WITH_PROFILE_MODEL_P
801 if (PROFILE_MODEL_P (current_cpu))
803 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
811 /* Perform bne: bne $src1,$src2,$disp16. */
813 SEM_FN_NAME (m32rx,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
815 insn_t insn = SEM_INSN (sem_arg);
816 #define OPRND(f) par_exec->operands.fmt_9_beq.f
817 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
818 CIA new_pc = CPU (h_pc) + 4;
820 EXTRACT_FMT_9_BEQ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
821 EXTRACT_FMT_9_BEQ_CODE
823 if (NESI (OPRND (src1), OPRND (src2))) {
824 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
827 #if WITH_PROFILE_MODEL_P
828 if (PROFILE_MODEL_P (current_cpu))
830 m32rx_model_mark_get_h_gr (current_cpu, abuf);
831 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
839 /* Perform bra8: bra $disp8. */
841 SEM_FN_NAME (m32rx,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
843 insn_t insn = SEM_INSN (sem_arg);
844 #define OPRND(f) par_exec->operands.fmt_15_bra8.f
845 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
846 CIA new_pc = CPU (h_pc) + 2;
848 EXTRACT_FMT_15_BRA8_VARS /* f-op1 f-r1 f-disp8 */
849 EXTRACT_FMT_15_BRA8_CODE
851 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
853 #if WITH_PROFILE_MODEL_P
854 if (PROFILE_MODEL_P (current_cpu))
856 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
864 /* Perform bra24: bra $disp24. */
866 SEM_FN_NAME (m32rx,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
868 insn_t insn = SEM_INSN (sem_arg);
869 #define OPRND(f) par_exec->operands.fmt_16_bra24.f
870 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
871 CIA new_pc = CPU (h_pc) + 4;
873 EXTRACT_FMT_16_BRA24_VARS /* f-op1 f-r1 f-disp24 */
874 EXTRACT_FMT_16_BRA24_CODE
876 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
878 #if WITH_PROFILE_MODEL_P
879 if (PROFILE_MODEL_P (current_cpu))
881 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
889 /* Perform bncl8: bncl $disp8. */
891 SEM_FN_NAME (m32rx,bncl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
893 insn_t insn = SEM_INSN (sem_arg);
894 #define OPRND(f) par_exec->operands.fmt_13_bcl8.f
895 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
896 CIA new_pc = CPU (h_pc) + 2;
898 EXTRACT_FMT_13_BCL8_VARS /* f-op1 f-r1 f-disp8 */
899 EXTRACT_FMT_13_BCL8_CODE
901 if (NOTBI (OPRND (condbit))) {
903 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
904 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
905 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
909 #if WITH_PROFILE_MODEL_P
910 if (PROFILE_MODEL_P (current_cpu))
912 m32rx_model_mark_set_h_gr (current_cpu, abuf);
913 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
921 /* Perform bncl24: bncl $disp24. */
923 SEM_FN_NAME (m32rx,bncl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
925 insn_t insn = SEM_INSN (sem_arg);
926 #define OPRND(f) par_exec->operands.fmt_14_bcl24.f
927 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
928 CIA new_pc = CPU (h_pc) + 4;
930 EXTRACT_FMT_14_BCL24_VARS /* f-op1 f-r1 f-disp24 */
931 EXTRACT_FMT_14_BCL24_CODE
933 if (NOTBI (OPRND (condbit))) {
935 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
936 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
937 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
941 #if WITH_PROFILE_MODEL_P
942 if (PROFILE_MODEL_P (current_cpu))
944 m32rx_model_mark_set_h_gr (current_cpu, abuf);
945 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
953 /* Perform cmp: cmp $src1,$src2. */
955 SEM_FN_NAME (m32rx,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
957 insn_t insn = SEM_INSN (sem_arg);
958 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
959 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
960 CIA new_pc = CPU (h_pc) + 2;
961 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
962 EXTRACT_FMT_17_CMP_CODE
964 CPU (h_cond) = LTSI (OPRND (src1), OPRND (src2));
965 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
967 #if WITH_PROFILE_MODEL_P
968 if (PROFILE_MODEL_P (current_cpu))
970 m32rx_model_mark_get_h_gr (current_cpu, abuf);
971 m32rx_model_profile_insn (current_cpu, abuf);
979 /* Perform cmpi: cmpi $src2,#$simm16. */
981 SEM_FN_NAME (m32rx,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
983 insn_t insn = SEM_INSN (sem_arg);
984 #define OPRND(f) par_exec->operands.fmt_18_cmpi.f
985 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
986 CIA new_pc = CPU (h_pc) + 4;
987 EXTRACT_FMT_18_CMPI_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
988 EXTRACT_FMT_18_CMPI_CODE
990 CPU (h_cond) = LTSI (OPRND (src2), OPRND (simm16));
991 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
993 #if WITH_PROFILE_MODEL_P
994 if (PROFILE_MODEL_P (current_cpu))
996 m32rx_model_mark_get_h_gr (current_cpu, abuf);
997 m32rx_model_profile_insn (current_cpu, abuf);
1005 /* Perform cmpu: cmpu $src1,$src2. */
1007 SEM_FN_NAME (m32rx,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1009 insn_t insn = SEM_INSN (sem_arg);
1010 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
1011 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1012 CIA new_pc = CPU (h_pc) + 2;
1013 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
1014 EXTRACT_FMT_17_CMP_CODE
1016 CPU (h_cond) = LTUSI (OPRND (src1), OPRND (src2));
1017 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1019 #if WITH_PROFILE_MODEL_P
1020 if (PROFILE_MODEL_P (current_cpu))
1022 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1023 m32rx_model_profile_insn (current_cpu, abuf);
1031 /* Perform cmpui: cmpui $src2,#$uimm16. */
1033 SEM_FN_NAME (m32rx,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1035 insn_t insn = SEM_INSN (sem_arg);
1036 #define OPRND(f) par_exec->operands.fmt_19_cmpui.f
1037 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1038 CIA new_pc = CPU (h_pc) + 4;
1039 EXTRACT_FMT_19_CMPUI_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
1040 EXTRACT_FMT_19_CMPUI_CODE
1042 CPU (h_cond) = LTUSI (OPRND (src2), OPRND (uimm16));
1043 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1045 #if WITH_PROFILE_MODEL_P
1046 if (PROFILE_MODEL_P (current_cpu))
1048 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1049 m32rx_model_profile_insn (current_cpu, abuf);
1057 /* Perform cmpeq: cmpeq $src1,$src2. */
1059 SEM_FN_NAME (m32rx,cmpeq) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1061 insn_t insn = SEM_INSN (sem_arg);
1062 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
1063 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1064 CIA new_pc = CPU (h_pc) + 2;
1065 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
1066 EXTRACT_FMT_17_CMP_CODE
1068 CPU (h_cond) = EQSI (OPRND (src1), OPRND (src2));
1069 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1071 #if WITH_PROFILE_MODEL_P
1072 if (PROFILE_MODEL_P (current_cpu))
1074 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1075 m32rx_model_profile_insn (current_cpu, abuf);
1083 /* Perform cmpz: cmpz $src2. */
1085 SEM_FN_NAME (m32rx,cmpz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1087 insn_t insn = SEM_INSN (sem_arg);
1088 #define OPRND(f) par_exec->operands.fmt_20_cmpz.f
1089 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1090 CIA new_pc = CPU (h_pc) + 2;
1091 EXTRACT_FMT_20_CMPZ_VARS /* f-op1 f-r1 f-op2 f-r2 */
1092 EXTRACT_FMT_20_CMPZ_CODE
1094 CPU (h_cond) = EQSI (OPRND (src2), 0);
1095 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1097 #if WITH_PROFILE_MODEL_P
1098 if (PROFILE_MODEL_P (current_cpu))
1100 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1101 m32rx_model_profile_insn (current_cpu, abuf);
1109 /* Perform div: div $dr,$sr. */
1111 SEM_FN_NAME (m32rx,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1113 insn_t insn = SEM_INSN (sem_arg);
1114 #define OPRND(f) par_exec->operands.fmt_21_div.f
1115 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1116 CIA new_pc = CPU (h_pc) + 4;
1117 EXTRACT_FMT_21_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1118 EXTRACT_FMT_21_DIV_CODE
1120 if (NESI (OPRND (sr), 0)) {
1121 CPU (h_gr[f_r1]) = DIVSI (OPRND (dr), OPRND (sr));
1122 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1125 #if WITH_PROFILE_MODEL_P
1126 if (PROFILE_MODEL_P (current_cpu))
1128 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1129 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1130 m32rx_model_profile_insn (current_cpu, abuf);
1138 /* Perform divu: divu $dr,$sr. */
1140 SEM_FN_NAME (m32rx,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1142 insn_t insn = SEM_INSN (sem_arg);
1143 #define OPRND(f) par_exec->operands.fmt_21_div.f
1144 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1145 CIA new_pc = CPU (h_pc) + 4;
1146 EXTRACT_FMT_21_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1147 EXTRACT_FMT_21_DIV_CODE
1149 if (NESI (OPRND (sr), 0)) {
1150 CPU (h_gr[f_r1]) = UDIVSI (OPRND (dr), OPRND (sr));
1151 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1154 #if WITH_PROFILE_MODEL_P
1155 if (PROFILE_MODEL_P (current_cpu))
1157 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1158 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1159 m32rx_model_profile_insn (current_cpu, abuf);
1167 /* Perform rem: rem $dr,$sr. */
1169 SEM_FN_NAME (m32rx,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1171 insn_t insn = SEM_INSN (sem_arg);
1172 #define OPRND(f) par_exec->operands.fmt_21_div.f
1173 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1174 CIA new_pc = CPU (h_pc) + 4;
1175 EXTRACT_FMT_21_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1176 EXTRACT_FMT_21_DIV_CODE
1178 if (NESI (OPRND (sr), 0)) {
1179 CPU (h_gr[f_r1]) = MODSI (OPRND (dr), OPRND (sr));
1180 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1183 #if WITH_PROFILE_MODEL_P
1184 if (PROFILE_MODEL_P (current_cpu))
1186 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1187 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1188 m32rx_model_profile_insn (current_cpu, abuf);
1196 /* Perform remu: remu $dr,$sr. */
1198 SEM_FN_NAME (m32rx,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1200 insn_t insn = SEM_INSN (sem_arg);
1201 #define OPRND(f) par_exec->operands.fmt_21_div.f
1202 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1203 CIA new_pc = CPU (h_pc) + 4;
1204 EXTRACT_FMT_21_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1205 EXTRACT_FMT_21_DIV_CODE
1207 if (NESI (OPRND (sr), 0)) {
1208 CPU (h_gr[f_r1]) = UMODSI (OPRND (dr), OPRND (sr));
1209 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1212 #if WITH_PROFILE_MODEL_P
1213 if (PROFILE_MODEL_P (current_cpu))
1215 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1216 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1217 m32rx_model_profile_insn (current_cpu, abuf);
1225 /* Perform jc: jc $sr. */
1227 SEM_FN_NAME (m32rx,jc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1229 insn_t insn = SEM_INSN (sem_arg);
1230 #define OPRND(f) par_exec->operands.fmt_22_jc.f
1231 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1232 CIA new_pc = CPU (h_pc) + 2;
1234 EXTRACT_FMT_22_JC_VARS /* f-op1 f-r1 f-op2 f-r2 */
1235 EXTRACT_FMT_22_JC_CODE
1237 if (OPRND (condbit)) {
1238 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, ANDSI (OPRND (sr), -4)));
1241 #if WITH_PROFILE_MODEL_P
1242 if (PROFILE_MODEL_P (current_cpu))
1244 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1245 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
1253 /* Perform jnc: jnc $sr. */
1255 SEM_FN_NAME (m32rx,jnc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1257 insn_t insn = SEM_INSN (sem_arg);
1258 #define OPRND(f) par_exec->operands.fmt_22_jc.f
1259 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1260 CIA new_pc = CPU (h_pc) + 2;
1262 EXTRACT_FMT_22_JC_VARS /* f-op1 f-r1 f-op2 f-r2 */
1263 EXTRACT_FMT_22_JC_CODE
1265 if (NOTBI (OPRND (condbit))) {
1266 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, ANDSI (OPRND (sr), -4)));
1269 #if WITH_PROFILE_MODEL_P
1270 if (PROFILE_MODEL_P (current_cpu))
1272 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1273 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
1281 /* Perform jl: jl $sr. */
1283 SEM_FN_NAME (m32rx,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1285 insn_t insn = SEM_INSN (sem_arg);
1286 #define OPRND(f) par_exec->operands.fmt_23_jl.f
1287 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1288 CIA new_pc = CPU (h_pc) + 2;
1290 EXTRACT_FMT_23_JL_VARS /* f-op1 f-r1 f-op2 f-r2 */
1291 EXTRACT_FMT_23_JL_CODE
1295 temp0 = ADDSI (ANDSI (OPRND (pc), -4), 4);
1297 CPU (h_gr[14]) = temp0;
1298 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
1299 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, temp1));
1302 #if WITH_PROFILE_MODEL_P
1303 if (PROFILE_MODEL_P (current_cpu))
1305 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1306 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1307 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
1315 /* Perform jmp: jmp $sr. */
1317 SEM_FN_NAME (m32rx,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1319 insn_t insn = SEM_INSN (sem_arg);
1320 #define OPRND(f) par_exec->operands.fmt_24_jmp.f
1321 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1322 CIA new_pc = CPU (h_pc) + 2;
1324 EXTRACT_FMT_24_JMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
1325 EXTRACT_FMT_24_JMP_CODE
1327 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, OPRND (sr)));
1329 #if WITH_PROFILE_MODEL_P
1330 if (PROFILE_MODEL_P (current_cpu))
1332 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1333 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
1341 /* Perform ld: ld $dr,@$sr. */
1343 SEM_FN_NAME (m32rx,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1345 insn_t insn = SEM_INSN (sem_arg);
1346 #define OPRND(f) par_exec->operands.fmt_25_ld.f
1347 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1348 CIA new_pc = CPU (h_pc) + 2;
1349 EXTRACT_FMT_25_LD_VARS /* f-op1 f-r1 f-op2 f-r2 */
1350 EXTRACT_FMT_25_LD_CODE
1352 CPU (h_gr[f_r1]) = OPRND (h_memory_sr);
1353 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1355 #if WITH_PROFILE_MODEL_P
1356 if (PROFILE_MODEL_P (current_cpu))
1358 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1359 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1360 m32rx_model_profile_insn (current_cpu, abuf);
1368 /* Perform ld-d: ld $dr,@($slo16,$sr). */
1370 SEM_FN_NAME (m32rx,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1372 insn_t insn = SEM_INSN (sem_arg);
1373 #define OPRND(f) par_exec->operands.fmt_26_ld_d.f
1374 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1375 CIA new_pc = CPU (h_pc) + 4;
1376 EXTRACT_FMT_26_LD_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1377 EXTRACT_FMT_26_LD_D_CODE
1379 CPU (h_gr[f_r1]) = OPRND (h_memory_add_WI_sr_slo16);
1380 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1382 #if WITH_PROFILE_MODEL_P
1383 if (PROFILE_MODEL_P (current_cpu))
1385 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1386 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1387 m32rx_model_profile_insn (current_cpu, abuf);
1395 /* Perform ldb: ldb $dr,@$sr. */
1397 SEM_FN_NAME (m32rx,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1399 insn_t insn = SEM_INSN (sem_arg);
1400 #define OPRND(f) par_exec->operands.fmt_27_ldb.f
1401 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1402 CIA new_pc = CPU (h_pc) + 2;
1403 EXTRACT_FMT_27_LDB_VARS /* f-op1 f-r1 f-op2 f-r2 */
1404 EXTRACT_FMT_27_LDB_CODE
1406 CPU (h_gr[f_r1]) = EXTQISI (OPRND (h_memory_sr));
1407 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1409 #if WITH_PROFILE_MODEL_P
1410 if (PROFILE_MODEL_P (current_cpu))
1412 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1413 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1414 m32rx_model_profile_insn (current_cpu, abuf);
1422 /* Perform ldb-d: ldb $dr,@($slo16,$sr). */
1424 SEM_FN_NAME (m32rx,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1426 insn_t insn = SEM_INSN (sem_arg);
1427 #define OPRND(f) par_exec->operands.fmt_28_ldb_d.f
1428 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1429 CIA new_pc = CPU (h_pc) + 4;
1430 EXTRACT_FMT_28_LDB_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1431 EXTRACT_FMT_28_LDB_D_CODE
1433 CPU (h_gr[f_r1]) = EXTQISI (OPRND (h_memory_add_WI_sr_slo16));
1434 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1436 #if WITH_PROFILE_MODEL_P
1437 if (PROFILE_MODEL_P (current_cpu))
1439 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1440 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1441 m32rx_model_profile_insn (current_cpu, abuf);
1449 /* Perform ldh: ldh $dr,@$sr. */
1451 SEM_FN_NAME (m32rx,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1453 insn_t insn = SEM_INSN (sem_arg);
1454 #define OPRND(f) par_exec->operands.fmt_29_ldh.f
1455 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1456 CIA new_pc = CPU (h_pc) + 2;
1457 EXTRACT_FMT_29_LDH_VARS /* f-op1 f-r1 f-op2 f-r2 */
1458 EXTRACT_FMT_29_LDH_CODE
1460 CPU (h_gr[f_r1]) = EXTHISI (OPRND (h_memory_sr));
1461 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1463 #if WITH_PROFILE_MODEL_P
1464 if (PROFILE_MODEL_P (current_cpu))
1466 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1467 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1468 m32rx_model_profile_insn (current_cpu, abuf);
1476 /* Perform ldh-d: ldh $dr,@($slo16,$sr). */
1478 SEM_FN_NAME (m32rx,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1480 insn_t insn = SEM_INSN (sem_arg);
1481 #define OPRND(f) par_exec->operands.fmt_30_ldh_d.f
1482 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1483 CIA new_pc = CPU (h_pc) + 4;
1484 EXTRACT_FMT_30_LDH_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1485 EXTRACT_FMT_30_LDH_D_CODE
1487 CPU (h_gr[f_r1]) = EXTHISI (OPRND (h_memory_add_WI_sr_slo16));
1488 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1490 #if WITH_PROFILE_MODEL_P
1491 if (PROFILE_MODEL_P (current_cpu))
1493 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1494 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1495 m32rx_model_profile_insn (current_cpu, abuf);
1503 /* Perform ldub: ldub $dr,@$sr. */
1505 SEM_FN_NAME (m32rx,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1507 insn_t insn = SEM_INSN (sem_arg);
1508 #define OPRND(f) par_exec->operands.fmt_27_ldb.f
1509 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1510 CIA new_pc = CPU (h_pc) + 2;
1511 EXTRACT_FMT_27_LDB_VARS /* f-op1 f-r1 f-op2 f-r2 */
1512 EXTRACT_FMT_27_LDB_CODE
1514 CPU (h_gr[f_r1]) = ZEXTQISI (OPRND (h_memory_sr));
1515 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1517 #if WITH_PROFILE_MODEL_P
1518 if (PROFILE_MODEL_P (current_cpu))
1520 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1521 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1522 m32rx_model_profile_insn (current_cpu, abuf);
1530 /* Perform ldub-d: ldub $dr,@($slo16,$sr). */
1532 SEM_FN_NAME (m32rx,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1534 insn_t insn = SEM_INSN (sem_arg);
1535 #define OPRND(f) par_exec->operands.fmt_28_ldb_d.f
1536 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1537 CIA new_pc = CPU (h_pc) + 4;
1538 EXTRACT_FMT_28_LDB_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1539 EXTRACT_FMT_28_LDB_D_CODE
1541 CPU (h_gr[f_r1]) = ZEXTQISI (OPRND (h_memory_add_WI_sr_slo16));
1542 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1544 #if WITH_PROFILE_MODEL_P
1545 if (PROFILE_MODEL_P (current_cpu))
1547 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1548 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1549 m32rx_model_profile_insn (current_cpu, abuf);
1557 /* Perform lduh: lduh $dr,@$sr. */
1559 SEM_FN_NAME (m32rx,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1561 insn_t insn = SEM_INSN (sem_arg);
1562 #define OPRND(f) par_exec->operands.fmt_29_ldh.f
1563 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1564 CIA new_pc = CPU (h_pc) + 2;
1565 EXTRACT_FMT_29_LDH_VARS /* f-op1 f-r1 f-op2 f-r2 */
1566 EXTRACT_FMT_29_LDH_CODE
1568 CPU (h_gr[f_r1]) = ZEXTHISI (OPRND (h_memory_sr));
1569 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1571 #if WITH_PROFILE_MODEL_P
1572 if (PROFILE_MODEL_P (current_cpu))
1574 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1575 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1576 m32rx_model_profile_insn (current_cpu, abuf);
1584 /* Perform lduh-d: lduh $dr,@($slo16,$sr). */
1586 SEM_FN_NAME (m32rx,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1588 insn_t insn = SEM_INSN (sem_arg);
1589 #define OPRND(f) par_exec->operands.fmt_30_ldh_d.f
1590 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1591 CIA new_pc = CPU (h_pc) + 4;
1592 EXTRACT_FMT_30_LDH_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1593 EXTRACT_FMT_30_LDH_D_CODE
1595 CPU (h_gr[f_r1]) = ZEXTHISI (OPRND (h_memory_add_WI_sr_slo16));
1596 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1598 #if WITH_PROFILE_MODEL_P
1599 if (PROFILE_MODEL_P (current_cpu))
1601 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1602 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1603 m32rx_model_profile_insn (current_cpu, abuf);
1611 /* Perform ld-plus: ld $dr,@$sr+. */
1613 SEM_FN_NAME (m32rx,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1615 insn_t insn = SEM_INSN (sem_arg);
1616 #define OPRND(f) par_exec->operands.fmt_25_ld.f
1617 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1618 CIA new_pc = CPU (h_pc) + 2;
1619 EXTRACT_FMT_25_LD_VARS /* f-op1 f-r1 f-op2 f-r2 */
1620 EXTRACT_FMT_25_LD_CODE
1624 temp0 = OPRND (h_memory_sr);
1625 temp1 = ADDSI (OPRND (sr), 4);
1626 CPU (h_gr[f_r1]) = temp0;
1627 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1628 CPU (h_gr[f_r2]) = temp1;
1629 TRACE_RESULT (current_cpu, "sr", 'x', CPU (h_gr[f_r2]));
1632 #if WITH_PROFILE_MODEL_P
1633 if (PROFILE_MODEL_P (current_cpu))
1635 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1636 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1637 m32rx_model_profile_insn (current_cpu, abuf);
1645 /* Perform ld24: ld24 $dr,#$uimm24. */
1647 SEM_FN_NAME (m32rx,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1649 insn_t insn = SEM_INSN (sem_arg);
1650 #define OPRND(f) par_exec->operands.fmt_31_ld24.f
1651 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1652 CIA new_pc = CPU (h_pc) + 4;
1653 EXTRACT_FMT_31_LD24_VARS /* f-op1 f-r1 f-uimm24 */
1654 EXTRACT_FMT_31_LD24_CODE
1656 CPU (h_gr[f_r1]) = OPRND (uimm24);
1657 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1659 #if WITH_PROFILE_MODEL_P
1660 if (PROFILE_MODEL_P (current_cpu))
1662 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1663 m32rx_model_profile_insn (current_cpu, abuf);
1671 /* Perform ldi8: ldi $dr,#$simm8. */
1673 SEM_FN_NAME (m32rx,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1675 insn_t insn = SEM_INSN (sem_arg);
1676 #define OPRND(f) par_exec->operands.fmt_32_ldi8.f
1677 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1678 CIA new_pc = CPU (h_pc) + 2;
1679 EXTRACT_FMT_32_LDI8_VARS /* f-op1 f-r1 f-simm8 */
1680 EXTRACT_FMT_32_LDI8_CODE
1682 CPU (h_gr[f_r1]) = OPRND (simm8);
1683 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1685 #if WITH_PROFILE_MODEL_P
1686 if (PROFILE_MODEL_P (current_cpu))
1688 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1689 m32rx_model_profile_insn (current_cpu, abuf);
1697 /* Perform ldi16: ldi $dr,$slo16. */
1699 SEM_FN_NAME (m32rx,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1701 insn_t insn = SEM_INSN (sem_arg);
1702 #define OPRND(f) par_exec->operands.fmt_33_ldi16.f
1703 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1704 CIA new_pc = CPU (h_pc) + 4;
1705 EXTRACT_FMT_33_LDI16_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1706 EXTRACT_FMT_33_LDI16_CODE
1708 CPU (h_gr[f_r1]) = OPRND (slo16);
1709 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1711 #if WITH_PROFILE_MODEL_P
1712 if (PROFILE_MODEL_P (current_cpu))
1714 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1715 m32rx_model_profile_insn (current_cpu, abuf);
1723 /* Perform lock: lock $dr,@$sr. */
1725 SEM_FN_NAME (m32rx,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1727 insn_t insn = SEM_INSN (sem_arg);
1728 #define OPRND(f) par_exec->operands.fmt_0_add.f
1729 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1730 CIA new_pc = CPU (h_pc) + 2;
1731 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
1732 EXTRACT_FMT_0_ADD_CODE
1734 do_lock (current_cpu, OPRND (dr), OPRND (sr));
1736 #if WITH_PROFILE_MODEL_P
1737 if (PROFILE_MODEL_P (current_cpu))
1739 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1740 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1741 m32rx_model_profile_insn (current_cpu, abuf);
1749 /* Perform machi-a: machi $src1,$src2,$acc. */
1751 SEM_FN_NAME (m32rx,machi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1753 insn_t insn = SEM_INSN (sem_arg);
1754 #define OPRND(f) par_exec->operands.fmt_34_machi_a.f
1755 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1756 CIA new_pc = CPU (h_pc) + 2;
1757 EXTRACT_FMT_34_MACHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */
1758 EXTRACT_FMT_34_MACHI_A_CODE
1760 m32rx_h_accums_set (current_cpu, f_acc, SRADI (SLLDI (ADDDI (OPRND (acc), MULDI (EXTSIDI (ANDSI (OPRND (src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2), 16))))), 8), 8));
1761 TRACE_RESULT (current_cpu, "acc", 'D', m32rx_h_accums_get (current_cpu, f_acc));
1763 #if WITH_PROFILE_MODEL_P
1764 if (PROFILE_MODEL_P (current_cpu))
1766 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1767 m32rx_model_profile_insn (current_cpu, abuf);
1775 /* Perform maclo-a: maclo $src1,$src2,$acc. */
1777 SEM_FN_NAME (m32rx,maclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1779 insn_t insn = SEM_INSN (sem_arg);
1780 #define OPRND(f) par_exec->operands.fmt_34_machi_a.f
1781 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1782 CIA new_pc = CPU (h_pc) + 2;
1783 EXTRACT_FMT_34_MACHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */
1784 EXTRACT_FMT_34_MACHI_A_CODE
1786 m32rx_h_accums_set (current_cpu, f_acc, SRADI (SLLDI (ADDDI (OPRND (acc), MULDI (EXTSIDI (SLLSI (OPRND (src1), 16)), EXTHIDI (TRUNCSIHI (OPRND (src2))))), 8), 8));
1787 TRACE_RESULT (current_cpu, "acc", 'D', m32rx_h_accums_get (current_cpu, f_acc));
1789 #if WITH_PROFILE_MODEL_P
1790 if (PROFILE_MODEL_P (current_cpu))
1792 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1793 m32rx_model_profile_insn (current_cpu, abuf);
1801 /* Perform mul: mul $dr,$sr. */
1803 SEM_FN_NAME (m32rx,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1805 insn_t insn = SEM_INSN (sem_arg);
1806 #define OPRND(f) par_exec->operands.fmt_0_add.f
1807 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1808 CIA new_pc = CPU (h_pc) + 2;
1809 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
1810 EXTRACT_FMT_0_ADD_CODE
1812 CPU (h_gr[f_r1]) = MULSI (OPRND (dr), OPRND (sr));
1813 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1815 #if WITH_PROFILE_MODEL_P
1816 if (PROFILE_MODEL_P (current_cpu))
1818 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1819 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1820 m32rx_model_profile_insn (current_cpu, abuf);
1828 /* Perform mulhi-a: mulhi $src1,$src2,$acc. */
1830 SEM_FN_NAME (m32rx,mulhi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1832 insn_t insn = SEM_INSN (sem_arg);
1833 #define OPRND(f) par_exec->operands.fmt_35_mulhi_a.f
1834 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1835 CIA new_pc = CPU (h_pc) + 2;
1836 EXTRACT_FMT_35_MULHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */
1837 EXTRACT_FMT_35_MULHI_A_CODE
1839 m32rx_h_accums_set (current_cpu, f_acc, SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (OPRND (src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2), 16)))), 16), 16));
1840 TRACE_RESULT (current_cpu, "acc", 'D', m32rx_h_accums_get (current_cpu, f_acc));
1842 #if WITH_PROFILE_MODEL_P
1843 if (PROFILE_MODEL_P (current_cpu))
1845 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1846 m32rx_model_profile_insn (current_cpu, abuf);
1854 /* Perform mullo-a: mullo $src1,$src2,$acc. */
1856 SEM_FN_NAME (m32rx,mullo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1858 insn_t insn = SEM_INSN (sem_arg);
1859 #define OPRND(f) par_exec->operands.fmt_35_mulhi_a.f
1860 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1861 CIA new_pc = CPU (h_pc) + 2;
1862 EXTRACT_FMT_35_MULHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */
1863 EXTRACT_FMT_35_MULHI_A_CODE
1865 m32rx_h_accums_set (current_cpu, f_acc, SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (OPRND (src1), 16)), EXTHIDI (TRUNCSIHI (OPRND (src2)))), 16), 16));
1866 TRACE_RESULT (current_cpu, "acc", 'D', m32rx_h_accums_get (current_cpu, f_acc));
1868 #if WITH_PROFILE_MODEL_P
1869 if (PROFILE_MODEL_P (current_cpu))
1871 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1872 m32rx_model_profile_insn (current_cpu, abuf);
1880 /* Perform mv: mv $dr,$sr. */
1882 SEM_FN_NAME (m32rx,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1884 insn_t insn = SEM_INSN (sem_arg);
1885 #define OPRND(f) par_exec->operands.fmt_36_mv.f
1886 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1887 CIA new_pc = CPU (h_pc) + 2;
1888 EXTRACT_FMT_36_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */
1889 EXTRACT_FMT_36_MV_CODE
1891 CPU (h_gr[f_r1]) = OPRND (sr);
1892 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1894 #if WITH_PROFILE_MODEL_P
1895 if (PROFILE_MODEL_P (current_cpu))
1897 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1898 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1899 m32rx_model_profile_insn (current_cpu, abuf);
1907 /* Perform mvfachi-a: mvfachi $dr,$accs. */
1909 SEM_FN_NAME (m32rx,mvfachi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1911 insn_t insn = SEM_INSN (sem_arg);
1912 #define OPRND(f) par_exec->operands.fmt_37_mvfachi_a.f
1913 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1914 CIA new_pc = CPU (h_pc) + 2;
1915 EXTRACT_FMT_37_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
1916 EXTRACT_FMT_37_MVFACHI_A_CODE
1918 CPU (h_gr[f_r1]) = TRUNCDISI (SRADI (OPRND (accs), 32));
1919 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1921 #if WITH_PROFILE_MODEL_P
1922 if (PROFILE_MODEL_P (current_cpu))
1924 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1925 m32rx_model_profile_insn (current_cpu, abuf);
1933 /* Perform mvfaclo-a: mvfaclo $dr,$accs. */
1935 SEM_FN_NAME (m32rx,mvfaclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1937 insn_t insn = SEM_INSN (sem_arg);
1938 #define OPRND(f) par_exec->operands.fmt_37_mvfachi_a.f
1939 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1940 CIA new_pc = CPU (h_pc) + 2;
1941 EXTRACT_FMT_37_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
1942 EXTRACT_FMT_37_MVFACHI_A_CODE
1944 CPU (h_gr[f_r1]) = TRUNCDISI (OPRND (accs));
1945 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1947 #if WITH_PROFILE_MODEL_P
1948 if (PROFILE_MODEL_P (current_cpu))
1950 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1951 m32rx_model_profile_insn (current_cpu, abuf);
1959 /* Perform mvfacmi-a: mvfacmi $dr,$accs. */
1961 SEM_FN_NAME (m32rx,mvfacmi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1963 insn_t insn = SEM_INSN (sem_arg);
1964 #define OPRND(f) par_exec->operands.fmt_37_mvfachi_a.f
1965 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1966 CIA new_pc = CPU (h_pc) + 2;
1967 EXTRACT_FMT_37_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
1968 EXTRACT_FMT_37_MVFACHI_A_CODE
1970 CPU (h_gr[f_r1]) = TRUNCDISI (SRADI (OPRND (accs), 16));
1971 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1973 #if WITH_PROFILE_MODEL_P
1974 if (PROFILE_MODEL_P (current_cpu))
1976 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1977 m32rx_model_profile_insn (current_cpu, abuf);
1985 /* Perform mvfc: mvfc $dr,$scr. */
1987 SEM_FN_NAME (m32rx,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1989 insn_t insn = SEM_INSN (sem_arg);
1990 #define OPRND(f) par_exec->operands.fmt_38_mvfc.f
1991 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1992 CIA new_pc = CPU (h_pc) + 2;
1993 EXTRACT_FMT_38_MVFC_VARS /* f-op1 f-r1 f-op2 f-r2 */
1994 EXTRACT_FMT_38_MVFC_CODE
1996 CPU (h_gr[f_r1]) = OPRND (scr);
1997 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1999 #if WITH_PROFILE_MODEL_P
2000 if (PROFILE_MODEL_P (current_cpu))
2002 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2003 m32rx_model_profile_insn (current_cpu, abuf);
2011 /* Perform mvtachi-a: mvtachi $src1,$accs. */
2013 SEM_FN_NAME (m32rx,mvtachi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2015 insn_t insn = SEM_INSN (sem_arg);
2016 #define OPRND(f) par_exec->operands.fmt_39_mvtachi_a.f
2017 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2018 CIA new_pc = CPU (h_pc) + 2;
2019 EXTRACT_FMT_39_MVTACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
2020 EXTRACT_FMT_39_MVTACHI_A_CODE
2022 m32rx_h_accums_set (current_cpu, f_accs, ORDI (ANDDI (OPRND (accs), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (OPRND (src1)), 32)));
2023 TRACE_RESULT (current_cpu, "accs", 'D', m32rx_h_accums_get (current_cpu, f_accs));
2025 #if WITH_PROFILE_MODEL_P
2026 if (PROFILE_MODEL_P (current_cpu))
2028 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2029 m32rx_model_profile_insn (current_cpu, abuf);
2037 /* Perform mvtaclo-a: mvtaclo $src1,$accs. */
2039 SEM_FN_NAME (m32rx,mvtaclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2041 insn_t insn = SEM_INSN (sem_arg);
2042 #define OPRND(f) par_exec->operands.fmt_39_mvtachi_a.f
2043 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2044 CIA new_pc = CPU (h_pc) + 2;
2045 EXTRACT_FMT_39_MVTACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
2046 EXTRACT_FMT_39_MVTACHI_A_CODE
2048 m32rx_h_accums_set (current_cpu, f_accs, ORDI (ANDDI (OPRND (accs), MAKEDI (0xffffffff, 0)), EXTSIDI (OPRND (src1))));
2049 TRACE_RESULT (current_cpu, "accs", 'D', m32rx_h_accums_get (current_cpu, f_accs));
2051 #if WITH_PROFILE_MODEL_P
2052 if (PROFILE_MODEL_P (current_cpu))
2054 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2055 m32rx_model_profile_insn (current_cpu, abuf);
2063 /* Perform mvtc: mvtc $sr,$dcr. */
2065 SEM_FN_NAME (m32rx,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2067 insn_t insn = SEM_INSN (sem_arg);
2068 #define OPRND(f) par_exec->operands.fmt_40_mvtc.f
2069 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2070 CIA new_pc = CPU (h_pc) + 2;
2071 EXTRACT_FMT_40_MVTC_VARS /* f-op1 f-r1 f-op2 f-r2 */
2072 EXTRACT_FMT_40_MVTC_CODE
2074 m32rx_h_cr_set (current_cpu, f_r1, OPRND (sr));
2075 TRACE_RESULT (current_cpu, "dcr", 'x', m32rx_h_cr_get (current_cpu, f_r1));
2077 #if WITH_PROFILE_MODEL_P
2078 if (PROFILE_MODEL_P (current_cpu))
2080 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2081 m32rx_model_profile_insn (current_cpu, abuf);
2089 /* Perform neg: neg $dr,$sr. */
2091 SEM_FN_NAME (m32rx,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2093 insn_t insn = SEM_INSN (sem_arg);
2094 #define OPRND(f) par_exec->operands.fmt_36_mv.f
2095 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2096 CIA new_pc = CPU (h_pc) + 2;
2097 EXTRACT_FMT_36_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */
2098 EXTRACT_FMT_36_MV_CODE
2100 CPU (h_gr[f_r1]) = NEGSI (OPRND (sr));
2101 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2103 #if WITH_PROFILE_MODEL_P
2104 if (PROFILE_MODEL_P (current_cpu))
2106 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2107 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2108 m32rx_model_profile_insn (current_cpu, abuf);
2116 /* Perform nop: nop. */
2118 SEM_FN_NAME (m32rx,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2120 insn_t insn = SEM_INSN (sem_arg);
2121 #define OPRND(f) par_exec->operands.fmt_41_nop.f
2122 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2123 CIA new_pc = CPU (h_pc) + 2;
2124 EXTRACT_FMT_41_NOP_VARS /* f-op1 f-r1 f-op2 f-r2 */
2125 EXTRACT_FMT_41_NOP_CODE
2127 PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
2129 #if WITH_PROFILE_MODEL_P
2130 if (PROFILE_MODEL_P (current_cpu))
2132 m32rx_model_profile_insn (current_cpu, abuf);
2140 /* Perform not: not $dr,$sr. */
2142 SEM_FN_NAME (m32rx,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2144 insn_t insn = SEM_INSN (sem_arg);
2145 #define OPRND(f) par_exec->operands.fmt_36_mv.f
2146 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2147 CIA new_pc = CPU (h_pc) + 2;
2148 EXTRACT_FMT_36_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */
2149 EXTRACT_FMT_36_MV_CODE
2151 CPU (h_gr[f_r1]) = INVSI (OPRND (sr));
2152 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2154 #if WITH_PROFILE_MODEL_P
2155 if (PROFILE_MODEL_P (current_cpu))
2157 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2158 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2159 m32rx_model_profile_insn (current_cpu, abuf);
2167 /* Perform rac-a: rac $accs. */
2169 SEM_FN_NAME (m32rx,rac_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2171 insn_t insn = SEM_INSN (sem_arg);
2172 #define OPRND(f) par_exec->operands.fmt_42_rac_a.f
2173 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2174 CIA new_pc = CPU (h_pc) + 2;
2175 EXTRACT_FMT_42_RAC_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
2176 EXTRACT_FMT_42_RAC_A_CODE
2180 tmp_tmp1 = ANDDI (OPRND (accs), MAKEDI (16777215, 0xffffffff));
2181 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (16383, 0xffff8000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
2182 tmp_tmp1 = MAKEDI (16383, 0xffff8000);
2184 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
2185 tmp_tmp1 = MAKEDI (16760832, 0);
2187 tmp_tmp1 = ANDDI (ADDDI (OPRND (accs), MAKEDI (0, 16384)), MAKEDI (16777215, 0xffff8000));
2190 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
2191 m32rx_h_accums_set (current_cpu, f_accs, SRADI (SLLDI (tmp_tmp1, 7), 7));
2192 TRACE_RESULT (current_cpu, "accs", 'D', m32rx_h_accums_get (current_cpu, f_accs));
2195 #if WITH_PROFILE_MODEL_P
2196 if (PROFILE_MODEL_P (current_cpu))
2198 m32rx_model_profile_insn (current_cpu, abuf);
2206 /* Perform rach-a: rach $accs. */
2208 SEM_FN_NAME (m32rx,rach_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2210 insn_t insn = SEM_INSN (sem_arg);
2211 #define OPRND(f) par_exec->operands.fmt_42_rac_a.f
2212 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2213 CIA new_pc = CPU (h_pc) + 2;
2214 EXTRACT_FMT_42_RAC_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
2215 EXTRACT_FMT_42_RAC_A_CODE
2219 tmp_tmp1 = ANDDI (OPRND (accs), MAKEDI (16777215, 0xffffffff));
2220 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
2221 tmp_tmp1 = MAKEDI (16383, 0x80000000);
2223 if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
2224 tmp_tmp1 = MAKEDI (16760832, 0);
2226 tmp_tmp1 = ANDDI (ADDDI (OPRND (accs), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
2229 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
2230 m32rx_h_accums_set (current_cpu, f_accs, SRADI (SLLDI (tmp_tmp1, 7), 7));
2231 TRACE_RESULT (current_cpu, "accs", 'D', m32rx_h_accums_get (current_cpu, f_accs));
2234 #if WITH_PROFILE_MODEL_P
2235 if (PROFILE_MODEL_P (current_cpu))
2237 m32rx_model_profile_insn (current_cpu, abuf);
2245 /* Perform rte: rte. */
2247 SEM_FN_NAME (m32rx,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2249 insn_t insn = SEM_INSN (sem_arg);
2250 #define OPRND(f) par_exec->operands.fmt_43_rte.f
2251 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2252 CIA new_pc = CPU (h_pc) + 2;
2254 EXTRACT_FMT_43_RTE_VARS /* f-op1 f-r1 f-op2 f-r2 */
2255 EXTRACT_FMT_43_RTE_CODE
2258 CPU (h_sm) = OPRND (h_bsm_0);
2259 TRACE_RESULT (current_cpu, "h-sm-0", 'x', CPU (h_sm));
2260 CPU (h_ie) = OPRND (h_bie_0);
2261 TRACE_RESULT (current_cpu, "h-ie-0", 'x', CPU (h_ie));
2262 CPU (h_cond) = OPRND (h_bcond_0);
2263 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2264 BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, OPRND (h_bpc_0)));
2265 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
2268 #if WITH_PROFILE_MODEL_P
2269 if (PROFILE_MODEL_P (current_cpu))
2271 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
2279 /* Perform seth: seth $dr,#$hi16. */
2281 SEM_FN_NAME (m32rx,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2283 insn_t insn = SEM_INSN (sem_arg);
2284 #define OPRND(f) par_exec->operands.fmt_44_seth.f
2285 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2286 CIA new_pc = CPU (h_pc) + 4;
2287 EXTRACT_FMT_44_SETH_VARS /* f-op1 f-r1 f-op2 f-r2 f-hi16 */
2288 EXTRACT_FMT_44_SETH_CODE
2290 CPU (h_gr[f_r1]) = SLLSI (OPRND (hi16), 16);
2291 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2293 #if WITH_PROFILE_MODEL_P
2294 if (PROFILE_MODEL_P (current_cpu))
2296 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2297 m32rx_model_profile_insn (current_cpu, abuf);
2305 /* Perform sll: sll $dr,$sr. */
2307 SEM_FN_NAME (m32rx,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2309 insn_t insn = SEM_INSN (sem_arg);
2310 #define OPRND(f) par_exec->operands.fmt_0_add.f
2311 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2312 CIA new_pc = CPU (h_pc) + 2;
2313 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2314 EXTRACT_FMT_0_ADD_CODE
2316 CPU (h_gr[f_r1]) = SLLSI (OPRND (dr), ANDSI (OPRND (sr), 31));
2317 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2319 #if WITH_PROFILE_MODEL_P
2320 if (PROFILE_MODEL_P (current_cpu))
2322 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2323 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2324 m32rx_model_profile_insn (current_cpu, abuf);
2332 /* Perform sll3: sll3 $dr,$sr,#$simm16. */
2334 SEM_FN_NAME (m32rx,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2336 insn_t insn = SEM_INSN (sem_arg);
2337 #define OPRND(f) par_exec->operands.fmt_5_addv3.f
2338 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2339 CIA new_pc = CPU (h_pc) + 4;
2340 EXTRACT_FMT_5_ADDV3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2341 EXTRACT_FMT_5_ADDV3_CODE
2343 CPU (h_gr[f_r1]) = SLLSI (OPRND (sr), ANDSI (OPRND (simm16), 31));
2344 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2346 #if WITH_PROFILE_MODEL_P
2347 if (PROFILE_MODEL_P (current_cpu))
2349 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2350 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2351 m32rx_model_profile_insn (current_cpu, abuf);
2359 /* Perform slli: slli $dr,#$uimm5. */
2361 SEM_FN_NAME (m32rx,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2363 insn_t insn = SEM_INSN (sem_arg);
2364 #define OPRND(f) par_exec->operands.fmt_45_slli.f
2365 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2366 CIA new_pc = CPU (h_pc) + 2;
2367 EXTRACT_FMT_45_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */
2368 EXTRACT_FMT_45_SLLI_CODE
2370 CPU (h_gr[f_r1]) = SLLSI (OPRND (dr), OPRND (uimm5));
2371 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2373 #if WITH_PROFILE_MODEL_P
2374 if (PROFILE_MODEL_P (current_cpu))
2376 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2377 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2378 m32rx_model_profile_insn (current_cpu, abuf);
2386 /* Perform sra: sra $dr,$sr. */
2388 SEM_FN_NAME (m32rx,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2390 insn_t insn = SEM_INSN (sem_arg);
2391 #define OPRND(f) par_exec->operands.fmt_0_add.f
2392 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2393 CIA new_pc = CPU (h_pc) + 2;
2394 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2395 EXTRACT_FMT_0_ADD_CODE
2397 CPU (h_gr[f_r1]) = SRASI (OPRND (dr), ANDSI (OPRND (sr), 31));
2398 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2400 #if WITH_PROFILE_MODEL_P
2401 if (PROFILE_MODEL_P (current_cpu))
2403 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2404 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2405 m32rx_model_profile_insn (current_cpu, abuf);
2413 /* Perform sra3: sra3 $dr,$sr,#$simm16. */
2415 SEM_FN_NAME (m32rx,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2417 insn_t insn = SEM_INSN (sem_arg);
2418 #define OPRND(f) par_exec->operands.fmt_5_addv3.f
2419 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2420 CIA new_pc = CPU (h_pc) + 4;
2421 EXTRACT_FMT_5_ADDV3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2422 EXTRACT_FMT_5_ADDV3_CODE
2424 CPU (h_gr[f_r1]) = SRASI (OPRND (sr), ANDSI (OPRND (simm16), 31));
2425 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2427 #if WITH_PROFILE_MODEL_P
2428 if (PROFILE_MODEL_P (current_cpu))
2430 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2431 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2432 m32rx_model_profile_insn (current_cpu, abuf);
2440 /* Perform srai: srai $dr,#$uimm5. */
2442 SEM_FN_NAME (m32rx,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2444 insn_t insn = SEM_INSN (sem_arg);
2445 #define OPRND(f) par_exec->operands.fmt_45_slli.f
2446 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2447 CIA new_pc = CPU (h_pc) + 2;
2448 EXTRACT_FMT_45_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */
2449 EXTRACT_FMT_45_SLLI_CODE
2451 CPU (h_gr[f_r1]) = SRASI (OPRND (dr), OPRND (uimm5));
2452 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2454 #if WITH_PROFILE_MODEL_P
2455 if (PROFILE_MODEL_P (current_cpu))
2457 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2458 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2459 m32rx_model_profile_insn (current_cpu, abuf);
2467 /* Perform srl: srl $dr,$sr. */
2469 SEM_FN_NAME (m32rx,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2471 insn_t insn = SEM_INSN (sem_arg);
2472 #define OPRND(f) par_exec->operands.fmt_0_add.f
2473 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2474 CIA new_pc = CPU (h_pc) + 2;
2475 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2476 EXTRACT_FMT_0_ADD_CODE
2478 CPU (h_gr[f_r1]) = SRLSI (OPRND (dr), ANDSI (OPRND (sr), 31));
2479 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2481 #if WITH_PROFILE_MODEL_P
2482 if (PROFILE_MODEL_P (current_cpu))
2484 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2485 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2486 m32rx_model_profile_insn (current_cpu, abuf);
2494 /* Perform srl3: srl3 $dr,$sr,#$simm16. */
2496 SEM_FN_NAME (m32rx,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2498 insn_t insn = SEM_INSN (sem_arg);
2499 #define OPRND(f) par_exec->operands.fmt_5_addv3.f
2500 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2501 CIA new_pc = CPU (h_pc) + 4;
2502 EXTRACT_FMT_5_ADDV3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2503 EXTRACT_FMT_5_ADDV3_CODE
2505 CPU (h_gr[f_r1]) = SRLSI (OPRND (sr), ANDSI (OPRND (simm16), 31));
2506 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2508 #if WITH_PROFILE_MODEL_P
2509 if (PROFILE_MODEL_P (current_cpu))
2511 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2512 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2513 m32rx_model_profile_insn (current_cpu, abuf);
2521 /* Perform srli: srli $dr,#$uimm5. */
2523 SEM_FN_NAME (m32rx,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2525 insn_t insn = SEM_INSN (sem_arg);
2526 #define OPRND(f) par_exec->operands.fmt_45_slli.f
2527 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2528 CIA new_pc = CPU (h_pc) + 2;
2529 EXTRACT_FMT_45_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */
2530 EXTRACT_FMT_45_SLLI_CODE
2532 CPU (h_gr[f_r1]) = SRLSI (OPRND (dr), OPRND (uimm5));
2533 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2535 #if WITH_PROFILE_MODEL_P
2536 if (PROFILE_MODEL_P (current_cpu))
2538 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2539 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2540 m32rx_model_profile_insn (current_cpu, abuf);
2548 /* Perform st: st $src1,@$src2. */
2550 SEM_FN_NAME (m32rx,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2552 insn_t insn = SEM_INSN (sem_arg);
2553 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
2554 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2555 CIA new_pc = CPU (h_pc) + 2;
2556 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
2557 EXTRACT_FMT_17_CMP_CODE
2559 SETMEMSI (current_cpu, OPRND (src2), OPRND (src1));
2560 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, OPRND (src2)));
2562 #if WITH_PROFILE_MODEL_P
2563 if (PROFILE_MODEL_P (current_cpu))
2565 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2566 m32rx_model_profile_insn (current_cpu, abuf);
2574 /* Perform st-d: st $src1,@($slo16,$src2). */
2576 SEM_FN_NAME (m32rx,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2578 insn_t insn = SEM_INSN (sem_arg);
2579 #define OPRND(f) par_exec->operands.fmt_46_st_d.f
2580 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2581 CIA new_pc = CPU (h_pc) + 4;
2582 EXTRACT_FMT_46_ST_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2583 EXTRACT_FMT_46_ST_D_CODE
2585 SETMEMSI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), OPRND (src1));
2586 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMSI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16))));
2588 #if WITH_PROFILE_MODEL_P
2589 if (PROFILE_MODEL_P (current_cpu))
2591 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2592 m32rx_model_profile_insn (current_cpu, abuf);
2600 /* Perform stb: stb $src1,@$src2. */
2602 SEM_FN_NAME (m32rx,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2604 insn_t insn = SEM_INSN (sem_arg);
2605 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
2606 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2607 CIA new_pc = CPU (h_pc) + 2;
2608 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
2609 EXTRACT_FMT_17_CMP_CODE
2611 SETMEMQI (current_cpu, OPRND (src2), OPRND (src1));
2612 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMQI (current_cpu, OPRND (src2)));
2614 #if WITH_PROFILE_MODEL_P
2615 if (PROFILE_MODEL_P (current_cpu))
2617 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2618 m32rx_model_profile_insn (current_cpu, abuf);
2626 /* Perform stb-d: stb $src1,@($slo16,$src2). */
2628 SEM_FN_NAME (m32rx,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2630 insn_t insn = SEM_INSN (sem_arg);
2631 #define OPRND(f) par_exec->operands.fmt_46_st_d.f
2632 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2633 CIA new_pc = CPU (h_pc) + 4;
2634 EXTRACT_FMT_46_ST_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2635 EXTRACT_FMT_46_ST_D_CODE
2637 SETMEMQI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), OPRND (src1));
2638 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMQI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16))));
2640 #if WITH_PROFILE_MODEL_P
2641 if (PROFILE_MODEL_P (current_cpu))
2643 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2644 m32rx_model_profile_insn (current_cpu, abuf);
2652 /* Perform sth: sth $src1,@$src2. */
2654 SEM_FN_NAME (m32rx,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2656 insn_t insn = SEM_INSN (sem_arg);
2657 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
2658 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2659 CIA new_pc = CPU (h_pc) + 2;
2660 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
2661 EXTRACT_FMT_17_CMP_CODE
2663 SETMEMHI (current_cpu, OPRND (src2), OPRND (src1));
2664 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMHI (current_cpu, OPRND (src2)));
2666 #if WITH_PROFILE_MODEL_P
2667 if (PROFILE_MODEL_P (current_cpu))
2669 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2670 m32rx_model_profile_insn (current_cpu, abuf);
2678 /* Perform sth-d: sth $src1,@($slo16,$src2). */
2680 SEM_FN_NAME (m32rx,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2682 insn_t insn = SEM_INSN (sem_arg);
2683 #define OPRND(f) par_exec->operands.fmt_46_st_d.f
2684 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2685 CIA new_pc = CPU (h_pc) + 4;
2686 EXTRACT_FMT_46_ST_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2687 EXTRACT_FMT_46_ST_D_CODE
2689 SETMEMHI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), OPRND (src1));
2690 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMHI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16))));
2692 #if WITH_PROFILE_MODEL_P
2693 if (PROFILE_MODEL_P (current_cpu))
2695 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2696 m32rx_model_profile_insn (current_cpu, abuf);
2704 /* Perform st-plus: st $src1,@+$src2. */
2706 SEM_FN_NAME (m32rx,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2708 insn_t insn = SEM_INSN (sem_arg);
2709 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
2710 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2711 CIA new_pc = CPU (h_pc) + 2;
2712 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
2713 EXTRACT_FMT_17_CMP_CODE
2716 CPU (h_gr[f_r2]) = ADDSI (OPRND (src2), 4);
2717 TRACE_RESULT (current_cpu, "src2", 'x', CPU (h_gr[f_r2]));
2718 SETMEMSI (current_cpu, OPRND (src2), OPRND (src1));
2719 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, OPRND (src2)));
2722 #if WITH_PROFILE_MODEL_P
2723 if (PROFILE_MODEL_P (current_cpu))
2725 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2726 m32rx_model_profile_insn (current_cpu, abuf);
2734 /* Perform st-minus: st $src1,@-$src2. */
2736 SEM_FN_NAME (m32rx,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2738 insn_t insn = SEM_INSN (sem_arg);
2739 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
2740 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2741 CIA new_pc = CPU (h_pc) + 2;
2742 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
2743 EXTRACT_FMT_17_CMP_CODE
2746 CPU (h_gr[f_r2]) = SUBSI (OPRND (src2), 4);
2747 TRACE_RESULT (current_cpu, "src2", 'x', CPU (h_gr[f_r2]));
2748 SETMEMSI (current_cpu, OPRND (src2), OPRND (src1));
2749 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, OPRND (src2)));
2752 #if WITH_PROFILE_MODEL_P
2753 if (PROFILE_MODEL_P (current_cpu))
2755 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2756 m32rx_model_profile_insn (current_cpu, abuf);
2764 /* Perform sub: sub $dr,$sr. */
2766 SEM_FN_NAME (m32rx,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2768 insn_t insn = SEM_INSN (sem_arg);
2769 #define OPRND(f) par_exec->operands.fmt_0_add.f
2770 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2771 CIA new_pc = CPU (h_pc) + 2;
2772 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2773 EXTRACT_FMT_0_ADD_CODE
2775 CPU (h_gr[f_r1]) = SUBSI (OPRND (dr), OPRND (sr));
2776 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2778 #if WITH_PROFILE_MODEL_P
2779 if (PROFILE_MODEL_P (current_cpu))
2781 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2782 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2783 m32rx_model_profile_insn (current_cpu, abuf);
2791 /* Perform subv: subv $dr,$sr. */
2793 SEM_FN_NAME (m32rx,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2795 insn_t insn = SEM_INSN (sem_arg);
2796 #define OPRND(f) par_exec->operands.fmt_0_add.f
2797 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2798 CIA new_pc = CPU (h_pc) + 2;
2799 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2800 EXTRACT_FMT_0_ADD_CODE
2804 temp0 = SUBSI (OPRND (dr), OPRND (sr));
2805 temp1 = SUBOFSI (OPRND (dr), OPRND (sr), 0);
2806 CPU (h_gr[f_r1]) = temp0;
2807 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2808 CPU (h_cond) = temp1;
2809 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2812 #if WITH_PROFILE_MODEL_P
2813 if (PROFILE_MODEL_P (current_cpu))
2815 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2816 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2817 m32rx_model_profile_insn (current_cpu, abuf);
2825 /* Perform subx: subx $dr,$sr. */
2827 SEM_FN_NAME (m32rx,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2829 insn_t insn = SEM_INSN (sem_arg);
2830 #define OPRND(f) par_exec->operands.fmt_6_addx.f
2831 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2832 CIA new_pc = CPU (h_pc) + 2;
2833 EXTRACT_FMT_6_ADDX_VARS /* f-op1 f-r1 f-op2 f-r2 */
2834 EXTRACT_FMT_6_ADDX_CODE
2838 temp0 = SUBCSI (OPRND (dr), OPRND (sr), OPRND (condbit));
2839 temp1 = SUBCFSI (OPRND (dr), OPRND (sr), OPRND (condbit));
2840 CPU (h_gr[f_r1]) = temp0;
2841 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2842 CPU (h_cond) = temp1;
2843 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2846 #if WITH_PROFILE_MODEL_P
2847 if (PROFILE_MODEL_P (current_cpu))
2849 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2850 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2851 m32rx_model_profile_insn (current_cpu, abuf);
2859 /* Perform trap: trap #$uimm4. */
2861 SEM_FN_NAME (m32rx,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2863 insn_t insn = SEM_INSN (sem_arg);
2864 #define OPRND(f) par_exec->operands.fmt_47_trap.f
2865 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2866 CIA new_pc = CPU (h_pc) + 2;
2868 EXTRACT_FMT_47_TRAP_VARS /* f-op1 f-r1 f-op2 f-uimm4 */
2869 EXTRACT_FMT_47_TRAP_CODE
2871 do_trap (current_cpu, OPRND (uimm4));
2873 #if WITH_PROFILE_MODEL_P
2874 if (PROFILE_MODEL_P (current_cpu))
2876 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
2884 /* Perform unlock: unlock $src1,@$src2. */
2886 SEM_FN_NAME (m32rx,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2888 insn_t insn = SEM_INSN (sem_arg);
2889 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
2890 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2891 CIA new_pc = CPU (h_pc) + 2;
2892 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
2893 EXTRACT_FMT_17_CMP_CODE
2895 do_unlock (current_cpu, OPRND (src1), OPRND (src2));
2897 #if WITH_PROFILE_MODEL_P
2898 if (PROFILE_MODEL_P (current_cpu))
2900 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2901 m32rx_model_profile_insn (current_cpu, abuf);
2909 /* Perform satb: satb $dr,$src2. */
2911 SEM_FN_NAME (m32rx,satb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2913 insn_t insn = SEM_INSN (sem_arg);
2914 #define OPRND(f) par_exec->operands.fmt_48_satb.f
2915 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2916 CIA new_pc = CPU (h_pc) + 4;
2917 EXTRACT_FMT_48_SATB_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
2918 EXTRACT_FMT_48_SATB_CODE
2920 CPU (h_gr[f_r1]) = (GESI (OPRND (src2), 127)) ? (127) : (LESI (OPRND (src2), -128)) ? (-128) : (OPRND (src2));
2921 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2923 #if WITH_PROFILE_MODEL_P
2924 if (PROFILE_MODEL_P (current_cpu))
2926 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2927 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2928 m32rx_model_profile_insn (current_cpu, abuf);
2936 /* Perform sath: sath $dr,$src2. */
2938 SEM_FN_NAME (m32rx,sath) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2940 insn_t insn = SEM_INSN (sem_arg);
2941 #define OPRND(f) par_exec->operands.fmt_48_satb.f
2942 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2943 CIA new_pc = CPU (h_pc) + 4;
2944 EXTRACT_FMT_48_SATB_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
2945 EXTRACT_FMT_48_SATB_CODE
2947 CPU (h_gr[f_r1]) = (GESI (OPRND (src2), 32767)) ? (32767) : (LESI (OPRND (src2), -32768)) ? (-32768) : (OPRND (src2));
2948 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2950 #if WITH_PROFILE_MODEL_P
2951 if (PROFILE_MODEL_P (current_cpu))
2953 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2954 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2955 m32rx_model_profile_insn (current_cpu, abuf);
2963 /* Perform sat: sat $dr,$src2. */
2965 SEM_FN_NAME (m32rx,sat) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2967 insn_t insn = SEM_INSN (sem_arg);
2968 #define OPRND(f) par_exec->operands.fmt_49_sat.f
2969 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2970 CIA new_pc = CPU (h_pc) + 4;
2971 EXTRACT_FMT_49_SAT_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
2972 EXTRACT_FMT_49_SAT_CODE
2974 CPU (h_gr[f_r1]) = (OPRND (condbit)) ? ((LTSI (OPRND (src2), 0)) ? (2147483647) : (0x80000000)) : (OPRND (src2));
2975 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2977 #if WITH_PROFILE_MODEL_P
2978 if (PROFILE_MODEL_P (current_cpu))
2980 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2981 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2982 m32rx_model_profile_insn (current_cpu, abuf);
2990 /* Perform pcmpbz: pcmpbz $src2. */
2992 SEM_FN_NAME (m32rx,pcmpbz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2994 insn_t insn = SEM_INSN (sem_arg);
2995 #define OPRND(f) par_exec->operands.fmt_20_cmpz.f
2996 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2997 CIA new_pc = CPU (h_pc) + 2;
2998 EXTRACT_FMT_20_CMPZ_VARS /* f-op1 f-r1 f-op2 f-r2 */
2999 EXTRACT_FMT_20_CMPZ_CODE
3001 CPU (h_cond) = (EQSI (ANDSI (OPRND (src2), 255), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2), 65280), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2), 16711680), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2), 0xff000000), 0)) ? (1) : (0);
3002 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
3004 #if WITH_PROFILE_MODEL_P
3005 if (PROFILE_MODEL_P (current_cpu))
3007 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3008 m32rx_model_profile_insn (current_cpu, abuf);
3016 /* Perform sadd: sadd. */
3018 SEM_FN_NAME (m32rx,sadd) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3020 insn_t insn = SEM_INSN (sem_arg);
3021 #define OPRND(f) par_exec->operands.fmt_50_sadd.f
3022 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3023 CIA new_pc = CPU (h_pc) + 2;
3024 EXTRACT_FMT_50_SADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
3025 EXTRACT_FMT_50_SADD_CODE
3027 m32rx_h_accums_set (current_cpu, 0, ADDDI (SRADI (OPRND (h_accums_1), 16), OPRND (h_accums_0)));
3028 TRACE_RESULT (current_cpu, "h-accums-0", 'D', m32rx_h_accums_get (current_cpu, 0));
3030 #if WITH_PROFILE_MODEL_P
3031 if (PROFILE_MODEL_P (current_cpu))
3033 m32rx_model_profile_insn (current_cpu, abuf);
3041 /* Perform macwu1: macwu1 $src1,$src2. */
3043 SEM_FN_NAME (m32rx,macwu1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3045 insn_t insn = SEM_INSN (sem_arg);
3046 #define OPRND(f) par_exec->operands.fmt_51_macwu1.f
3047 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3048 CIA new_pc = CPU (h_pc) + 2;
3049 EXTRACT_FMT_51_MACWU1_VARS /* f-op1 f-r1 f-op2 f-r2 */
3050 EXTRACT_FMT_51_MACWU1_CODE
3052 m32rx_h_accums_set (current_cpu, 1, SRADI (SLLDI (ADDDI (OPRND (h_accums_1), MULDI (EXTSIDI (OPRND (src1)), EXTSIDI (ANDSI (OPRND (src2), 65535)))), 8), 8));
3053 TRACE_RESULT (current_cpu, "h-accums-1", 'D', m32rx_h_accums_get (current_cpu, 1));
3055 #if WITH_PROFILE_MODEL_P
3056 if (PROFILE_MODEL_P (current_cpu))
3058 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3059 m32rx_model_profile_insn (current_cpu, abuf);
3067 /* Perform msblo: msblo $src1,$src2. */
3069 SEM_FN_NAME (m32rx,msblo) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3071 insn_t insn = SEM_INSN (sem_arg);
3072 #define OPRND(f) par_exec->operands.fmt_52_msblo.f
3073 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3074 CIA new_pc = CPU (h_pc) + 2;
3075 EXTRACT_FMT_52_MSBLO_VARS /* f-op1 f-r1 f-op2 f-r2 */
3076 EXTRACT_FMT_52_MSBLO_CODE
3078 CPU (h_accum) = SRADI (SLLDI (SUBDI (OPRND (accum), SRADI (SLLDI (MULDI (EXTHIDI (TRUNCSIHI (OPRND (src1))), EXTHIDI (TRUNCSIHI (OPRND (src2)))), 32), 16)), 8), 8);
3079 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
3081 #if WITH_PROFILE_MODEL_P
3082 if (PROFILE_MODEL_P (current_cpu))
3084 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3085 m32rx_model_profile_insn (current_cpu, abuf);
3093 /* Perform mulwu1: mulwu1 $src1,$src2. */
3095 SEM_FN_NAME (m32rx,mulwu1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3097 insn_t insn = SEM_INSN (sem_arg);
3098 #define OPRND(f) par_exec->operands.fmt_17_cmp.f
3099 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3100 CIA new_pc = CPU (h_pc) + 2;
3101 EXTRACT_FMT_17_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
3102 EXTRACT_FMT_17_CMP_CODE
3104 m32rx_h_accums_set (current_cpu, 1, SRADI (SLLDI (MULDI (EXTSIDI (OPRND (src1)), EXTSIDI (ANDSI (OPRND (src2), 65535))), 16), 16));
3105 TRACE_RESULT (current_cpu, "h-accums-1", 'D', m32rx_h_accums_get (current_cpu, 1));
3107 #if WITH_PROFILE_MODEL_P
3108 if (PROFILE_MODEL_P (current_cpu))
3110 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3111 m32rx_model_profile_insn (current_cpu, abuf);
3119 /* Perform machl1: machl1 $src1,$src2. */
3121 SEM_FN_NAME (m32rx,machl1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3123 insn_t insn = SEM_INSN (sem_arg);
3124 #define OPRND(f) par_exec->operands.fmt_51_macwu1.f
3125 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3126 CIA new_pc = CPU (h_pc) + 2;
3127 EXTRACT_FMT_51_MACWU1_VARS /* f-op1 f-r1 f-op2 f-r2 */
3128 EXTRACT_FMT_51_MACWU1_CODE
3130 m32rx_h_accums_set (current_cpu, 1, SRADI (SLLDI (ADDDI (OPRND (h_accums_1), SRADI (SLLDI (MULDI (EXTSIDI (SRASI (OPRND (src1), 16)), EXTHIDI (TRUNCSIHI (OPRND (src2)))), 32), 16)), 8), 8));
3131 TRACE_RESULT (current_cpu, "h-accums-1", 'D', m32rx_h_accums_get (current_cpu, 1));
3133 #if WITH_PROFILE_MODEL_P
3134 if (PROFILE_MODEL_P (current_cpu))
3136 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3137 m32rx_model_profile_insn (current_cpu, abuf);
3145 /* Perform sc: sc. */
3147 SEM_FN_NAME (m32rx,sc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3149 insn_t insn = SEM_INSN (sem_arg);
3150 #define OPRND(f) par_exec->operands.fmt_53_sc.f
3151 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3152 CIA new_pc = CPU (h_pc) + 2;
3153 EXTRACT_FMT_53_SC_VARS /* f-op1 f-r1 f-op2 f-r2 */
3154 EXTRACT_FMT_53_SC_CODE
3156 if (OPRND (condbit)) {
3158 TRACE_RESULT (current_cpu, "abort-parallel-execution", 'x', CPU (h_abort));
3161 #if WITH_PROFILE_MODEL_P
3162 if (PROFILE_MODEL_P (current_cpu))
3164 m32rx_model_profile_insn (current_cpu, abuf);
3172 /* Perform snc: snc. */
3174 SEM_FN_NAME (m32rx,snc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3176 insn_t insn = SEM_INSN (sem_arg);
3177 #define OPRND(f) par_exec->operands.fmt_53_sc.f
3178 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3179 CIA new_pc = CPU (h_pc) + 2;
3180 EXTRACT_FMT_53_SC_VARS /* f-op1 f-r1 f-op2 f-r2 */
3181 EXTRACT_FMT_53_SC_CODE
3183 if (NOTBI (OPRND (condbit))) {
3185 TRACE_RESULT (current_cpu, "abort-parallel-execution", 'x', CPU (h_abort));
3188 #if WITH_PROFILE_MODEL_P
3189 if (PROFILE_MODEL_P (current_cpu))
3191 m32rx_model_profile_insn (current_cpu, abuf);
3200 SEM_FN_NAME (m32rx,illegal) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3202 sim_engine_illegal_insn (current_cpu, NULL_CIA /*FIXME*/);
3206 #endif /* ! defined (SCACHE_P) || (defined (SCACHE_P) && WITH_SCACHE) */