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 = SEM_NEXT_PC (sem_arg, 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 = SEM_NEXT_PC (sem_arg, 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 = SEM_NEXT_PC (sem_arg, 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 = SEM_NEXT_PC (sem_arg, 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 = SEM_NEXT_PC (sem_arg, 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 = SEM_NEXT_PC (sem_arg, 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 = SEM_NEXT_PC (sem_arg, 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 = SEM_NEXT_PC (sem_arg, 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 = SEM_NEXT_PC (sem_arg, 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_5_addv.f
287 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
288 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
289 EXTRACT_FMT_5_ADDV_VARS /* f-op1 f-r1 f-op2 f-r2 */
290 EXTRACT_FMT_5_ADDV_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_6_addv3.f
321 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
322 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
323 EXTRACT_FMT_6_ADDV3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
324 EXTRACT_FMT_6_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_7_addx.f
355 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
356 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
357 EXTRACT_FMT_7_ADDX_VARS /* f-op1 f-r1 f-op2 f-r2 */
358 EXTRACT_FMT_7_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_8_bc8.f
389 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
390 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
392 EXTRACT_FMT_8_BC8_VARS /* f-op1 f-r1 f-disp8 */
393 EXTRACT_FMT_8_BC8_CODE
395 if (OPRND (condbit)) {
396 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
397 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
400 #if WITH_PROFILE_MODEL_P
401 if (PROFILE_MODEL_P (current_cpu))
403 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
411 /* Perform bc24: bc $disp24. */
413 SEM_FN_NAME (m32rx,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
415 insn_t insn = SEM_INSN (sem_arg);
416 #define OPRND(f) par_exec->operands.fmt_9_bc24.f
417 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
418 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
420 EXTRACT_FMT_9_BC24_VARS /* f-op1 f-r1 f-disp24 */
421 EXTRACT_FMT_9_BC24_CODE
423 if (OPRND (condbit)) {
424 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
425 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
428 #if WITH_PROFILE_MODEL_P
429 if (PROFILE_MODEL_P (current_cpu))
431 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
439 /* Perform beq: beq $src1,$src2,$disp16. */
441 SEM_FN_NAME (m32rx,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
443 insn_t insn = SEM_INSN (sem_arg);
444 #define OPRND(f) par_exec->operands.fmt_10_beq.f
445 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
446 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
448 EXTRACT_FMT_10_BEQ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
449 EXTRACT_FMT_10_BEQ_CODE
451 if (EQSI (OPRND (src1), OPRND (src2))) {
452 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
453 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
456 #if WITH_PROFILE_MODEL_P
457 if (PROFILE_MODEL_P (current_cpu))
459 m32rx_model_mark_get_h_gr (current_cpu, abuf);
460 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
468 /* Perform beqz: beqz $src2,$disp16. */
470 SEM_FN_NAME (m32rx,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
472 insn_t insn = SEM_INSN (sem_arg);
473 #define OPRND(f) par_exec->operands.fmt_11_beqz.f
474 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
475 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
477 EXTRACT_FMT_11_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
478 EXTRACT_FMT_11_BEQZ_CODE
480 if (EQSI (OPRND (src2), 0)) {
481 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
482 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
485 #if WITH_PROFILE_MODEL_P
486 if (PROFILE_MODEL_P (current_cpu))
488 m32rx_model_mark_get_h_gr (current_cpu, abuf);
489 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
497 /* Perform bgez: bgez $src2,$disp16. */
499 SEM_FN_NAME (m32rx,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
501 insn_t insn = SEM_INSN (sem_arg);
502 #define OPRND(f) par_exec->operands.fmt_11_beqz.f
503 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
504 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
506 EXTRACT_FMT_11_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
507 EXTRACT_FMT_11_BEQZ_CODE
509 if (GESI (OPRND (src2), 0)) {
510 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
511 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
514 #if WITH_PROFILE_MODEL_P
515 if (PROFILE_MODEL_P (current_cpu))
517 m32rx_model_mark_get_h_gr (current_cpu, abuf);
518 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
526 /* Perform bgtz: bgtz $src2,$disp16. */
528 SEM_FN_NAME (m32rx,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
530 insn_t insn = SEM_INSN (sem_arg);
531 #define OPRND(f) par_exec->operands.fmt_11_beqz.f
532 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
533 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
535 EXTRACT_FMT_11_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
536 EXTRACT_FMT_11_BEQZ_CODE
538 if (GTSI (OPRND (src2), 0)) {
539 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
540 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
543 #if WITH_PROFILE_MODEL_P
544 if (PROFILE_MODEL_P (current_cpu))
546 m32rx_model_mark_get_h_gr (current_cpu, abuf);
547 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
555 /* Perform blez: blez $src2,$disp16. */
557 SEM_FN_NAME (m32rx,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
559 insn_t insn = SEM_INSN (sem_arg);
560 #define OPRND(f) par_exec->operands.fmt_11_beqz.f
561 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
562 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
564 EXTRACT_FMT_11_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
565 EXTRACT_FMT_11_BEQZ_CODE
567 if (LESI (OPRND (src2), 0)) {
568 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
569 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
572 #if WITH_PROFILE_MODEL_P
573 if (PROFILE_MODEL_P (current_cpu))
575 m32rx_model_mark_get_h_gr (current_cpu, abuf);
576 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
584 /* Perform bltz: bltz $src2,$disp16. */
586 SEM_FN_NAME (m32rx,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
588 insn_t insn = SEM_INSN (sem_arg);
589 #define OPRND(f) par_exec->operands.fmt_11_beqz.f
590 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
591 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
593 EXTRACT_FMT_11_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
594 EXTRACT_FMT_11_BEQZ_CODE
596 if (LTSI (OPRND (src2), 0)) {
597 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
598 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
601 #if WITH_PROFILE_MODEL_P
602 if (PROFILE_MODEL_P (current_cpu))
604 m32rx_model_mark_get_h_gr (current_cpu, abuf);
605 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
613 /* Perform bnez: bnez $src2,$disp16. */
615 SEM_FN_NAME (m32rx,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
617 insn_t insn = SEM_INSN (sem_arg);
618 #define OPRND(f) par_exec->operands.fmt_11_beqz.f
619 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
620 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
622 EXTRACT_FMT_11_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
623 EXTRACT_FMT_11_BEQZ_CODE
625 if (NESI (OPRND (src2), 0)) {
626 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
627 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
630 #if WITH_PROFILE_MODEL_P
631 if (PROFILE_MODEL_P (current_cpu))
633 m32rx_model_mark_get_h_gr (current_cpu, abuf);
634 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
642 /* Perform bl8: bl $disp8. */
644 SEM_FN_NAME (m32rx,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
646 insn_t insn = SEM_INSN (sem_arg);
647 #define OPRND(f) par_exec->operands.fmt_12_bl8.f
648 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
649 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
651 EXTRACT_FMT_12_BL8_VARS /* f-op1 f-r1 f-disp8 */
652 EXTRACT_FMT_12_BL8_CODE
655 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
656 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
657 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (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 m32rx_model_mark_set_h_gr (current_cpu, abuf);
665 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
673 /* Perform bl24: bl $disp24. */
675 SEM_FN_NAME (m32rx,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
677 insn_t insn = SEM_INSN (sem_arg);
678 #define OPRND(f) par_exec->operands.fmt_13_bl24.f
679 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
680 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
682 EXTRACT_FMT_13_BL24_VARS /* f-op1 f-r1 f-disp24 */
683 EXTRACT_FMT_13_BL24_CODE
686 CPU (h_gr[14]) = ADDSI (OPRND (pc), 4);
687 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
688 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
689 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
692 #if WITH_PROFILE_MODEL_P
693 if (PROFILE_MODEL_P (current_cpu))
695 m32rx_model_mark_set_h_gr (current_cpu, abuf);
696 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
704 /* Perform bcl8: bcl $disp8. */
706 SEM_FN_NAME (m32rx,bcl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
708 insn_t insn = SEM_INSN (sem_arg);
709 #define OPRND(f) par_exec->operands.fmt_14_bcl8.f
710 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
711 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
713 EXTRACT_FMT_14_BCL8_VARS /* f-op1 f-r1 f-disp8 */
714 EXTRACT_FMT_14_BCL8_CODE
716 if (OPRND (condbit)) {
718 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
719 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
720 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
721 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
725 #if WITH_PROFILE_MODEL_P
726 if (PROFILE_MODEL_P (current_cpu))
728 m32rx_model_mark_set_h_gr (current_cpu, abuf);
729 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
737 /* Perform bcl24: bcl $disp24. */
739 SEM_FN_NAME (m32rx,bcl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
741 insn_t insn = SEM_INSN (sem_arg);
742 #define OPRND(f) par_exec->operands.fmt_15_bcl24.f
743 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
744 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
746 EXTRACT_FMT_15_BCL24_VARS /* f-op1 f-r1 f-disp24 */
747 EXTRACT_FMT_15_BCL24_CODE
749 if (OPRND (condbit)) {
751 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
752 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
753 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
754 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
758 #if WITH_PROFILE_MODEL_P
759 if (PROFILE_MODEL_P (current_cpu))
761 m32rx_model_mark_set_h_gr (current_cpu, abuf);
762 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
770 /* Perform bnc8: bnc $disp8. */
772 SEM_FN_NAME (m32rx,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
774 insn_t insn = SEM_INSN (sem_arg);
775 #define OPRND(f) par_exec->operands.fmt_8_bc8.f
776 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
777 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
779 EXTRACT_FMT_8_BC8_VARS /* f-op1 f-r1 f-disp8 */
780 EXTRACT_FMT_8_BC8_CODE
782 if (NOTBI (OPRND (condbit))) {
783 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
784 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
787 #if WITH_PROFILE_MODEL_P
788 if (PROFILE_MODEL_P (current_cpu))
790 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
798 /* Perform bnc24: bnc $disp24. */
800 SEM_FN_NAME (m32rx,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
802 insn_t insn = SEM_INSN (sem_arg);
803 #define OPRND(f) par_exec->operands.fmt_9_bc24.f
804 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
805 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
807 EXTRACT_FMT_9_BC24_VARS /* f-op1 f-r1 f-disp24 */
808 EXTRACT_FMT_9_BC24_CODE
810 if (NOTBI (OPRND (condbit))) {
811 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
812 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
815 #if WITH_PROFILE_MODEL_P
816 if (PROFILE_MODEL_P (current_cpu))
818 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
826 /* Perform bne: bne $src1,$src2,$disp16. */
828 SEM_FN_NAME (m32rx,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
830 insn_t insn = SEM_INSN (sem_arg);
831 #define OPRND(f) par_exec->operands.fmt_10_beq.f
832 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
833 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
835 EXTRACT_FMT_10_BEQ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */
836 EXTRACT_FMT_10_BEQ_CODE
838 if (NESI (OPRND (src1), OPRND (src2))) {
839 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp16)));
840 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
843 #if WITH_PROFILE_MODEL_P
844 if (PROFILE_MODEL_P (current_cpu))
846 m32rx_model_mark_get_h_gr (current_cpu, abuf);
847 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
855 /* Perform bra8: bra $disp8. */
857 SEM_FN_NAME (m32rx,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
859 insn_t insn = SEM_INSN (sem_arg);
860 #define OPRND(f) par_exec->operands.fmt_16_bra8.f
861 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
862 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
864 EXTRACT_FMT_16_BRA8_VARS /* f-op1 f-r1 f-disp8 */
865 EXTRACT_FMT_16_BRA8_CODE
867 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
868 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
870 #if WITH_PROFILE_MODEL_P
871 if (PROFILE_MODEL_P (current_cpu))
873 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
881 /* Perform bra24: bra $disp24. */
883 SEM_FN_NAME (m32rx,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
885 insn_t insn = SEM_INSN (sem_arg);
886 #define OPRND(f) par_exec->operands.fmt_17_bra24.f
887 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
888 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
890 EXTRACT_FMT_17_BRA24_VARS /* f-op1 f-r1 f-disp24 */
891 EXTRACT_FMT_17_BRA24_CODE
893 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
894 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
896 #if WITH_PROFILE_MODEL_P
897 if (PROFILE_MODEL_P (current_cpu))
899 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
907 /* Perform bncl8: bncl $disp8. */
909 SEM_FN_NAME (m32rx,bncl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
911 insn_t insn = SEM_INSN (sem_arg);
912 #define OPRND(f) par_exec->operands.fmt_14_bcl8.f
913 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
914 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
916 EXTRACT_FMT_14_BCL8_VARS /* f-op1 f-r1 f-disp8 */
917 EXTRACT_FMT_14_BCL8_CODE
919 if (NOTBI (OPRND (condbit))) {
921 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
922 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
923 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp8)));
924 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
928 #if WITH_PROFILE_MODEL_P
929 if (PROFILE_MODEL_P (current_cpu))
931 m32rx_model_mark_set_h_gr (current_cpu, abuf);
932 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
940 /* Perform bncl24: bncl $disp24. */
942 SEM_FN_NAME (m32rx,bncl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
944 insn_t insn = SEM_INSN (sem_arg);
945 #define OPRND(f) par_exec->operands.fmt_15_bcl24.f
946 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
947 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
949 EXTRACT_FMT_15_BCL24_VARS /* f-op1 f-r1 f-disp24 */
950 EXTRACT_FMT_15_BCL24_CODE
952 if (NOTBI (OPRND (condbit))) {
954 CPU (h_gr[14]) = ADDSI (ANDSI (OPRND (pc), -4), 4);
955 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
956 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, OPRND (disp24)));
957 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
961 #if WITH_PROFILE_MODEL_P
962 if (PROFILE_MODEL_P (current_cpu))
964 m32rx_model_mark_set_h_gr (current_cpu, abuf);
965 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
973 /* Perform cmp: cmp $src1,$src2. */
975 SEM_FN_NAME (m32rx,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
977 insn_t insn = SEM_INSN (sem_arg);
978 #define OPRND(f) par_exec->operands.fmt_18_cmp.f
979 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
980 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
981 EXTRACT_FMT_18_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
982 EXTRACT_FMT_18_CMP_CODE
984 CPU (h_cond) = LTSI (OPRND (src1), OPRND (src2));
985 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
987 #if WITH_PROFILE_MODEL_P
988 if (PROFILE_MODEL_P (current_cpu))
990 m32rx_model_mark_get_h_gr (current_cpu, abuf);
991 m32rx_model_profile_insn (current_cpu, abuf);
999 /* Perform cmpi: cmpi $src2,#$simm16. */
1001 SEM_FN_NAME (m32rx,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1003 insn_t insn = SEM_INSN (sem_arg);
1004 #define OPRND(f) par_exec->operands.fmt_19_cmpi.f
1005 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1006 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1007 EXTRACT_FMT_19_CMPI_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1008 EXTRACT_FMT_19_CMPI_CODE
1010 CPU (h_cond) = LTSI (OPRND (src2), OPRND (simm16));
1011 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1013 #if WITH_PROFILE_MODEL_P
1014 if (PROFILE_MODEL_P (current_cpu))
1016 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1017 m32rx_model_profile_insn (current_cpu, abuf);
1025 /* Perform cmpu: cmpu $src1,$src2. */
1027 SEM_FN_NAME (m32rx,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1029 insn_t insn = SEM_INSN (sem_arg);
1030 #define OPRND(f) par_exec->operands.fmt_18_cmp.f
1031 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1032 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1033 EXTRACT_FMT_18_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
1034 EXTRACT_FMT_18_CMP_CODE
1036 CPU (h_cond) = LTUSI (OPRND (src1), OPRND (src2));
1037 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1039 #if WITH_PROFILE_MODEL_P
1040 if (PROFILE_MODEL_P (current_cpu))
1042 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1043 m32rx_model_profile_insn (current_cpu, abuf);
1051 /* Perform cmpui: cmpui $src2,#$uimm16. */
1053 SEM_FN_NAME (m32rx,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1055 insn_t insn = SEM_INSN (sem_arg);
1056 #define OPRND(f) par_exec->operands.fmt_20_cmpui.f
1057 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1058 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1059 EXTRACT_FMT_20_CMPUI_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
1060 EXTRACT_FMT_20_CMPUI_CODE
1062 CPU (h_cond) = LTUSI (OPRND (src2), OPRND (uimm16));
1063 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1065 #if WITH_PROFILE_MODEL_P
1066 if (PROFILE_MODEL_P (current_cpu))
1068 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1069 m32rx_model_profile_insn (current_cpu, abuf);
1077 /* Perform cmpeq: cmpeq $src1,$src2. */
1079 SEM_FN_NAME (m32rx,cmpeq) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1081 insn_t insn = SEM_INSN (sem_arg);
1082 #define OPRND(f) par_exec->operands.fmt_18_cmp.f
1083 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1084 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1085 EXTRACT_FMT_18_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
1086 EXTRACT_FMT_18_CMP_CODE
1088 CPU (h_cond) = EQSI (OPRND (src1), OPRND (src2));
1089 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1091 #if WITH_PROFILE_MODEL_P
1092 if (PROFILE_MODEL_P (current_cpu))
1094 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1095 m32rx_model_profile_insn (current_cpu, abuf);
1103 /* Perform cmpz: cmpz $src2. */
1105 SEM_FN_NAME (m32rx,cmpz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1107 insn_t insn = SEM_INSN (sem_arg);
1108 #define OPRND(f) par_exec->operands.fmt_21_cmpz.f
1109 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1110 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1111 EXTRACT_FMT_21_CMPZ_VARS /* f-op1 f-r1 f-op2 f-r2 */
1112 EXTRACT_FMT_21_CMPZ_CODE
1114 CPU (h_cond) = EQSI (OPRND (src2), 0);
1115 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
1117 #if WITH_PROFILE_MODEL_P
1118 if (PROFILE_MODEL_P (current_cpu))
1120 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1121 m32rx_model_profile_insn (current_cpu, abuf);
1129 /* Perform div: div $dr,$sr. */
1131 SEM_FN_NAME (m32rx,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1133 insn_t insn = SEM_INSN (sem_arg);
1134 #define OPRND(f) par_exec->operands.fmt_22_div.f
1135 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1136 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1137 EXTRACT_FMT_22_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1138 EXTRACT_FMT_22_DIV_CODE
1140 if (NESI (OPRND (sr), 0)) {
1141 CPU (h_gr[f_r1]) = DIVSI (OPRND (dr), OPRND (sr));
1142 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1145 #if WITH_PROFILE_MODEL_P
1146 if (PROFILE_MODEL_P (current_cpu))
1148 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1149 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1150 m32rx_model_profile_insn (current_cpu, abuf);
1158 /* Perform divu: divu $dr,$sr. */
1160 SEM_FN_NAME (m32rx,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1162 insn_t insn = SEM_INSN (sem_arg);
1163 #define OPRND(f) par_exec->operands.fmt_22_div.f
1164 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1165 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1166 EXTRACT_FMT_22_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1167 EXTRACT_FMT_22_DIV_CODE
1169 if (NESI (OPRND (sr), 0)) {
1170 CPU (h_gr[f_r1]) = UDIVSI (OPRND (dr), OPRND (sr));
1171 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1174 #if WITH_PROFILE_MODEL_P
1175 if (PROFILE_MODEL_P (current_cpu))
1177 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1178 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1179 m32rx_model_profile_insn (current_cpu, abuf);
1187 /* Perform rem: rem $dr,$sr. */
1189 SEM_FN_NAME (m32rx,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1191 insn_t insn = SEM_INSN (sem_arg);
1192 #define OPRND(f) par_exec->operands.fmt_22_div.f
1193 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1194 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1195 EXTRACT_FMT_22_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1196 EXTRACT_FMT_22_DIV_CODE
1198 if (NESI (OPRND (sr), 0)) {
1199 CPU (h_gr[f_r1]) = MODSI (OPRND (dr), OPRND (sr));
1200 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1203 #if WITH_PROFILE_MODEL_P
1204 if (PROFILE_MODEL_P (current_cpu))
1206 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1207 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1208 m32rx_model_profile_insn (current_cpu, abuf);
1216 /* Perform remu: remu $dr,$sr. */
1218 SEM_FN_NAME (m32rx,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1220 insn_t insn = SEM_INSN (sem_arg);
1221 #define OPRND(f) par_exec->operands.fmt_22_div.f
1222 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1223 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1224 EXTRACT_FMT_22_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1225 EXTRACT_FMT_22_DIV_CODE
1227 if (NESI (OPRND (sr), 0)) {
1228 CPU (h_gr[f_r1]) = UMODSI (OPRND (dr), OPRND (sr));
1229 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1232 #if WITH_PROFILE_MODEL_P
1233 if (PROFILE_MODEL_P (current_cpu))
1235 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1236 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1237 m32rx_model_profile_insn (current_cpu, abuf);
1245 /* Perform divh: divh $dr,$sr. */
1247 SEM_FN_NAME (m32rx,divh) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1249 insn_t insn = SEM_INSN (sem_arg);
1250 #define OPRND(f) par_exec->operands.fmt_22_div.f
1251 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1252 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1253 EXTRACT_FMT_22_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1254 EXTRACT_FMT_22_DIV_CODE
1256 if (NESI (OPRND (sr), 0)) {
1257 CPU (h_gr[f_r1]) = DIVSI (EXTHISI (TRUNCSIHI (OPRND (dr))), OPRND (sr));
1258 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1261 #if WITH_PROFILE_MODEL_P
1262 if (PROFILE_MODEL_P (current_cpu))
1264 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1265 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1266 m32rx_model_profile_insn (current_cpu, abuf);
1274 /* Perform jc: jc $sr. */
1276 SEM_FN_NAME (m32rx,jc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1278 insn_t insn = SEM_INSN (sem_arg);
1279 #define OPRND(f) par_exec->operands.fmt_23_jc.f
1280 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1281 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1283 EXTRACT_FMT_23_JC_VARS /* f-op1 f-r1 f-op2 f-r2 */
1284 EXTRACT_FMT_23_JC_CODE
1286 if (OPRND (condbit)) {
1287 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, ANDSI (OPRND (sr), -4)));
1288 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
1291 #if WITH_PROFILE_MODEL_P
1292 if (PROFILE_MODEL_P (current_cpu))
1294 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1295 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
1303 /* Perform jnc: jnc $sr. */
1305 SEM_FN_NAME (m32rx,jnc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1307 insn_t insn = SEM_INSN (sem_arg);
1308 #define OPRND(f) par_exec->operands.fmt_23_jc.f
1309 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1310 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1312 EXTRACT_FMT_23_JC_VARS /* f-op1 f-r1 f-op2 f-r2 */
1313 EXTRACT_FMT_23_JC_CODE
1315 if (NOTBI (OPRND (condbit))) {
1316 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, ANDSI (OPRND (sr), -4)));
1317 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
1320 #if WITH_PROFILE_MODEL_P
1321 if (PROFILE_MODEL_P (current_cpu))
1323 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1324 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
1332 /* Perform jl: jl $sr. */
1334 SEM_FN_NAME (m32rx,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1336 insn_t insn = SEM_INSN (sem_arg);
1337 #define OPRND(f) par_exec->operands.fmt_24_jl.f
1338 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1339 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1341 EXTRACT_FMT_24_JL_VARS /* f-op1 f-r1 f-op2 f-r2 */
1342 EXTRACT_FMT_24_JL_CODE
1346 temp0 = ADDSI (ANDSI (OPRND (pc), -4), 4);
1348 CPU (h_gr[14]) = temp0;
1349 TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14]));
1350 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, temp1));
1351 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
1354 #if WITH_PROFILE_MODEL_P
1355 if (PROFILE_MODEL_P (current_cpu))
1357 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1358 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1359 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
1367 /* Perform jmp: jmp $sr. */
1369 SEM_FN_NAME (m32rx,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1371 insn_t insn = SEM_INSN (sem_arg);
1372 #define OPRND(f) par_exec->operands.fmt_25_jmp.f
1373 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1374 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1376 EXTRACT_FMT_25_JMP_VARS /* f-op1 f-r1 f-op2 f-r2 */
1377 EXTRACT_FMT_25_JMP_CODE
1379 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, OPRND (sr)));
1380 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
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_profile_cti_insn (current_cpu, abuf, taken_p);
1394 /* Perform ld: ld $dr,@$sr. */
1396 SEM_FN_NAME (m32rx,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1398 insn_t insn = SEM_INSN (sem_arg);
1399 #define OPRND(f) par_exec->operands.fmt_26_ld.f
1400 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1401 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1402 EXTRACT_FMT_26_LD_VARS /* f-op1 f-r1 f-op2 f-r2 */
1403 EXTRACT_FMT_26_LD_CODE
1405 CPU (h_gr[f_r1]) = OPRND (h_memory_sr);
1406 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1408 #if WITH_PROFILE_MODEL_P
1409 if (PROFILE_MODEL_P (current_cpu))
1411 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1412 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1413 m32rx_model_profile_insn (current_cpu, abuf);
1421 /* Perform ld-d: ld $dr,@($slo16,$sr). */
1423 SEM_FN_NAME (m32rx,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1425 insn_t insn = SEM_INSN (sem_arg);
1426 #define OPRND(f) par_exec->operands.fmt_27_ld_d.f
1427 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1428 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1429 EXTRACT_FMT_27_LD_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1430 EXTRACT_FMT_27_LD_D_CODE
1432 CPU (h_gr[f_r1]) = OPRND (h_memory_add_WI_sr_slo16);
1433 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1435 #if WITH_PROFILE_MODEL_P
1436 if (PROFILE_MODEL_P (current_cpu))
1438 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1439 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1440 m32rx_model_profile_insn (current_cpu, abuf);
1448 /* Perform ldb: ldb $dr,@$sr. */
1450 SEM_FN_NAME (m32rx,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1452 insn_t insn = SEM_INSN (sem_arg);
1453 #define OPRND(f) par_exec->operands.fmt_28_ldb.f
1454 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1455 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1456 EXTRACT_FMT_28_LDB_VARS /* f-op1 f-r1 f-op2 f-r2 */
1457 EXTRACT_FMT_28_LDB_CODE
1459 CPU (h_gr[f_r1]) = EXTQISI (OPRND (h_memory_sr));
1460 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1462 #if WITH_PROFILE_MODEL_P
1463 if (PROFILE_MODEL_P (current_cpu))
1465 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1466 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1467 m32rx_model_profile_insn (current_cpu, abuf);
1475 /* Perform ldb-d: ldb $dr,@($slo16,$sr). */
1477 SEM_FN_NAME (m32rx,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1479 insn_t insn = SEM_INSN (sem_arg);
1480 #define OPRND(f) par_exec->operands.fmt_29_ldb_d.f
1481 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1482 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1483 EXTRACT_FMT_29_LDB_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1484 EXTRACT_FMT_29_LDB_D_CODE
1486 CPU (h_gr[f_r1]) = EXTQISI (OPRND (h_memory_add_WI_sr_slo16));
1487 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1489 #if WITH_PROFILE_MODEL_P
1490 if (PROFILE_MODEL_P (current_cpu))
1492 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1493 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1494 m32rx_model_profile_insn (current_cpu, abuf);
1502 /* Perform ldh: ldh $dr,@$sr. */
1504 SEM_FN_NAME (m32rx,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1506 insn_t insn = SEM_INSN (sem_arg);
1507 #define OPRND(f) par_exec->operands.fmt_30_ldh.f
1508 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1509 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1510 EXTRACT_FMT_30_LDH_VARS /* f-op1 f-r1 f-op2 f-r2 */
1511 EXTRACT_FMT_30_LDH_CODE
1513 CPU (h_gr[f_r1]) = EXTHISI (OPRND (h_memory_sr));
1514 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1516 #if WITH_PROFILE_MODEL_P
1517 if (PROFILE_MODEL_P (current_cpu))
1519 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1520 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1521 m32rx_model_profile_insn (current_cpu, abuf);
1529 /* Perform ldh-d: ldh $dr,@($slo16,$sr). */
1531 SEM_FN_NAME (m32rx,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1533 insn_t insn = SEM_INSN (sem_arg);
1534 #define OPRND(f) par_exec->operands.fmt_31_ldh_d.f
1535 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1536 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1537 EXTRACT_FMT_31_LDH_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1538 EXTRACT_FMT_31_LDH_D_CODE
1540 CPU (h_gr[f_r1]) = EXTHISI (OPRND (h_memory_add_WI_sr_slo16));
1541 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1543 #if WITH_PROFILE_MODEL_P
1544 if (PROFILE_MODEL_P (current_cpu))
1546 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1547 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1548 m32rx_model_profile_insn (current_cpu, abuf);
1556 /* Perform ldub: ldub $dr,@$sr. */
1558 SEM_FN_NAME (m32rx,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1560 insn_t insn = SEM_INSN (sem_arg);
1561 #define OPRND(f) par_exec->operands.fmt_28_ldb.f
1562 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1563 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1564 EXTRACT_FMT_28_LDB_VARS /* f-op1 f-r1 f-op2 f-r2 */
1565 EXTRACT_FMT_28_LDB_CODE
1567 CPU (h_gr[f_r1]) = ZEXTQISI (OPRND (h_memory_sr));
1568 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1570 #if WITH_PROFILE_MODEL_P
1571 if (PROFILE_MODEL_P (current_cpu))
1573 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1574 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1575 m32rx_model_profile_insn (current_cpu, abuf);
1583 /* Perform ldub-d: ldub $dr,@($slo16,$sr). */
1585 SEM_FN_NAME (m32rx,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1587 insn_t insn = SEM_INSN (sem_arg);
1588 #define OPRND(f) par_exec->operands.fmt_29_ldb_d.f
1589 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1590 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1591 EXTRACT_FMT_29_LDB_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1592 EXTRACT_FMT_29_LDB_D_CODE
1594 CPU (h_gr[f_r1]) = ZEXTQISI (OPRND (h_memory_add_WI_sr_slo16));
1595 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1597 #if WITH_PROFILE_MODEL_P
1598 if (PROFILE_MODEL_P (current_cpu))
1600 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1601 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1602 m32rx_model_profile_insn (current_cpu, abuf);
1610 /* Perform lduh: lduh $dr,@$sr. */
1612 SEM_FN_NAME (m32rx,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1614 insn_t insn = SEM_INSN (sem_arg);
1615 #define OPRND(f) par_exec->operands.fmt_30_ldh.f
1616 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1617 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1618 EXTRACT_FMT_30_LDH_VARS /* f-op1 f-r1 f-op2 f-r2 */
1619 EXTRACT_FMT_30_LDH_CODE
1621 CPU (h_gr[f_r1]) = ZEXTHISI (OPRND (h_memory_sr));
1622 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1624 #if WITH_PROFILE_MODEL_P
1625 if (PROFILE_MODEL_P (current_cpu))
1627 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1628 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1629 m32rx_model_profile_insn (current_cpu, abuf);
1637 /* Perform lduh-d: lduh $dr,@($slo16,$sr). */
1639 SEM_FN_NAME (m32rx,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1641 insn_t insn = SEM_INSN (sem_arg);
1642 #define OPRND(f) par_exec->operands.fmt_31_ldh_d.f
1643 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1644 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1645 EXTRACT_FMT_31_LDH_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1646 EXTRACT_FMT_31_LDH_D_CODE
1648 CPU (h_gr[f_r1]) = ZEXTHISI (OPRND (h_memory_add_WI_sr_slo16));
1649 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1651 #if WITH_PROFILE_MODEL_P
1652 if (PROFILE_MODEL_P (current_cpu))
1654 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1655 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1656 m32rx_model_profile_insn (current_cpu, abuf);
1664 /* Perform ld-plus: ld $dr,@$sr+. */
1666 SEM_FN_NAME (m32rx,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1668 insn_t insn = SEM_INSN (sem_arg);
1669 #define OPRND(f) par_exec->operands.fmt_32_ld_plus.f
1670 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1671 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1672 EXTRACT_FMT_32_LD_PLUS_VARS /* f-op1 f-r1 f-op2 f-r2 */
1673 EXTRACT_FMT_32_LD_PLUS_CODE
1677 temp0 = OPRND (h_memory_sr);
1678 temp1 = ADDSI (OPRND (sr), 4);
1679 CPU (h_gr[f_r1]) = temp0;
1680 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1681 CPU (h_gr[f_r2]) = temp1;
1682 TRACE_RESULT (current_cpu, "sr", 'x', CPU (h_gr[f_r2]));
1685 #if WITH_PROFILE_MODEL_P
1686 if (PROFILE_MODEL_P (current_cpu))
1688 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1689 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1690 m32rx_model_profile_insn (current_cpu, abuf);
1698 /* Perform ld24: ld24 $dr,#$uimm24. */
1700 SEM_FN_NAME (m32rx,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1702 insn_t insn = SEM_INSN (sem_arg);
1703 #define OPRND(f) par_exec->operands.fmt_33_ld24.f
1704 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1705 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1706 EXTRACT_FMT_33_LD24_VARS /* f-op1 f-r1 f-uimm24 */
1707 EXTRACT_FMT_33_LD24_CODE
1709 CPU (h_gr[f_r1]) = OPRND (uimm24);
1710 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1712 #if WITH_PROFILE_MODEL_P
1713 if (PROFILE_MODEL_P (current_cpu))
1715 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1716 m32rx_model_profile_insn (current_cpu, abuf);
1724 /* Perform ldi8: ldi $dr,#$simm8. */
1726 SEM_FN_NAME (m32rx,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1728 insn_t insn = SEM_INSN (sem_arg);
1729 #define OPRND(f) par_exec->operands.fmt_34_ldi8.f
1730 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1731 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1732 EXTRACT_FMT_34_LDI8_VARS /* f-op1 f-r1 f-simm8 */
1733 EXTRACT_FMT_34_LDI8_CODE
1735 CPU (h_gr[f_r1]) = OPRND (simm8);
1736 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1738 #if WITH_PROFILE_MODEL_P
1739 if (PROFILE_MODEL_P (current_cpu))
1741 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1742 m32rx_model_profile_insn (current_cpu, abuf);
1750 /* Perform ldi16: ldi $dr,$slo16. */
1752 SEM_FN_NAME (m32rx,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1754 insn_t insn = SEM_INSN (sem_arg);
1755 #define OPRND(f) par_exec->operands.fmt_35_ldi16.f
1756 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1757 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
1758 EXTRACT_FMT_35_LDI16_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
1759 EXTRACT_FMT_35_LDI16_CODE
1761 CPU (h_gr[f_r1]) = OPRND (slo16);
1762 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1764 #if WITH_PROFILE_MODEL_P
1765 if (PROFILE_MODEL_P (current_cpu))
1767 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1768 m32rx_model_profile_insn (current_cpu, abuf);
1776 /* Perform lock: lock $dr,@$sr. */
1778 SEM_FN_NAME (m32rx,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1780 insn_t insn = SEM_INSN (sem_arg);
1781 #define OPRND(f) par_exec->operands.fmt_36_lock.f
1782 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1783 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1784 EXTRACT_FMT_36_LOCK_VARS /* f-op1 f-r1 f-op2 f-r2 */
1785 EXTRACT_FMT_36_LOCK_CODE
1789 TRACE_RESULT (current_cpu, "h-lock-0", 'x', CPU (h_lock));
1790 CPU (h_gr[f_r1]) = OPRND (h_memory_sr);
1791 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1794 #if WITH_PROFILE_MODEL_P
1795 if (PROFILE_MODEL_P (current_cpu))
1797 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1798 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1799 m32rx_model_profile_insn (current_cpu, abuf);
1807 /* Perform machi-a: machi $src1,$src2,$acc. */
1809 SEM_FN_NAME (m32rx,machi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1811 insn_t insn = SEM_INSN (sem_arg);
1812 #define OPRND(f) par_exec->operands.fmt_37_machi_a.f
1813 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1814 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1815 EXTRACT_FMT_37_MACHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */
1816 EXTRACT_FMT_37_MACHI_A_CODE
1818 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));
1819 TRACE_RESULT (current_cpu, "acc", 'D', m32rx_h_accums_get (current_cpu, f_acc));
1821 #if WITH_PROFILE_MODEL_P
1822 if (PROFILE_MODEL_P (current_cpu))
1824 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1825 m32rx_model_profile_insn (current_cpu, abuf);
1833 /* Perform maclo-a: maclo $src1,$src2,$acc. */
1835 SEM_FN_NAME (m32rx,maclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1837 insn_t insn = SEM_INSN (sem_arg);
1838 #define OPRND(f) par_exec->operands.fmt_37_machi_a.f
1839 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1840 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1841 EXTRACT_FMT_37_MACHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */
1842 EXTRACT_FMT_37_MACHI_A_CODE
1844 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));
1845 TRACE_RESULT (current_cpu, "acc", 'D', m32rx_h_accums_get (current_cpu, f_acc));
1847 #if WITH_PROFILE_MODEL_P
1848 if (PROFILE_MODEL_P (current_cpu))
1850 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1851 m32rx_model_profile_insn (current_cpu, abuf);
1859 /* Perform mul: mul $dr,$sr. */
1861 SEM_FN_NAME (m32rx,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1863 insn_t insn = SEM_INSN (sem_arg);
1864 #define OPRND(f) par_exec->operands.fmt_0_add.f
1865 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1866 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1867 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
1868 EXTRACT_FMT_0_ADD_CODE
1870 CPU (h_gr[f_r1]) = MULSI (OPRND (dr), OPRND (sr));
1871 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1873 #if WITH_PROFILE_MODEL_P
1874 if (PROFILE_MODEL_P (current_cpu))
1876 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1877 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1878 m32rx_model_profile_insn (current_cpu, abuf);
1886 /* Perform mulhi-a: mulhi $src1,$src2,$acc. */
1888 SEM_FN_NAME (m32rx,mulhi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1890 insn_t insn = SEM_INSN (sem_arg);
1891 #define OPRND(f) par_exec->operands.fmt_38_mulhi_a.f
1892 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1893 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1894 EXTRACT_FMT_38_MULHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */
1895 EXTRACT_FMT_38_MULHI_A_CODE
1897 m32rx_h_accums_set (current_cpu, f_acc, SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (OPRND (src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2), 16)))), 16), 16));
1898 TRACE_RESULT (current_cpu, "acc", 'D', m32rx_h_accums_get (current_cpu, f_acc));
1900 #if WITH_PROFILE_MODEL_P
1901 if (PROFILE_MODEL_P (current_cpu))
1903 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1904 m32rx_model_profile_insn (current_cpu, abuf);
1912 /* Perform mullo-a: mullo $src1,$src2,$acc. */
1914 SEM_FN_NAME (m32rx,mullo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1916 insn_t insn = SEM_INSN (sem_arg);
1917 #define OPRND(f) par_exec->operands.fmt_38_mulhi_a.f
1918 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1919 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1920 EXTRACT_FMT_38_MULHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */
1921 EXTRACT_FMT_38_MULHI_A_CODE
1923 m32rx_h_accums_set (current_cpu, f_acc, SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (OPRND (src1), 16)), EXTHIDI (TRUNCSIHI (OPRND (src2)))), 16), 16));
1924 TRACE_RESULT (current_cpu, "acc", 'D', m32rx_h_accums_get (current_cpu, f_acc));
1926 #if WITH_PROFILE_MODEL_P
1927 if (PROFILE_MODEL_P (current_cpu))
1929 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1930 m32rx_model_profile_insn (current_cpu, abuf);
1938 /* Perform mv: mv $dr,$sr. */
1940 SEM_FN_NAME (m32rx,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1942 insn_t insn = SEM_INSN (sem_arg);
1943 #define OPRND(f) par_exec->operands.fmt_39_mv.f
1944 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1945 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1946 EXTRACT_FMT_39_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */
1947 EXTRACT_FMT_39_MV_CODE
1949 CPU (h_gr[f_r1]) = OPRND (sr);
1950 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1952 #if WITH_PROFILE_MODEL_P
1953 if (PROFILE_MODEL_P (current_cpu))
1955 m32rx_model_mark_get_h_gr (current_cpu, abuf);
1956 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1957 m32rx_model_profile_insn (current_cpu, abuf);
1965 /* Perform mvfachi-a: mvfachi $dr,$accs. */
1967 SEM_FN_NAME (m32rx,mvfachi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1969 insn_t insn = SEM_INSN (sem_arg);
1970 #define OPRND(f) par_exec->operands.fmt_40_mvfachi_a.f
1971 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1972 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1973 EXTRACT_FMT_40_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
1974 EXTRACT_FMT_40_MVFACHI_A_CODE
1976 CPU (h_gr[f_r1]) = TRUNCDISI (SRADI (OPRND (accs), 32));
1977 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
1979 #if WITH_PROFILE_MODEL_P
1980 if (PROFILE_MODEL_P (current_cpu))
1982 m32rx_model_mark_set_h_gr (current_cpu, abuf);
1983 m32rx_model_profile_insn (current_cpu, abuf);
1991 /* Perform mvfaclo-a: mvfaclo $dr,$accs. */
1993 SEM_FN_NAME (m32rx,mvfaclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
1995 insn_t insn = SEM_INSN (sem_arg);
1996 #define OPRND(f) par_exec->operands.fmt_40_mvfachi_a.f
1997 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1998 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
1999 EXTRACT_FMT_40_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
2000 EXTRACT_FMT_40_MVFACHI_A_CODE
2002 CPU (h_gr[f_r1]) = TRUNCDISI (OPRND (accs));
2003 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2005 #if WITH_PROFILE_MODEL_P
2006 if (PROFILE_MODEL_P (current_cpu))
2008 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2009 m32rx_model_profile_insn (current_cpu, abuf);
2017 /* Perform mvfacmi-a: mvfacmi $dr,$accs. */
2019 SEM_FN_NAME (m32rx,mvfacmi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2021 insn_t insn = SEM_INSN (sem_arg);
2022 #define OPRND(f) par_exec->operands.fmt_40_mvfachi_a.f
2023 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2024 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2025 EXTRACT_FMT_40_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
2026 EXTRACT_FMT_40_MVFACHI_A_CODE
2028 CPU (h_gr[f_r1]) = TRUNCDISI (SRADI (OPRND (accs), 16));
2029 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2031 #if WITH_PROFILE_MODEL_P
2032 if (PROFILE_MODEL_P (current_cpu))
2034 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2035 m32rx_model_profile_insn (current_cpu, abuf);
2043 /* Perform mvfc: mvfc $dr,$scr. */
2045 SEM_FN_NAME (m32rx,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2047 insn_t insn = SEM_INSN (sem_arg);
2048 #define OPRND(f) par_exec->operands.fmt_41_mvfc.f
2049 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2050 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2051 EXTRACT_FMT_41_MVFC_VARS /* f-op1 f-r1 f-op2 f-r2 */
2052 EXTRACT_FMT_41_MVFC_CODE
2054 CPU (h_gr[f_r1]) = OPRND (scr);
2055 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2057 #if WITH_PROFILE_MODEL_P
2058 if (PROFILE_MODEL_P (current_cpu))
2060 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2061 m32rx_model_profile_insn (current_cpu, abuf);
2069 /* Perform mvtachi-a: mvtachi $src1,$accs. */
2071 SEM_FN_NAME (m32rx,mvtachi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2073 insn_t insn = SEM_INSN (sem_arg);
2074 #define OPRND(f) par_exec->operands.fmt_42_mvtachi_a.f
2075 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2076 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2077 EXTRACT_FMT_42_MVTACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
2078 EXTRACT_FMT_42_MVTACHI_A_CODE
2080 m32rx_h_accums_set (current_cpu, f_accs, ORDI (ANDDI (OPRND (accs), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (OPRND (src1)), 32)));
2081 TRACE_RESULT (current_cpu, "accs", 'D', m32rx_h_accums_get (current_cpu, f_accs));
2083 #if WITH_PROFILE_MODEL_P
2084 if (PROFILE_MODEL_P (current_cpu))
2086 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2087 m32rx_model_profile_insn (current_cpu, abuf);
2095 /* Perform mvtaclo-a: mvtaclo $src1,$accs. */
2097 SEM_FN_NAME (m32rx,mvtaclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2099 insn_t insn = SEM_INSN (sem_arg);
2100 #define OPRND(f) par_exec->operands.fmt_42_mvtachi_a.f
2101 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2102 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2103 EXTRACT_FMT_42_MVTACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */
2104 EXTRACT_FMT_42_MVTACHI_A_CODE
2106 m32rx_h_accums_set (current_cpu, f_accs, ORDI (ANDDI (OPRND (accs), MAKEDI (0xffffffff, 0)), ZEXTSIDI (OPRND (src1))));
2107 TRACE_RESULT (current_cpu, "accs", 'D', m32rx_h_accums_get (current_cpu, f_accs));
2109 #if WITH_PROFILE_MODEL_P
2110 if (PROFILE_MODEL_P (current_cpu))
2112 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2113 m32rx_model_profile_insn (current_cpu, abuf);
2121 /* Perform mvtc: mvtc $sr,$dcr. */
2123 SEM_FN_NAME (m32rx,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2125 insn_t insn = SEM_INSN (sem_arg);
2126 #define OPRND(f) par_exec->operands.fmt_43_mvtc.f
2127 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2128 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2129 EXTRACT_FMT_43_MVTC_VARS /* f-op1 f-r1 f-op2 f-r2 */
2130 EXTRACT_FMT_43_MVTC_CODE
2132 m32rx_h_cr_set (current_cpu, f_r1, OPRND (sr));
2133 TRACE_RESULT (current_cpu, "dcr", 'x', m32rx_h_cr_get (current_cpu, f_r1));
2135 #if WITH_PROFILE_MODEL_P
2136 if (PROFILE_MODEL_P (current_cpu))
2138 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2139 m32rx_model_profile_insn (current_cpu, abuf);
2147 /* Perform neg: neg $dr,$sr. */
2149 SEM_FN_NAME (m32rx,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2151 insn_t insn = SEM_INSN (sem_arg);
2152 #define OPRND(f) par_exec->operands.fmt_39_mv.f
2153 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2154 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2155 EXTRACT_FMT_39_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */
2156 EXTRACT_FMT_39_MV_CODE
2158 CPU (h_gr[f_r1]) = NEGSI (OPRND (sr));
2159 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2161 #if WITH_PROFILE_MODEL_P
2162 if (PROFILE_MODEL_P (current_cpu))
2164 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2165 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2166 m32rx_model_profile_insn (current_cpu, abuf);
2174 /* Perform nop: nop. */
2176 SEM_FN_NAME (m32rx,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2178 insn_t insn = SEM_INSN (sem_arg);
2179 #define OPRND(f) par_exec->operands.fmt_44_nop.f
2180 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2181 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2182 EXTRACT_FMT_44_NOP_VARS /* f-op1 f-r1 f-op2 f-r2 */
2183 EXTRACT_FMT_44_NOP_CODE
2185 PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
2187 #if WITH_PROFILE_MODEL_P
2188 if (PROFILE_MODEL_P (current_cpu))
2190 m32rx_model_profile_insn (current_cpu, abuf);
2198 /* Perform not: not $dr,$sr. */
2200 SEM_FN_NAME (m32rx,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2202 insn_t insn = SEM_INSN (sem_arg);
2203 #define OPRND(f) par_exec->operands.fmt_39_mv.f
2204 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2205 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2206 EXTRACT_FMT_39_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */
2207 EXTRACT_FMT_39_MV_CODE
2209 CPU (h_gr[f_r1]) = INVSI (OPRND (sr));
2210 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2212 #if WITH_PROFILE_MODEL_P
2213 if (PROFILE_MODEL_P (current_cpu))
2215 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2216 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2217 m32rx_model_profile_insn (current_cpu, abuf);
2225 /* Perform rac-dsi: rac $accd,$accs,#$imm1. */
2227 SEM_FN_NAME (m32rx,rac_dsi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2229 insn_t insn = SEM_INSN (sem_arg);
2230 #define OPRND(f) par_exec->operands.fmt_45_rac_dsi.f
2231 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2232 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2233 EXTRACT_FMT_45_RAC_DSI_VARS /* f-op1 f-accd f-bits67 f-op2 f-accs f-bit14 f-imm1 */
2234 EXTRACT_FMT_45_RAC_DSI_CODE
2238 tmp_tmp1 = SLLDI (OPRND (accs), OPRND (imm1));
2239 tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768));
2240 m32rx_h_accums_set (current_cpu, f_accd, (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000))));
2241 TRACE_RESULT (current_cpu, "accd", 'D', m32rx_h_accums_get (current_cpu, f_accd));
2244 #if WITH_PROFILE_MODEL_P
2245 if (PROFILE_MODEL_P (current_cpu))
2247 m32rx_model_profile_insn (current_cpu, abuf);
2255 /* Perform rach-dsi: rach $accd,$accs,#$imm1. */
2257 SEM_FN_NAME (m32rx,rach_dsi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2259 insn_t insn = SEM_INSN (sem_arg);
2260 #define OPRND(f) par_exec->operands.fmt_45_rac_dsi.f
2261 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2262 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2263 EXTRACT_FMT_45_RAC_DSI_VARS /* f-op1 f-accd f-bits67 f-op2 f-accs f-bit14 f-imm1 */
2264 EXTRACT_FMT_45_RAC_DSI_CODE
2268 tmp_tmp1 = SLLDI (OPRND (accs), OPRND (imm1));
2269 tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 0x80000000));
2270 m32rx_h_accums_set (current_cpu, f_accd, (GTDI (tmp_tmp1, MAKEDI (32767, 0))) ? (MAKEDI (32767, 0)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0))));
2271 TRACE_RESULT (current_cpu, "accd", 'D', m32rx_h_accums_get (current_cpu, f_accd));
2274 #if WITH_PROFILE_MODEL_P
2275 if (PROFILE_MODEL_P (current_cpu))
2277 m32rx_model_profile_insn (current_cpu, abuf);
2285 /* Perform rte: rte. */
2287 SEM_FN_NAME (m32rx,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2289 insn_t insn = SEM_INSN (sem_arg);
2290 #define OPRND(f) par_exec->operands.fmt_46_rte.f
2291 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2292 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2294 EXTRACT_FMT_46_RTE_VARS /* f-op1 f-r1 f-op2 f-r2 */
2295 EXTRACT_FMT_46_RTE_CODE
2298 CPU (h_sm) = OPRND (h_bsm_0);
2299 TRACE_RESULT (current_cpu, "h-sm-0", 'x', CPU (h_sm));
2300 CPU (h_ie) = OPRND (h_bie_0);
2301 TRACE_RESULT (current_cpu, "h-ie-0", 'x', CPU (h_ie));
2302 CPU (h_cond) = OPRND (h_bcond_0);
2303 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2304 BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, OPRND (h_bpc_0)));
2305 TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc));
2308 #if WITH_PROFILE_MODEL_P
2309 if (PROFILE_MODEL_P (current_cpu))
2311 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
2319 /* Perform seth: seth $dr,#$hi16. */
2321 SEM_FN_NAME (m32rx,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2323 insn_t insn = SEM_INSN (sem_arg);
2324 #define OPRND(f) par_exec->operands.fmt_47_seth.f
2325 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2326 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2327 EXTRACT_FMT_47_SETH_VARS /* f-op1 f-r1 f-op2 f-r2 f-hi16 */
2328 EXTRACT_FMT_47_SETH_CODE
2330 CPU (h_gr[f_r1]) = SLLSI (OPRND (hi16), 16);
2331 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2333 #if WITH_PROFILE_MODEL_P
2334 if (PROFILE_MODEL_P (current_cpu))
2336 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2337 m32rx_model_profile_insn (current_cpu, abuf);
2345 /* Perform sll: sll $dr,$sr. */
2347 SEM_FN_NAME (m32rx,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2349 insn_t insn = SEM_INSN (sem_arg);
2350 #define OPRND(f) par_exec->operands.fmt_0_add.f
2351 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2352 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2353 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2354 EXTRACT_FMT_0_ADD_CODE
2356 CPU (h_gr[f_r1]) = SLLSI (OPRND (dr), ANDSI (OPRND (sr), 31));
2357 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2359 #if WITH_PROFILE_MODEL_P
2360 if (PROFILE_MODEL_P (current_cpu))
2362 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2363 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2364 m32rx_model_profile_insn (current_cpu, abuf);
2372 /* Perform sll3: sll3 $dr,$sr,#$simm16. */
2374 SEM_FN_NAME (m32rx,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2376 insn_t insn = SEM_INSN (sem_arg);
2377 #define OPRND(f) par_exec->operands.fmt_48_sll3.f
2378 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2379 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2380 EXTRACT_FMT_48_SLL3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2381 EXTRACT_FMT_48_SLL3_CODE
2383 CPU (h_gr[f_r1]) = SLLSI (OPRND (sr), ANDSI (OPRND (simm16), 31));
2384 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2386 #if WITH_PROFILE_MODEL_P
2387 if (PROFILE_MODEL_P (current_cpu))
2389 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2390 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2391 m32rx_model_profile_insn (current_cpu, abuf);
2399 /* Perform slli: slli $dr,#$uimm5. */
2401 SEM_FN_NAME (m32rx,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2403 insn_t insn = SEM_INSN (sem_arg);
2404 #define OPRND(f) par_exec->operands.fmt_49_slli.f
2405 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2406 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2407 EXTRACT_FMT_49_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */
2408 EXTRACT_FMT_49_SLLI_CODE
2410 CPU (h_gr[f_r1]) = SLLSI (OPRND (dr), OPRND (uimm5));
2411 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2413 #if WITH_PROFILE_MODEL_P
2414 if (PROFILE_MODEL_P (current_cpu))
2416 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2417 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2418 m32rx_model_profile_insn (current_cpu, abuf);
2426 /* Perform sra: sra $dr,$sr. */
2428 SEM_FN_NAME (m32rx,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2430 insn_t insn = SEM_INSN (sem_arg);
2431 #define OPRND(f) par_exec->operands.fmt_0_add.f
2432 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2433 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2434 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2435 EXTRACT_FMT_0_ADD_CODE
2437 CPU (h_gr[f_r1]) = SRASI (OPRND (dr), ANDSI (OPRND (sr), 31));
2438 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2440 #if WITH_PROFILE_MODEL_P
2441 if (PROFILE_MODEL_P (current_cpu))
2443 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2444 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2445 m32rx_model_profile_insn (current_cpu, abuf);
2453 /* Perform sra3: sra3 $dr,$sr,#$simm16. */
2455 SEM_FN_NAME (m32rx,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2457 insn_t insn = SEM_INSN (sem_arg);
2458 #define OPRND(f) par_exec->operands.fmt_48_sll3.f
2459 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2460 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2461 EXTRACT_FMT_48_SLL3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2462 EXTRACT_FMT_48_SLL3_CODE
2464 CPU (h_gr[f_r1]) = SRASI (OPRND (sr), ANDSI (OPRND (simm16), 31));
2465 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2467 #if WITH_PROFILE_MODEL_P
2468 if (PROFILE_MODEL_P (current_cpu))
2470 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2471 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2472 m32rx_model_profile_insn (current_cpu, abuf);
2480 /* Perform srai: srai $dr,#$uimm5. */
2482 SEM_FN_NAME (m32rx,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2484 insn_t insn = SEM_INSN (sem_arg);
2485 #define OPRND(f) par_exec->operands.fmt_49_slli.f
2486 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2487 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2488 EXTRACT_FMT_49_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */
2489 EXTRACT_FMT_49_SLLI_CODE
2491 CPU (h_gr[f_r1]) = SRASI (OPRND (dr), OPRND (uimm5));
2492 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2494 #if WITH_PROFILE_MODEL_P
2495 if (PROFILE_MODEL_P (current_cpu))
2497 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2498 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2499 m32rx_model_profile_insn (current_cpu, abuf);
2507 /* Perform srl: srl $dr,$sr. */
2509 SEM_FN_NAME (m32rx,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2511 insn_t insn = SEM_INSN (sem_arg);
2512 #define OPRND(f) par_exec->operands.fmt_0_add.f
2513 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2514 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2515 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2516 EXTRACT_FMT_0_ADD_CODE
2518 CPU (h_gr[f_r1]) = SRLSI (OPRND (dr), ANDSI (OPRND (sr), 31));
2519 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2521 #if WITH_PROFILE_MODEL_P
2522 if (PROFILE_MODEL_P (current_cpu))
2524 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2525 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2526 m32rx_model_profile_insn (current_cpu, abuf);
2534 /* Perform srl3: srl3 $dr,$sr,#$simm16. */
2536 SEM_FN_NAME (m32rx,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2538 insn_t insn = SEM_INSN (sem_arg);
2539 #define OPRND(f) par_exec->operands.fmt_48_sll3.f
2540 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2541 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2542 EXTRACT_FMT_48_SLL3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2543 EXTRACT_FMT_48_SLL3_CODE
2545 CPU (h_gr[f_r1]) = SRLSI (OPRND (sr), ANDSI (OPRND (simm16), 31));
2546 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2548 #if WITH_PROFILE_MODEL_P
2549 if (PROFILE_MODEL_P (current_cpu))
2551 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2552 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2553 m32rx_model_profile_insn (current_cpu, abuf);
2561 /* Perform srli: srli $dr,#$uimm5. */
2563 SEM_FN_NAME (m32rx,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2565 insn_t insn = SEM_INSN (sem_arg);
2566 #define OPRND(f) par_exec->operands.fmt_49_slli.f
2567 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2568 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2569 EXTRACT_FMT_49_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */
2570 EXTRACT_FMT_49_SLLI_CODE
2572 CPU (h_gr[f_r1]) = SRLSI (OPRND (dr), OPRND (uimm5));
2573 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2575 #if WITH_PROFILE_MODEL_P
2576 if (PROFILE_MODEL_P (current_cpu))
2578 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2579 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2580 m32rx_model_profile_insn (current_cpu, abuf);
2588 /* Perform st: st $src1,@$src2. */
2590 SEM_FN_NAME (m32rx,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2592 insn_t insn = SEM_INSN (sem_arg);
2593 #define OPRND(f) par_exec->operands.fmt_50_st.f
2594 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2595 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2596 EXTRACT_FMT_50_ST_VARS /* f-op1 f-r1 f-op2 f-r2 */
2597 EXTRACT_FMT_50_ST_CODE
2599 SETMEMSI (current_cpu, OPRND (src2), OPRND (src1));
2600 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, OPRND (src2)));
2602 #if WITH_PROFILE_MODEL_P
2603 if (PROFILE_MODEL_P (current_cpu))
2605 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2606 m32rx_model_profile_insn (current_cpu, abuf);
2614 /* Perform st-d: st $src1,@($slo16,$src2). */
2616 SEM_FN_NAME (m32rx,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2618 insn_t insn = SEM_INSN (sem_arg);
2619 #define OPRND(f) par_exec->operands.fmt_51_st_d.f
2620 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2621 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2622 EXTRACT_FMT_51_ST_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2623 EXTRACT_FMT_51_ST_D_CODE
2625 SETMEMSI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), OPRND (src1));
2626 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMSI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16))));
2628 #if WITH_PROFILE_MODEL_P
2629 if (PROFILE_MODEL_P (current_cpu))
2631 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2632 m32rx_model_profile_insn (current_cpu, abuf);
2640 /* Perform stb: stb $src1,@$src2. */
2642 SEM_FN_NAME (m32rx,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2644 insn_t insn = SEM_INSN (sem_arg);
2645 #define OPRND(f) par_exec->operands.fmt_52_stb.f
2646 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2647 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2648 EXTRACT_FMT_52_STB_VARS /* f-op1 f-r1 f-op2 f-r2 */
2649 EXTRACT_FMT_52_STB_CODE
2651 SETMEMQI (current_cpu, OPRND (src2), OPRND (src1));
2652 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMQI (current_cpu, OPRND (src2)));
2654 #if WITH_PROFILE_MODEL_P
2655 if (PROFILE_MODEL_P (current_cpu))
2657 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2658 m32rx_model_profile_insn (current_cpu, abuf);
2666 /* Perform stb-d: stb $src1,@($slo16,$src2). */
2668 SEM_FN_NAME (m32rx,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2670 insn_t insn = SEM_INSN (sem_arg);
2671 #define OPRND(f) par_exec->operands.fmt_53_stb_d.f
2672 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2673 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2674 EXTRACT_FMT_53_STB_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2675 EXTRACT_FMT_53_STB_D_CODE
2677 SETMEMQI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), OPRND (src1));
2678 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMQI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16))));
2680 #if WITH_PROFILE_MODEL_P
2681 if (PROFILE_MODEL_P (current_cpu))
2683 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2684 m32rx_model_profile_insn (current_cpu, abuf);
2692 /* Perform sth: sth $src1,@$src2. */
2694 SEM_FN_NAME (m32rx,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2696 insn_t insn = SEM_INSN (sem_arg);
2697 #define OPRND(f) par_exec->operands.fmt_54_sth.f
2698 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2699 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2700 EXTRACT_FMT_54_STH_VARS /* f-op1 f-r1 f-op2 f-r2 */
2701 EXTRACT_FMT_54_STH_CODE
2703 SETMEMHI (current_cpu, OPRND (src2), OPRND (src1));
2704 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMHI (current_cpu, OPRND (src2)));
2706 #if WITH_PROFILE_MODEL_P
2707 if (PROFILE_MODEL_P (current_cpu))
2709 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2710 m32rx_model_profile_insn (current_cpu, abuf);
2718 /* Perform sth-d: sth $src1,@($slo16,$src2). */
2720 SEM_FN_NAME (m32rx,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2722 insn_t insn = SEM_INSN (sem_arg);
2723 #define OPRND(f) par_exec->operands.fmt_55_sth_d.f
2724 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2725 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2726 EXTRACT_FMT_55_STH_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */
2727 EXTRACT_FMT_55_STH_D_CODE
2729 SETMEMHI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), OPRND (src1));
2730 TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMHI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16))));
2732 #if WITH_PROFILE_MODEL_P
2733 if (PROFILE_MODEL_P (current_cpu))
2735 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2736 m32rx_model_profile_insn (current_cpu, abuf);
2744 /* Perform st-plus: st $src1,@+$src2. */
2746 SEM_FN_NAME (m32rx,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2748 insn_t insn = SEM_INSN (sem_arg);
2749 #define OPRND(f) par_exec->operands.fmt_56_st_plus.f
2750 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2751 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2752 EXTRACT_FMT_56_ST_PLUS_VARS /* f-op1 f-r1 f-op2 f-r2 */
2753 EXTRACT_FMT_56_ST_PLUS_CODE
2757 tmp_new_src2 = ADDSI (OPRND (src2), 4);
2758 SETMEMSI (current_cpu, tmp_new_src2, OPRND (src1));
2759 TRACE_RESULT (current_cpu, "h-memory-new-src2", 'x', GETMEMSI (current_cpu, tmp_new_src2));
2760 CPU (h_gr[f_r2]) = tmp_new_src2;
2761 TRACE_RESULT (current_cpu, "src2", 'x', CPU (h_gr[f_r2]));
2764 #if WITH_PROFILE_MODEL_P
2765 if (PROFILE_MODEL_P (current_cpu))
2767 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2768 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2769 m32rx_model_profile_insn (current_cpu, abuf);
2777 /* Perform st-minus: st $src1,@-$src2. */
2779 SEM_FN_NAME (m32rx,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2781 insn_t insn = SEM_INSN (sem_arg);
2782 #define OPRND(f) par_exec->operands.fmt_56_st_plus.f
2783 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2784 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2785 EXTRACT_FMT_56_ST_PLUS_VARS /* f-op1 f-r1 f-op2 f-r2 */
2786 EXTRACT_FMT_56_ST_PLUS_CODE
2790 tmp_new_src2 = SUBSI (OPRND (src2), 4);
2791 SETMEMSI (current_cpu, tmp_new_src2, OPRND (src1));
2792 TRACE_RESULT (current_cpu, "h-memory-new-src2", 'x', GETMEMSI (current_cpu, tmp_new_src2));
2793 CPU (h_gr[f_r2]) = tmp_new_src2;
2794 TRACE_RESULT (current_cpu, "src2", 'x', CPU (h_gr[f_r2]));
2797 #if WITH_PROFILE_MODEL_P
2798 if (PROFILE_MODEL_P (current_cpu))
2800 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2801 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2802 m32rx_model_profile_insn (current_cpu, abuf);
2810 /* Perform sub: sub $dr,$sr. */
2812 SEM_FN_NAME (m32rx,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2814 insn_t insn = SEM_INSN (sem_arg);
2815 #define OPRND(f) par_exec->operands.fmt_0_add.f
2816 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2817 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2818 EXTRACT_FMT_0_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
2819 EXTRACT_FMT_0_ADD_CODE
2821 CPU (h_gr[f_r1]) = SUBSI (OPRND (dr), OPRND (sr));
2822 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2824 #if WITH_PROFILE_MODEL_P
2825 if (PROFILE_MODEL_P (current_cpu))
2827 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2828 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2829 m32rx_model_profile_insn (current_cpu, abuf);
2837 /* Perform subv: subv $dr,$sr. */
2839 SEM_FN_NAME (m32rx,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2841 insn_t insn = SEM_INSN (sem_arg);
2842 #define OPRND(f) par_exec->operands.fmt_5_addv.f
2843 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2844 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2845 EXTRACT_FMT_5_ADDV_VARS /* f-op1 f-r1 f-op2 f-r2 */
2846 EXTRACT_FMT_5_ADDV_CODE
2850 temp0 = SUBSI (OPRND (dr), OPRND (sr));
2851 temp1 = SUBOFSI (OPRND (dr), OPRND (sr), 0);
2852 CPU (h_gr[f_r1]) = temp0;
2853 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2854 CPU (h_cond) = temp1;
2855 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2858 #if WITH_PROFILE_MODEL_P
2859 if (PROFILE_MODEL_P (current_cpu))
2861 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2862 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2863 m32rx_model_profile_insn (current_cpu, abuf);
2871 /* Perform subx: subx $dr,$sr. */
2873 SEM_FN_NAME (m32rx,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2875 insn_t insn = SEM_INSN (sem_arg);
2876 #define OPRND(f) par_exec->operands.fmt_7_addx.f
2877 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2878 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2879 EXTRACT_FMT_7_ADDX_VARS /* f-op1 f-r1 f-op2 f-r2 */
2880 EXTRACT_FMT_7_ADDX_CODE
2884 temp0 = SUBCSI (OPRND (dr), OPRND (sr), OPRND (condbit));
2885 temp1 = SUBCFSI (OPRND (dr), OPRND (sr), OPRND (condbit));
2886 CPU (h_gr[f_r1]) = temp0;
2887 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2888 CPU (h_cond) = temp1;
2889 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
2892 #if WITH_PROFILE_MODEL_P
2893 if (PROFILE_MODEL_P (current_cpu))
2895 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2896 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2897 m32rx_model_profile_insn (current_cpu, abuf);
2905 /* Perform trap: trap #$uimm4. */
2907 SEM_FN_NAME (m32rx,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2909 insn_t insn = SEM_INSN (sem_arg);
2910 #define OPRND(f) par_exec->operands.fmt_57_trap.f
2911 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2912 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2914 EXTRACT_FMT_57_TRAP_VARS /* f-op1 f-r1 f-op2 f-uimm4 */
2915 EXTRACT_FMT_57_TRAP_CODE
2918 m32rx_h_cr_set (current_cpu, 6, ADDSI (OPRND (pc), 4));
2919 TRACE_RESULT (current_cpu, "h-cr-6", 'x', m32rx_h_cr_get (current_cpu, 6));
2920 m32rx_h_cr_set (current_cpu, 0, ANDSI (SRLSI (OPRND (h_cr_0), 8), 33488896));
2921 TRACE_RESULT (current_cpu, "h-cr-0", 'x', m32rx_h_cr_get (current_cpu, 0));
2922 do_trap (current_cpu, OPRND (uimm4));
2926 #if WITH_PROFILE_MODEL_P
2927 if (PROFILE_MODEL_P (current_cpu))
2929 m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p);
2937 /* Perform unlock: unlock $src1,@$src2. */
2939 SEM_FN_NAME (m32rx,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2941 insn_t insn = SEM_INSN (sem_arg);
2942 #define OPRND(f) par_exec->operands.fmt_58_unlock.f
2943 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2944 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
2945 EXTRACT_FMT_58_UNLOCK_VARS /* f-op1 f-r1 f-op2 f-r2 */
2946 EXTRACT_FMT_58_UNLOCK_CODE
2949 if (OPRND (h_lock_0)) {
2950 SETMEMSI (current_cpu, OPRND (src2), OPRND (src1));
2951 TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, OPRND (src2)));
2954 TRACE_RESULT (current_cpu, "h-lock-0", 'x', CPU (h_lock));
2957 #if WITH_PROFILE_MODEL_P
2958 if (PROFILE_MODEL_P (current_cpu))
2960 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2961 m32rx_model_profile_insn (current_cpu, abuf);
2969 /* Perform satb: satb $dr,$sr. */
2971 SEM_FN_NAME (m32rx,satb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
2973 insn_t insn = SEM_INSN (sem_arg);
2974 #define OPRND(f) par_exec->operands.fmt_59_satb.f
2975 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2976 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
2977 EXTRACT_FMT_59_SATB_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
2978 EXTRACT_FMT_59_SATB_CODE
2980 CPU (h_gr[f_r1]) = (GESI (OPRND (sr), 127)) ? (127) : (LESI (OPRND (sr), -128)) ? (-128) : (OPRND (sr));
2981 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
2983 #if WITH_PROFILE_MODEL_P
2984 if (PROFILE_MODEL_P (current_cpu))
2986 m32rx_model_mark_get_h_gr (current_cpu, abuf);
2987 m32rx_model_mark_set_h_gr (current_cpu, abuf);
2988 m32rx_model_profile_insn (current_cpu, abuf);
2996 /* Perform sath: sath $dr,$sr. */
2998 SEM_FN_NAME (m32rx,sath) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3000 insn_t insn = SEM_INSN (sem_arg);
3001 #define OPRND(f) par_exec->operands.fmt_59_satb.f
3002 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3003 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
3004 EXTRACT_FMT_59_SATB_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
3005 EXTRACT_FMT_59_SATB_CODE
3007 CPU (h_gr[f_r1]) = (GESI (OPRND (sr), 32767)) ? (32767) : (LESI (OPRND (sr), -32768)) ? (-32768) : (OPRND (sr));
3008 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
3010 #if WITH_PROFILE_MODEL_P
3011 if (PROFILE_MODEL_P (current_cpu))
3013 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3014 m32rx_model_mark_set_h_gr (current_cpu, abuf);
3015 m32rx_model_profile_insn (current_cpu, abuf);
3023 /* Perform sat: sat $dr,$sr. */
3025 SEM_FN_NAME (m32rx,sat) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3027 insn_t insn = SEM_INSN (sem_arg);
3028 #define OPRND(f) par_exec->operands.fmt_60_sat.f
3029 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3030 CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
3031 EXTRACT_FMT_60_SAT_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */
3032 EXTRACT_FMT_60_SAT_CODE
3034 CPU (h_gr[f_r1]) = (OPRND (condbit)) ? ((LTSI (OPRND (sr), 0)) ? (2147483647) : (0x80000000)) : (OPRND (sr));
3035 TRACE_RESULT (current_cpu, "dr", 'x', CPU (h_gr[f_r1]));
3037 #if WITH_PROFILE_MODEL_P
3038 if (PROFILE_MODEL_P (current_cpu))
3040 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3041 m32rx_model_mark_set_h_gr (current_cpu, abuf);
3042 m32rx_model_profile_insn (current_cpu, abuf);
3050 /* Perform pcmpbz: pcmpbz $src2. */
3052 SEM_FN_NAME (m32rx,pcmpbz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3054 insn_t insn = SEM_INSN (sem_arg);
3055 #define OPRND(f) par_exec->operands.fmt_21_cmpz.f
3056 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3057 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
3058 EXTRACT_FMT_21_CMPZ_VARS /* f-op1 f-r1 f-op2 f-r2 */
3059 EXTRACT_FMT_21_CMPZ_CODE
3061 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);
3062 TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond));
3064 #if WITH_PROFILE_MODEL_P
3065 if (PROFILE_MODEL_P (current_cpu))
3067 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3068 m32rx_model_profile_insn (current_cpu, abuf);
3076 /* Perform sadd: sadd. */
3078 SEM_FN_NAME (m32rx,sadd) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3080 insn_t insn = SEM_INSN (sem_arg);
3081 #define OPRND(f) par_exec->operands.fmt_61_sadd.f
3082 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3083 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
3084 EXTRACT_FMT_61_SADD_VARS /* f-op1 f-r1 f-op2 f-r2 */
3085 EXTRACT_FMT_61_SADD_CODE
3087 m32rx_h_accums_set (current_cpu, 0, ADDDI (SRADI (OPRND (h_accums_1), 16), OPRND (h_accums_0)));
3088 TRACE_RESULT (current_cpu, "h-accums-0", 'D', m32rx_h_accums_get (current_cpu, 0));
3090 #if WITH_PROFILE_MODEL_P
3091 if (PROFILE_MODEL_P (current_cpu))
3093 m32rx_model_profile_insn (current_cpu, abuf);
3101 /* Perform macwu1: macwu1 $src1,$src2. */
3103 SEM_FN_NAME (m32rx,macwu1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3105 insn_t insn = SEM_INSN (sem_arg);
3106 #define OPRND(f) par_exec->operands.fmt_62_macwu1.f
3107 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3108 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
3109 EXTRACT_FMT_62_MACWU1_VARS /* f-op1 f-r1 f-op2 f-r2 */
3110 EXTRACT_FMT_62_MACWU1_CODE
3112 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));
3113 TRACE_RESULT (current_cpu, "h-accums-1", 'D', m32rx_h_accums_get (current_cpu, 1));
3115 #if WITH_PROFILE_MODEL_P
3116 if (PROFILE_MODEL_P (current_cpu))
3118 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3119 m32rx_model_profile_insn (current_cpu, abuf);
3127 /* Perform msblo: msblo $src1,$src2. */
3129 SEM_FN_NAME (m32rx,msblo) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3131 insn_t insn = SEM_INSN (sem_arg);
3132 #define OPRND(f) par_exec->operands.fmt_63_msblo.f
3133 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3134 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
3135 EXTRACT_FMT_63_MSBLO_VARS /* f-op1 f-r1 f-op2 f-r2 */
3136 EXTRACT_FMT_63_MSBLO_CODE
3138 CPU (h_accum) = SRADI (SLLDI (SUBDI (OPRND (accum), SRADI (SLLDI (MULDI (EXTHIDI (TRUNCSIHI (OPRND (src1))), EXTHIDI (TRUNCSIHI (OPRND (src2)))), 32), 16)), 8), 8);
3139 TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum));
3141 #if WITH_PROFILE_MODEL_P
3142 if (PROFILE_MODEL_P (current_cpu))
3144 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3145 m32rx_model_profile_insn (current_cpu, abuf);
3153 /* Perform mulwu1: mulwu1 $src1,$src2. */
3155 SEM_FN_NAME (m32rx,mulwu1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3157 insn_t insn = SEM_INSN (sem_arg);
3158 #define OPRND(f) par_exec->operands.fmt_64_mulwu1.f
3159 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3160 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
3161 EXTRACT_FMT_64_MULWU1_VARS /* f-op1 f-r1 f-op2 f-r2 */
3162 EXTRACT_FMT_64_MULWU1_CODE
3164 m32rx_h_accums_set (current_cpu, 1, SRADI (SLLDI (MULDI (EXTSIDI (OPRND (src1)), EXTSIDI (ANDSI (OPRND (src2), 65535))), 16), 16));
3165 TRACE_RESULT (current_cpu, "h-accums-1", 'D', m32rx_h_accums_get (current_cpu, 1));
3167 #if WITH_PROFILE_MODEL_P
3168 if (PROFILE_MODEL_P (current_cpu))
3170 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3171 m32rx_model_profile_insn (current_cpu, abuf);
3179 /* Perform maclh1: maclh1 $src1,$src2. */
3181 SEM_FN_NAME (m32rx,maclh1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3183 insn_t insn = SEM_INSN (sem_arg);
3184 #define OPRND(f) par_exec->operands.fmt_62_macwu1.f
3185 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3186 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
3187 EXTRACT_FMT_62_MACWU1_VARS /* f-op1 f-r1 f-op2 f-r2 */
3188 EXTRACT_FMT_62_MACWU1_CODE
3190 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));
3191 TRACE_RESULT (current_cpu, "h-accums-1", 'D', m32rx_h_accums_get (current_cpu, 1));
3193 #if WITH_PROFILE_MODEL_P
3194 if (PROFILE_MODEL_P (current_cpu))
3196 m32rx_model_mark_get_h_gr (current_cpu, abuf);
3197 m32rx_model_profile_insn (current_cpu, abuf);
3205 /* Perform sc: sc. */
3207 SEM_FN_NAME (m32rx,sc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3209 insn_t insn = SEM_INSN (sem_arg);
3210 #define OPRND(f) par_exec->operands.fmt_65_sc.f
3211 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3212 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
3213 EXTRACT_FMT_65_SC_VARS /* f-op1 f-r1 f-op2 f-r2 */
3214 EXTRACT_FMT_65_SC_CODE
3216 if (OPRND (condbit)) {
3217 BRANCH_NEW_PC (new_pc, NEW_PC_SKIP);
3220 #if WITH_PROFILE_MODEL_P
3221 if (PROFILE_MODEL_P (current_cpu))
3223 m32rx_model_profile_insn (current_cpu, abuf);
3231 /* Perform snc: snc. */
3233 SEM_FN_NAME (m32rx,snc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3235 insn_t insn = SEM_INSN (sem_arg);
3236 #define OPRND(f) par_exec->operands.fmt_65_sc.f
3237 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3238 CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
3239 EXTRACT_FMT_65_SC_VARS /* f-op1 f-r1 f-op2 f-r2 */
3240 EXTRACT_FMT_65_SC_CODE
3242 if (NOTBI (OPRND (condbit))) {
3243 BRANCH_NEW_PC (new_pc, NEW_PC_SKIP);
3246 #if WITH_PROFILE_MODEL_P
3247 if (PROFILE_MODEL_P (current_cpu))
3249 m32rx_model_profile_insn (current_cpu, abuf);
3258 SEM_FN_NAME (m32rx,illegal) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec)
3260 sim_engine_illegal_insn (current_cpu, NULL_CIA /*FIXME*/);
3264 #endif /* ! defined (SCACHE_P) || (defined (SCACHE_P) && WITH_SCACHE) */