1 /* Simulator instruction semantics for m32rbf.
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.
27 /* The labels have the case they have because the enum of insn types
28 is all uppercase and in the non-stdc case the insn symbol is built
29 into the enum name. */
35 { M32RBF_INSN_X_INVALID, && case_sem_INSN_X_INVALID },
36 { M32RBF_INSN_X_AFTER, && case_sem_INSN_X_AFTER },
37 { M32RBF_INSN_X_BEFORE, && case_sem_INSN_X_BEFORE },
38 { M32RBF_INSN_X_CTI_CHAIN, && case_sem_INSN_X_CTI_CHAIN },
39 { M32RBF_INSN_X_CHAIN, && case_sem_INSN_X_CHAIN },
40 { M32RBF_INSN_X_BEGIN, && case_sem_INSN_X_BEGIN },
41 { M32RBF_INSN_ADD, && case_sem_INSN_ADD },
42 { M32RBF_INSN_ADD3, && case_sem_INSN_ADD3 },
43 { M32RBF_INSN_AND, && case_sem_INSN_AND },
44 { M32RBF_INSN_AND3, && case_sem_INSN_AND3 },
45 { M32RBF_INSN_OR, && case_sem_INSN_OR },
46 { M32RBF_INSN_OR3, && case_sem_INSN_OR3 },
47 { M32RBF_INSN_XOR, && case_sem_INSN_XOR },
48 { M32RBF_INSN_XOR3, && case_sem_INSN_XOR3 },
49 { M32RBF_INSN_ADDI, && case_sem_INSN_ADDI },
50 { M32RBF_INSN_ADDV, && case_sem_INSN_ADDV },
51 { M32RBF_INSN_ADDV3, && case_sem_INSN_ADDV3 },
52 { M32RBF_INSN_ADDX, && case_sem_INSN_ADDX },
53 { M32RBF_INSN_BC8, && case_sem_INSN_BC8 },
54 { M32RBF_INSN_BC24, && case_sem_INSN_BC24 },
55 { M32RBF_INSN_BEQ, && case_sem_INSN_BEQ },
56 { M32RBF_INSN_BEQZ, && case_sem_INSN_BEQZ },
57 { M32RBF_INSN_BGEZ, && case_sem_INSN_BGEZ },
58 { M32RBF_INSN_BGTZ, && case_sem_INSN_BGTZ },
59 { M32RBF_INSN_BLEZ, && case_sem_INSN_BLEZ },
60 { M32RBF_INSN_BLTZ, && case_sem_INSN_BLTZ },
61 { M32RBF_INSN_BNEZ, && case_sem_INSN_BNEZ },
62 { M32RBF_INSN_BL8, && case_sem_INSN_BL8 },
63 { M32RBF_INSN_BL24, && case_sem_INSN_BL24 },
64 { M32RBF_INSN_BNC8, && case_sem_INSN_BNC8 },
65 { M32RBF_INSN_BNC24, && case_sem_INSN_BNC24 },
66 { M32RBF_INSN_BNE, && case_sem_INSN_BNE },
67 { M32RBF_INSN_BRA8, && case_sem_INSN_BRA8 },
68 { M32RBF_INSN_BRA24, && case_sem_INSN_BRA24 },
69 { M32RBF_INSN_CMP, && case_sem_INSN_CMP },
70 { M32RBF_INSN_CMPI, && case_sem_INSN_CMPI },
71 { M32RBF_INSN_CMPU, && case_sem_INSN_CMPU },
72 { M32RBF_INSN_CMPUI, && case_sem_INSN_CMPUI },
73 { M32RBF_INSN_DIV, && case_sem_INSN_DIV },
74 { M32RBF_INSN_DIVU, && case_sem_INSN_DIVU },
75 { M32RBF_INSN_REM, && case_sem_INSN_REM },
76 { M32RBF_INSN_REMU, && case_sem_INSN_REMU },
77 { M32RBF_INSN_JL, && case_sem_INSN_JL },
78 { M32RBF_INSN_JMP, && case_sem_INSN_JMP },
79 { M32RBF_INSN_LD, && case_sem_INSN_LD },
80 { M32RBF_INSN_LD_D, && case_sem_INSN_LD_D },
81 { M32RBF_INSN_LDB, && case_sem_INSN_LDB },
82 { M32RBF_INSN_LDB_D, && case_sem_INSN_LDB_D },
83 { M32RBF_INSN_LDH, && case_sem_INSN_LDH },
84 { M32RBF_INSN_LDH_D, && case_sem_INSN_LDH_D },
85 { M32RBF_INSN_LDUB, && case_sem_INSN_LDUB },
86 { M32RBF_INSN_LDUB_D, && case_sem_INSN_LDUB_D },
87 { M32RBF_INSN_LDUH, && case_sem_INSN_LDUH },
88 { M32RBF_INSN_LDUH_D, && case_sem_INSN_LDUH_D },
89 { M32RBF_INSN_LD_PLUS, && case_sem_INSN_LD_PLUS },
90 { M32RBF_INSN_LD24, && case_sem_INSN_LD24 },
91 { M32RBF_INSN_LDI8, && case_sem_INSN_LDI8 },
92 { M32RBF_INSN_LDI16, && case_sem_INSN_LDI16 },
93 { M32RBF_INSN_LOCK, && case_sem_INSN_LOCK },
94 { M32RBF_INSN_MACHI, && case_sem_INSN_MACHI },
95 { M32RBF_INSN_MACLO, && case_sem_INSN_MACLO },
96 { M32RBF_INSN_MACWHI, && case_sem_INSN_MACWHI },
97 { M32RBF_INSN_MACWLO, && case_sem_INSN_MACWLO },
98 { M32RBF_INSN_MUL, && case_sem_INSN_MUL },
99 { M32RBF_INSN_MULHI, && case_sem_INSN_MULHI },
100 { M32RBF_INSN_MULLO, && case_sem_INSN_MULLO },
101 { M32RBF_INSN_MULWHI, && case_sem_INSN_MULWHI },
102 { M32RBF_INSN_MULWLO, && case_sem_INSN_MULWLO },
103 { M32RBF_INSN_MV, && case_sem_INSN_MV },
104 { M32RBF_INSN_MVFACHI, && case_sem_INSN_MVFACHI },
105 { M32RBF_INSN_MVFACLO, && case_sem_INSN_MVFACLO },
106 { M32RBF_INSN_MVFACMI, && case_sem_INSN_MVFACMI },
107 { M32RBF_INSN_MVFC, && case_sem_INSN_MVFC },
108 { M32RBF_INSN_MVTACHI, && case_sem_INSN_MVTACHI },
109 { M32RBF_INSN_MVTACLO, && case_sem_INSN_MVTACLO },
110 { M32RBF_INSN_MVTC, && case_sem_INSN_MVTC },
111 { M32RBF_INSN_NEG, && case_sem_INSN_NEG },
112 { M32RBF_INSN_NOP, && case_sem_INSN_NOP },
113 { M32RBF_INSN_NOT, && case_sem_INSN_NOT },
114 { M32RBF_INSN_RAC, && case_sem_INSN_RAC },
115 { M32RBF_INSN_RACH, && case_sem_INSN_RACH },
116 { M32RBF_INSN_RTE, && case_sem_INSN_RTE },
117 { M32RBF_INSN_SETH, && case_sem_INSN_SETH },
118 { M32RBF_INSN_SLL, && case_sem_INSN_SLL },
119 { M32RBF_INSN_SLL3, && case_sem_INSN_SLL3 },
120 { M32RBF_INSN_SLLI, && case_sem_INSN_SLLI },
121 { M32RBF_INSN_SRA, && case_sem_INSN_SRA },
122 { M32RBF_INSN_SRA3, && case_sem_INSN_SRA3 },
123 { M32RBF_INSN_SRAI, && case_sem_INSN_SRAI },
124 { M32RBF_INSN_SRL, && case_sem_INSN_SRL },
125 { M32RBF_INSN_SRL3, && case_sem_INSN_SRL3 },
126 { M32RBF_INSN_SRLI, && case_sem_INSN_SRLI },
127 { M32RBF_INSN_ST, && case_sem_INSN_ST },
128 { M32RBF_INSN_ST_D, && case_sem_INSN_ST_D },
129 { M32RBF_INSN_STB, && case_sem_INSN_STB },
130 { M32RBF_INSN_STB_D, && case_sem_INSN_STB_D },
131 { M32RBF_INSN_STH, && case_sem_INSN_STH },
132 { M32RBF_INSN_STH_D, && case_sem_INSN_STH_D },
133 { M32RBF_INSN_ST_PLUS, && case_sem_INSN_ST_PLUS },
134 { M32RBF_INSN_ST_MINUS, && case_sem_INSN_ST_MINUS },
135 { M32RBF_INSN_SUB, && case_sem_INSN_SUB },
136 { M32RBF_INSN_SUBV, && case_sem_INSN_SUBV },
137 { M32RBF_INSN_SUBX, && case_sem_INSN_SUBX },
138 { M32RBF_INSN_TRAP, && case_sem_INSN_TRAP },
139 { M32RBF_INSN_UNLOCK, && case_sem_INSN_UNLOCK },
144 for (i = 0; labels[i].label != 0; ++i)
146 CPU_IDESC (current_cpu) [labels[i].index].sem_fast_lab = labels[i].label;
148 CPU_IDESC (current_cpu) [labels[i].index].sem_full_lab = labels[i].label;
152 #endif /* DEFINE_LABELS */
156 /* If hyper-fast [well not unnecessarily slow] execution is selected, turn
157 off frills like tracing and profiling. */
158 /* FIXME: A better way would be to have TRACE_RESULT check for something
159 that can cause it to be optimized out. Another way would be to emit
160 special handlers into the instruction "stream". */
164 #define TRACE_RESULT(cpu, abuf, name, type, val)
168 #define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->idesc->opcode, CGEN_INSN_##attr)
174 /* Branch to next handler without going around main loop. */
175 #define NEXT(vpc) goto * SEM_ARGBUF (vpc) -> semantic.sem_case
176 SWITCH (sem, SEM_ARGBUF (vpc) -> semantic.sem_case)
178 #else /* ! WITH_SCACHE_PBB */
180 #define NEXT(vpc) BREAK (sem)
183 SWITCH (sem, SEM_ARGBUF (sc) -> idesc->sem_fast_lab)
185 SWITCH (sem, SEM_ARGBUF (sc) -> idesc->sem_full_lab)
188 SWITCH (sem, SEM_ARGBUF (sc) -> idesc->num)
191 #endif /* ! WITH_SCACHE_PBB */
195 CASE (sem, INSN_X_INVALID) : /* --invalid-- */
197 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
198 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
199 #define FLD(f) abuf->fields.fmt_empty.f
200 int UNUSED written = 0;
201 PCADDR UNUSED pc = abuf->addr;
202 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
206 /* Update the recorded pc in the cpu state struct. */
209 sim_engine_invalid_insn (current_cpu, pc);
210 sim_io_error (CPU_STATE (current_cpu), "invalid insn not handled\n");
218 CASE (sem, INSN_X_AFTER) : /* --after-- */
220 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
221 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
222 #define FLD(f) abuf->fields.fmt_empty.f
223 int UNUSED written = 0;
224 PCADDR UNUSED pc = abuf->addr;
225 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
229 m32rbf_pbb_after (current_cpu, sem_arg);
237 CASE (sem, INSN_X_BEFORE) : /* --before-- */
239 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
240 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
241 #define FLD(f) abuf->fields.fmt_empty.f
242 int UNUSED written = 0;
243 PCADDR UNUSED pc = abuf->addr;
244 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
248 m32rbf_pbb_before (current_cpu, sem_arg);
256 CASE (sem, INSN_X_CTI_CHAIN) : /* --cti-chain-- */
258 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
259 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
260 #define FLD(f) abuf->fields.fmt_empty.f
261 int UNUSED written = 0;
262 PCADDR UNUSED pc = abuf->addr;
263 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
268 vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
269 pbb_br_npc_ptr, pbb_br_npc);
272 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
273 vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
274 CPU_PBB_BR_NPC_PTR (current_cpu),
275 CPU_PBB_BR_NPC (current_cpu));
284 CASE (sem, INSN_X_CHAIN) : /* --chain-- */
286 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
287 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
288 #define FLD(f) abuf->fields.fmt_empty.f
289 int UNUSED written = 0;
290 PCADDR UNUSED pc = abuf->addr;
291 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
295 vpc = m32rbf_pbb_chain (current_cpu, sem_arg);
306 CASE (sem, INSN_X_BEGIN) : /* --begin-- */
308 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
309 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
310 #define FLD(f) abuf->fields.fmt_empty.f
311 int UNUSED written = 0;
312 PCADDR UNUSED pc = abuf->addr;
313 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
318 /* In the switch case FAST_P is a constant, allowing several optimizations
319 in any called inline functions. */
320 vpc = m32rbf_pbb_begin (current_cpu, FAST_P);
322 vpc = m32rbf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
331 CASE (sem, INSN_ADD) : /* add $dr,$sr */
333 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
334 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
335 #define FLD(f) abuf->fields.fmt_add.f
336 int UNUSED written = 0;
337 PCADDR UNUSED pc = abuf->addr;
338 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
341 SI opval = ADDSI (* FLD (i_dr), * FLD (i_sr));
342 * FLD (i_dr) = opval;
343 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
350 CASE (sem, INSN_ADD3) : /* add3 $dr,$sr,$hash$slo16 */
352 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
353 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
354 #define FLD(f) abuf->fields.fmt_add3.f
355 int UNUSED written = 0;
356 PCADDR UNUSED pc = abuf->addr;
357 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
360 SI opval = ADDSI (* FLD (i_sr), FLD (f_simm16));
361 * FLD (i_dr) = opval;
362 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
369 CASE (sem, INSN_AND) : /* and $dr,$sr */
371 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
372 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
373 #define FLD(f) abuf->fields.fmt_add.f
374 int UNUSED written = 0;
375 PCADDR UNUSED pc = abuf->addr;
376 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
379 SI opval = ANDSI (* FLD (i_dr), * FLD (i_sr));
380 * FLD (i_dr) = opval;
381 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
388 CASE (sem, INSN_AND3) : /* and3 $dr,$sr,$uimm16 */
390 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
391 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
392 #define FLD(f) abuf->fields.fmt_and3.f
393 int UNUSED written = 0;
394 PCADDR UNUSED pc = abuf->addr;
395 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
398 SI opval = ANDSI (* FLD (i_sr), FLD (f_uimm16));
399 * FLD (i_dr) = opval;
400 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
407 CASE (sem, INSN_OR) : /* or $dr,$sr */
409 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
410 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
411 #define FLD(f) abuf->fields.fmt_add.f
412 int UNUSED written = 0;
413 PCADDR UNUSED pc = abuf->addr;
414 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
417 SI opval = ORSI (* FLD (i_dr), * FLD (i_sr));
418 * FLD (i_dr) = opval;
419 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
426 CASE (sem, INSN_OR3) : /* or3 $dr,$sr,$hash$ulo16 */
428 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
429 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
430 #define FLD(f) abuf->fields.fmt_or3.f
431 int UNUSED written = 0;
432 PCADDR UNUSED pc = abuf->addr;
433 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
436 SI opval = ORSI (* FLD (i_sr), FLD (f_uimm16));
437 * FLD (i_dr) = opval;
438 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
445 CASE (sem, INSN_XOR) : /* xor $dr,$sr */
447 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
448 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
449 #define FLD(f) abuf->fields.fmt_add.f
450 int UNUSED written = 0;
451 PCADDR UNUSED pc = abuf->addr;
452 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
455 SI opval = XORSI (* FLD (i_dr), * FLD (i_sr));
456 * FLD (i_dr) = opval;
457 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
464 CASE (sem, INSN_XOR3) : /* xor3 $dr,$sr,$uimm16 */
466 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
467 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
468 #define FLD(f) abuf->fields.fmt_and3.f
469 int UNUSED written = 0;
470 PCADDR UNUSED pc = abuf->addr;
471 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
474 SI opval = XORSI (* FLD (i_sr), FLD (f_uimm16));
475 * FLD (i_dr) = opval;
476 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
483 CASE (sem, INSN_ADDI) : /* addi $dr,$simm8 */
485 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
486 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
487 #define FLD(f) abuf->fields.fmt_addi.f
488 int UNUSED written = 0;
489 PCADDR UNUSED pc = abuf->addr;
490 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
493 SI opval = ADDSI (* FLD (i_dr), FLD (f_simm8));
494 * FLD (i_dr) = opval;
495 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
502 CASE (sem, INSN_ADDV) : /* addv $dr,$sr */
504 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
505 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
506 #define FLD(f) abuf->fields.fmt_addv.f
507 int UNUSED written = 0;
508 PCADDR UNUSED pc = abuf->addr;
509 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
513 temp0 = ADDSI (* FLD (i_dr), * FLD (i_sr));
514 temp1 = ADDOFSI (* FLD (i_dr), * FLD (i_sr), 0);
517 * FLD (i_dr) = opval;
518 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
522 CPU (h_cond) = opval;
523 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
531 CASE (sem, INSN_ADDV3) : /* addv3 $dr,$sr,$simm16 */
533 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
534 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
535 #define FLD(f) abuf->fields.fmt_addv3.f
536 int UNUSED written = 0;
537 PCADDR UNUSED pc = abuf->addr;
538 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
542 temp0 = ADDSI (* FLD (i_sr), FLD (f_simm16));
543 temp1 = ADDOFSI (* FLD (i_sr), FLD (f_simm16), 0);
546 * FLD (i_dr) = opval;
547 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
551 CPU (h_cond) = opval;
552 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
560 CASE (sem, INSN_ADDX) : /* addx $dr,$sr */
562 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
563 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
564 #define FLD(f) abuf->fields.fmt_addx.f
565 int UNUSED written = 0;
566 PCADDR UNUSED pc = abuf->addr;
567 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
571 temp0 = ADDCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
572 temp1 = ADDCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
575 * FLD (i_dr) = opval;
576 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
580 CPU (h_cond) = opval;
581 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
589 CASE (sem, INSN_BC8) : /* bc.s $disp8 */
591 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
592 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
593 #define FLD(f) abuf->fields.cti.fields.fmt_bc8.f
594 int UNUSED written = 0;
595 PCADDR UNUSED pc = abuf->addr;
597 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
601 USI opval = FLD (i_disp8);
602 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
604 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
608 abuf->written = written;
614 CASE (sem, INSN_BC24) : /* bc.l $disp24 */
616 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
617 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
618 #define FLD(f) abuf->fields.cti.fields.fmt_bc24.f
619 int UNUSED written = 0;
620 PCADDR UNUSED pc = abuf->addr;
622 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
626 USI opval = FLD (i_disp24);
627 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
629 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
633 abuf->written = written;
639 CASE (sem, INSN_BEQ) : /* beq $src1,$src2,$disp16 */
641 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
642 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
643 #define FLD(f) abuf->fields.cti.fields.fmt_beq.f
644 int UNUSED written = 0;
645 PCADDR UNUSED pc = abuf->addr;
647 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
649 if (EQSI (* FLD (i_src1), * FLD (i_src2))) {
651 USI opval = FLD (i_disp16);
652 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
654 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
658 abuf->written = written;
664 CASE (sem, INSN_BEQZ) : /* beqz $src2,$disp16 */
666 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
667 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
668 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
669 int UNUSED written = 0;
670 PCADDR UNUSED pc = abuf->addr;
672 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
674 if (EQSI (* FLD (i_src2), 0)) {
676 USI opval = FLD (i_disp16);
677 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
679 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
683 abuf->written = written;
689 CASE (sem, INSN_BGEZ) : /* bgez $src2,$disp16 */
691 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
692 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
693 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
694 int UNUSED written = 0;
695 PCADDR UNUSED pc = abuf->addr;
697 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
699 if (GESI (* FLD (i_src2), 0)) {
701 USI opval = FLD (i_disp16);
702 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
704 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
708 abuf->written = written;
714 CASE (sem, INSN_BGTZ) : /* bgtz $src2,$disp16 */
716 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
717 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
718 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
719 int UNUSED written = 0;
720 PCADDR UNUSED pc = abuf->addr;
722 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
724 if (GTSI (* FLD (i_src2), 0)) {
726 USI opval = FLD (i_disp16);
727 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
729 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
733 abuf->written = written;
739 CASE (sem, INSN_BLEZ) : /* blez $src2,$disp16 */
741 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
742 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
743 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
744 int UNUSED written = 0;
745 PCADDR UNUSED pc = abuf->addr;
747 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
749 if (LESI (* FLD (i_src2), 0)) {
751 USI opval = FLD (i_disp16);
752 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
754 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
758 abuf->written = written;
764 CASE (sem, INSN_BLTZ) : /* bltz $src2,$disp16 */
766 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
767 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
768 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
769 int UNUSED written = 0;
770 PCADDR UNUSED pc = abuf->addr;
772 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
774 if (LTSI (* FLD (i_src2), 0)) {
776 USI opval = FLD (i_disp16);
777 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
779 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
783 abuf->written = written;
789 CASE (sem, INSN_BNEZ) : /* bnez $src2,$disp16 */
791 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
792 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
793 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
794 int UNUSED written = 0;
795 PCADDR UNUSED pc = abuf->addr;
797 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
799 if (NESI (* FLD (i_src2), 0)) {
801 USI opval = FLD (i_disp16);
802 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
804 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
808 abuf->written = written;
814 CASE (sem, INSN_BL8) : /* bl.s $disp8 */
816 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
817 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
818 #define FLD(f) abuf->fields.cti.fields.fmt_bl8.f
819 int UNUSED written = 0;
820 PCADDR UNUSED pc = abuf->addr;
822 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
826 SI opval = ADDSI (ANDSI (pc, -4), 4);
827 CPU (h_gr[((UINT) 14)]) = opval;
828 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
831 USI opval = FLD (i_disp8);
832 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
833 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
842 CASE (sem, INSN_BL24) : /* bl.l $disp24 */
844 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
845 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
846 #define FLD(f) abuf->fields.cti.fields.fmt_bl24.f
847 int UNUSED written = 0;
848 PCADDR UNUSED pc = abuf->addr;
850 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
854 SI opval = ADDSI (pc, 4);
855 CPU (h_gr[((UINT) 14)]) = opval;
856 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
859 USI opval = FLD (i_disp24);
860 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
861 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
870 CASE (sem, INSN_BNC8) : /* bnc.s $disp8 */
872 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
873 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
874 #define FLD(f) abuf->fields.cti.fields.fmt_bc8.f
875 int UNUSED written = 0;
876 PCADDR UNUSED pc = abuf->addr;
878 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
880 if (NOTBI (CPU (h_cond))) {
882 USI opval = FLD (i_disp8);
883 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
885 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
889 abuf->written = written;
895 CASE (sem, INSN_BNC24) : /* bnc.l $disp24 */
897 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
898 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
899 #define FLD(f) abuf->fields.cti.fields.fmt_bc24.f
900 int UNUSED written = 0;
901 PCADDR UNUSED pc = abuf->addr;
903 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
905 if (NOTBI (CPU (h_cond))) {
907 USI opval = FLD (i_disp24);
908 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
910 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
914 abuf->written = written;
920 CASE (sem, INSN_BNE) : /* bne $src1,$src2,$disp16 */
922 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
923 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
924 #define FLD(f) abuf->fields.cti.fields.fmt_beq.f
925 int UNUSED written = 0;
926 PCADDR UNUSED pc = abuf->addr;
928 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
930 if (NESI (* FLD (i_src1), * FLD (i_src2))) {
932 USI opval = FLD (i_disp16);
933 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
935 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
939 abuf->written = written;
945 CASE (sem, INSN_BRA8) : /* bra.s $disp8 */
947 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
948 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
949 #define FLD(f) abuf->fields.cti.fields.fmt_bra8.f
950 int UNUSED written = 0;
951 PCADDR UNUSED pc = abuf->addr;
953 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
956 USI opval = FLD (i_disp8);
957 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
958 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
966 CASE (sem, INSN_BRA24) : /* bra.l $disp24 */
968 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
969 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
970 #define FLD(f) abuf->fields.cti.fields.fmt_bra24.f
971 int UNUSED written = 0;
972 PCADDR UNUSED pc = abuf->addr;
974 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
977 USI opval = FLD (i_disp24);
978 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
979 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
987 CASE (sem, INSN_CMP) : /* cmp $src1,$src2 */
989 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
990 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
991 #define FLD(f) abuf->fields.fmt_cmp.f
992 int UNUSED written = 0;
993 PCADDR UNUSED pc = abuf->addr;
994 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
997 BI opval = LTSI (* FLD (i_src1), * FLD (i_src2));
998 CPU (h_cond) = opval;
999 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
1006 CASE (sem, INSN_CMPI) : /* cmpi $src2,$simm16 */
1008 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1009 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1010 #define FLD(f) abuf->fields.fmt_cmpi.f
1011 int UNUSED written = 0;
1012 PCADDR UNUSED pc = abuf->addr;
1013 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1016 BI opval = LTSI (* FLD (i_src2), FLD (f_simm16));
1017 CPU (h_cond) = opval;
1018 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
1025 CASE (sem, INSN_CMPU) : /* cmpu $src1,$src2 */
1027 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1028 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1029 #define FLD(f) abuf->fields.fmt_cmp.f
1030 int UNUSED written = 0;
1031 PCADDR UNUSED pc = abuf->addr;
1032 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1035 BI opval = LTUSI (* FLD (i_src1), * FLD (i_src2));
1036 CPU (h_cond) = opval;
1037 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
1044 CASE (sem, INSN_CMPUI) : /* cmpui $src2,$simm16 */
1046 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1047 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1048 #define FLD(f) abuf->fields.fmt_cmpi.f
1049 int UNUSED written = 0;
1050 PCADDR UNUSED pc = abuf->addr;
1051 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1054 BI opval = LTUSI (* FLD (i_src2), FLD (f_simm16));
1055 CPU (h_cond) = opval;
1056 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
1063 CASE (sem, INSN_DIV) : /* div $dr,$sr */
1065 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1066 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1067 #define FLD(f) abuf->fields.fmt_div.f
1068 int UNUSED written = 0;
1069 PCADDR UNUSED pc = abuf->addr;
1070 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1072 if (NESI (* FLD (i_sr), 0)) {
1074 SI opval = DIVSI (* FLD (i_dr), * FLD (i_sr));
1075 * FLD (i_dr) = opval;
1076 written |= (1 << 2);
1077 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1081 abuf->written = written;
1086 CASE (sem, INSN_DIVU) : /* divu $dr,$sr */
1088 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1089 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1090 #define FLD(f) abuf->fields.fmt_div.f
1091 int UNUSED written = 0;
1092 PCADDR UNUSED pc = abuf->addr;
1093 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1095 if (NESI (* FLD (i_sr), 0)) {
1097 SI opval = UDIVSI (* FLD (i_dr), * FLD (i_sr));
1098 * FLD (i_dr) = opval;
1099 written |= (1 << 2);
1100 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1104 abuf->written = written;
1109 CASE (sem, INSN_REM) : /* rem $dr,$sr */
1111 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1112 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1113 #define FLD(f) abuf->fields.fmt_div.f
1114 int UNUSED written = 0;
1115 PCADDR UNUSED pc = abuf->addr;
1116 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1118 if (NESI (* FLD (i_sr), 0)) {
1120 SI opval = MODSI (* FLD (i_dr), * FLD (i_sr));
1121 * FLD (i_dr) = opval;
1122 written |= (1 << 2);
1123 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1127 abuf->written = written;
1132 CASE (sem, INSN_REMU) : /* remu $dr,$sr */
1134 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1135 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1136 #define FLD(f) abuf->fields.fmt_div.f
1137 int UNUSED written = 0;
1138 PCADDR UNUSED pc = abuf->addr;
1139 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1141 if (NESI (* FLD (i_sr), 0)) {
1143 SI opval = UMODSI (* FLD (i_dr), * FLD (i_sr));
1144 * FLD (i_dr) = opval;
1145 written |= (1 << 2);
1146 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1150 abuf->written = written;
1155 CASE (sem, INSN_JL) : /* jl $sr */
1157 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1158 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1159 #define FLD(f) abuf->fields.cti.fields.fmt_jl.f
1160 int UNUSED written = 0;
1161 PCADDR UNUSED pc = abuf->addr;
1163 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1167 temp0 = ADDSI (ANDSI (pc, -4), 4);
1168 temp1 = ANDSI (* FLD (i_sr), -4);
1171 CPU (h_gr[((UINT) 14)]) = opval;
1172 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
1176 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1177 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1186 CASE (sem, INSN_JMP) : /* jmp $sr */
1188 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1189 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1190 #define FLD(f) abuf->fields.cti.fields.fmt_jmp.f
1191 int UNUSED written = 0;
1192 PCADDR UNUSED pc = abuf->addr;
1194 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1197 USI opval = ANDSI (* FLD (i_sr), -4);
1198 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1199 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1207 CASE (sem, INSN_LD) : /* ld $dr,@$sr */
1209 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1210 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1211 #define FLD(f) abuf->fields.fmt_ld.f
1212 int UNUSED written = 0;
1213 PCADDR UNUSED pc = abuf->addr;
1214 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1217 SI opval = GETMEMSI (current_cpu, * FLD (i_sr));
1218 * FLD (i_dr) = opval;
1219 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1226 CASE (sem, INSN_LD_D) : /* ld $dr,@($slo16,$sr) */
1228 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1229 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1230 #define FLD(f) abuf->fields.fmt_ld_d.f
1231 int UNUSED written = 0;
1232 PCADDR UNUSED pc = abuf->addr;
1233 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1236 SI opval = GETMEMSI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16)));
1237 * FLD (i_dr) = opval;
1238 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1245 CASE (sem, INSN_LDB) : /* ldb $dr,@$sr */
1247 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1248 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1249 #define FLD(f) abuf->fields.fmt_ldb.f
1250 int UNUSED written = 0;
1251 PCADDR UNUSED pc = abuf->addr;
1252 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1255 SI opval = EXTQISI (GETMEMQI (current_cpu, * FLD (i_sr)));
1256 * FLD (i_dr) = opval;
1257 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1264 CASE (sem, INSN_LDB_D) : /* ldb $dr,@($slo16,$sr) */
1266 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1267 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1268 #define FLD(f) abuf->fields.fmt_ldb_d.f
1269 int UNUSED written = 0;
1270 PCADDR UNUSED pc = abuf->addr;
1271 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1274 SI opval = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1275 * FLD (i_dr) = opval;
1276 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1283 CASE (sem, INSN_LDH) : /* ldh $dr,@$sr */
1285 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1286 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1287 #define FLD(f) abuf->fields.fmt_ldh.f
1288 int UNUSED written = 0;
1289 PCADDR UNUSED pc = abuf->addr;
1290 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1293 SI opval = EXTHISI (GETMEMHI (current_cpu, * FLD (i_sr)));
1294 * FLD (i_dr) = opval;
1295 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1302 CASE (sem, INSN_LDH_D) : /* ldh $dr,@($slo16,$sr) */
1304 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1305 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1306 #define FLD(f) abuf->fields.fmt_ldh_d.f
1307 int UNUSED written = 0;
1308 PCADDR UNUSED pc = abuf->addr;
1309 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1312 SI opval = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1313 * FLD (i_dr) = opval;
1314 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1321 CASE (sem, INSN_LDUB) : /* ldub $dr,@$sr */
1323 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1324 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1325 #define FLD(f) abuf->fields.fmt_ldb.f
1326 int UNUSED written = 0;
1327 PCADDR UNUSED pc = abuf->addr;
1328 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1331 SI opval = ZEXTQISI (GETMEMQI (current_cpu, * FLD (i_sr)));
1332 * FLD (i_dr) = opval;
1333 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1340 CASE (sem, INSN_LDUB_D) : /* ldub $dr,@($slo16,$sr) */
1342 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1343 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1344 #define FLD(f) abuf->fields.fmt_ldb_d.f
1345 int UNUSED written = 0;
1346 PCADDR UNUSED pc = abuf->addr;
1347 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1350 SI opval = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1351 * FLD (i_dr) = opval;
1352 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1359 CASE (sem, INSN_LDUH) : /* lduh $dr,@$sr */
1361 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1362 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1363 #define FLD(f) abuf->fields.fmt_ldh.f
1364 int UNUSED written = 0;
1365 PCADDR UNUSED pc = abuf->addr;
1366 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1369 SI opval = ZEXTHISI (GETMEMHI (current_cpu, * FLD (i_sr)));
1370 * FLD (i_dr) = opval;
1371 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1378 CASE (sem, INSN_LDUH_D) : /* lduh $dr,@($slo16,$sr) */
1380 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1381 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1382 #define FLD(f) abuf->fields.fmt_ldh_d.f
1383 int UNUSED written = 0;
1384 PCADDR UNUSED pc = abuf->addr;
1385 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1388 SI opval = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1389 * FLD (i_dr) = opval;
1390 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1397 CASE (sem, INSN_LD_PLUS) : /* ld $dr,@$sr+ */
1399 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1400 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1401 #define FLD(f) abuf->fields.fmt_ld_plus.f
1402 int UNUSED written = 0;
1403 PCADDR UNUSED pc = abuf->addr;
1404 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1408 temp0 = GETMEMSI (current_cpu, * FLD (i_sr));
1409 temp1 = ADDSI (* FLD (i_sr), 4);
1412 * FLD (i_dr) = opval;
1413 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1417 * FLD (i_sr) = opval;
1418 TRACE_RESULT (current_cpu, abuf, "sr", 'x', opval);
1426 CASE (sem, INSN_LD24) : /* ld24 $dr,$uimm24 */
1428 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1429 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1430 #define FLD(f) abuf->fields.fmt_ld24.f
1431 int UNUSED written = 0;
1432 PCADDR UNUSED pc = abuf->addr;
1433 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1436 SI opval = FLD (i_uimm24);
1437 * FLD (i_dr) = opval;
1438 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1445 CASE (sem, INSN_LDI8) : /* ldi8 $dr,$simm8 */
1447 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1448 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1449 #define FLD(f) abuf->fields.fmt_ldi8.f
1450 int UNUSED written = 0;
1451 PCADDR UNUSED pc = abuf->addr;
1452 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1455 SI opval = FLD (f_simm8);
1456 * FLD (i_dr) = opval;
1457 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1464 CASE (sem, INSN_LDI16) : /* ldi16 $dr,$hash$slo16 */
1466 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1467 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1468 #define FLD(f) abuf->fields.fmt_ldi16.f
1469 int UNUSED written = 0;
1470 PCADDR UNUSED pc = abuf->addr;
1471 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1474 SI opval = FLD (f_simm16);
1475 * FLD (i_dr) = opval;
1476 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1483 CASE (sem, INSN_LOCK) : /* lock $dr,@$sr */
1485 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1486 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1487 #define FLD(f) abuf->fields.fmt_lock.f
1488 int UNUSED written = 0;
1489 PCADDR UNUSED pc = abuf->addr;
1490 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1495 CPU (h_lock) = opval;
1496 TRACE_RESULT (current_cpu, abuf, "lock-0", 'x', opval);
1499 SI opval = GETMEMSI (current_cpu, * FLD (i_sr));
1500 * FLD (i_dr) = opval;
1501 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1509 CASE (sem, INSN_MACHI) : /* machi $src1,$src2 */
1511 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1512 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1513 #define FLD(f) abuf->fields.fmt_machi.f
1514 int UNUSED written = 0;
1515 PCADDR UNUSED pc = abuf->addr;
1516 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1519 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16))))), 8), 8);
1520 m32rbf_h_accum_set (current_cpu, opval);
1521 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1528 CASE (sem, INSN_MACLO) : /* maclo $src1,$src2 */
1530 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1531 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1532 #define FLD(f) abuf->fields.fmt_machi.f
1533 int UNUSED written = 0;
1534 PCADDR UNUSED pc = abuf->addr;
1535 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1538 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
1539 m32rbf_h_accum_set (current_cpu, opval);
1540 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1547 CASE (sem, INSN_MACWHI) : /* macwhi $src1,$src2 */
1549 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1550 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1551 #define FLD(f) abuf->fields.fmt_machi.f
1552 int UNUSED written = 0;
1553 PCADDR UNUSED pc = abuf->addr;
1554 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1557 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16))))), 8), 8);
1558 m32rbf_h_accum_set (current_cpu, opval);
1559 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1566 CASE (sem, INSN_MACWLO) : /* macwlo $src1,$src2 */
1568 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1569 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1570 #define FLD(f) abuf->fields.fmt_machi.f
1571 int UNUSED written = 0;
1572 PCADDR UNUSED pc = abuf->addr;
1573 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1576 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
1577 m32rbf_h_accum_set (current_cpu, opval);
1578 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1585 CASE (sem, INSN_MUL) : /* mul $dr,$sr */
1587 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1588 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1589 #define FLD(f) abuf->fields.fmt_add.f
1590 int UNUSED written = 0;
1591 PCADDR UNUSED pc = abuf->addr;
1592 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1595 SI opval = MULSI (* FLD (i_dr), * FLD (i_sr));
1596 * FLD (i_dr) = opval;
1597 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1604 CASE (sem, INSN_MULHI) : /* mulhi $src1,$src2 */
1606 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1607 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1608 #define FLD(f) abuf->fields.fmt_mulhi.f
1609 int UNUSED written = 0;
1610 PCADDR UNUSED pc = abuf->addr;
1611 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1614 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 16), 16);
1615 m32rbf_h_accum_set (current_cpu, opval);
1616 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1623 CASE (sem, INSN_MULLO) : /* mullo $src1,$src2 */
1625 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1626 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1627 #define FLD(f) abuf->fields.fmt_mulhi.f
1628 int UNUSED written = 0;
1629 PCADDR UNUSED pc = abuf->addr;
1630 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1633 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 16), 16);
1634 m32rbf_h_accum_set (current_cpu, opval);
1635 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1642 CASE (sem, INSN_MULWHI) : /* mulwhi $src1,$src2 */
1644 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1645 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1646 #define FLD(f) abuf->fields.fmt_mulhi.f
1647 int UNUSED written = 0;
1648 PCADDR UNUSED pc = abuf->addr;
1649 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1652 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 8), 8);
1653 m32rbf_h_accum_set (current_cpu, opval);
1654 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1661 CASE (sem, INSN_MULWLO) : /* mulwlo $src1,$src2 */
1663 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1664 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1665 #define FLD(f) abuf->fields.fmt_mulhi.f
1666 int UNUSED written = 0;
1667 PCADDR UNUSED pc = abuf->addr;
1668 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1671 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 8), 8);
1672 m32rbf_h_accum_set (current_cpu, opval);
1673 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1680 CASE (sem, INSN_MV) : /* mv $dr,$sr */
1682 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1683 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1684 #define FLD(f) abuf->fields.fmt_mv.f
1685 int UNUSED written = 0;
1686 PCADDR UNUSED pc = abuf->addr;
1687 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1690 SI opval = * FLD (i_sr);
1691 * FLD (i_dr) = opval;
1692 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1699 CASE (sem, INSN_MVFACHI) : /* mvfachi $dr */
1701 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1702 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1703 #define FLD(f) abuf->fields.fmt_mvfachi.f
1704 int UNUSED written = 0;
1705 PCADDR UNUSED pc = abuf->addr;
1706 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1709 SI opval = TRUNCDISI (SRADI (m32rbf_h_accum_get (current_cpu), 32));
1710 * FLD (i_dr) = opval;
1711 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1718 CASE (sem, INSN_MVFACLO) : /* mvfaclo $dr */
1720 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1721 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1722 #define FLD(f) abuf->fields.fmt_mvfachi.f
1723 int UNUSED written = 0;
1724 PCADDR UNUSED pc = abuf->addr;
1725 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1728 SI opval = TRUNCDISI (m32rbf_h_accum_get (current_cpu));
1729 * FLD (i_dr) = opval;
1730 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1737 CASE (sem, INSN_MVFACMI) : /* mvfacmi $dr */
1739 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1740 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1741 #define FLD(f) abuf->fields.fmt_mvfachi.f
1742 int UNUSED written = 0;
1743 PCADDR UNUSED pc = abuf->addr;
1744 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1747 SI opval = TRUNCDISI (SRADI (m32rbf_h_accum_get (current_cpu), 16));
1748 * FLD (i_dr) = opval;
1749 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1756 CASE (sem, INSN_MVFC) : /* mvfc $dr,$scr */
1758 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1759 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1760 #define FLD(f) abuf->fields.fmt_mvfc.f
1761 int UNUSED written = 0;
1762 PCADDR UNUSED pc = abuf->addr;
1763 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1766 SI opval = m32rbf_h_cr_get (current_cpu, FLD (f_r2));
1767 * FLD (i_dr) = opval;
1768 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1775 CASE (sem, INSN_MVTACHI) : /* mvtachi $src1 */
1777 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1778 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1779 #define FLD(f) abuf->fields.fmt_mvtachi.f
1780 int UNUSED written = 0;
1781 PCADDR UNUSED pc = abuf->addr;
1782 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1785 DI opval = ORDI (ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (i_src1)), 32));
1786 m32rbf_h_accum_set (current_cpu, opval);
1787 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1794 CASE (sem, INSN_MVTACLO) : /* mvtaclo $src1 */
1796 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1797 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1798 #define FLD(f) abuf->fields.fmt_mvtachi.f
1799 int UNUSED written = 0;
1800 PCADDR UNUSED pc = abuf->addr;
1801 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1804 DI opval = ORDI (ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (i_src1)));
1805 m32rbf_h_accum_set (current_cpu, opval);
1806 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1813 CASE (sem, INSN_MVTC) : /* mvtc $sr,$dcr */
1815 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1816 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1817 #define FLD(f) abuf->fields.fmt_mvtc.f
1818 int UNUSED written = 0;
1819 PCADDR UNUSED pc = abuf->addr;
1820 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1823 USI opval = * FLD (i_sr);
1824 m32rbf_h_cr_set (current_cpu, FLD (f_r1), opval);
1825 TRACE_RESULT (current_cpu, abuf, "dcr", 'x', opval);
1832 CASE (sem, INSN_NEG) : /* neg $dr,$sr */
1834 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1835 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1836 #define FLD(f) abuf->fields.fmt_mv.f
1837 int UNUSED written = 0;
1838 PCADDR UNUSED pc = abuf->addr;
1839 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1842 SI opval = NEGSI (* FLD (i_sr));
1843 * FLD (i_dr) = opval;
1844 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1851 CASE (sem, INSN_NOP) : /* nop */
1853 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1854 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1855 #define FLD(f) abuf->fields.fmt_nop.f
1856 int UNUSED written = 0;
1857 PCADDR UNUSED pc = abuf->addr;
1858 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1860 PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
1866 CASE (sem, INSN_NOT) : /* not $dr,$sr */
1868 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1869 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1870 #define FLD(f) abuf->fields.fmt_mv.f
1871 int UNUSED written = 0;
1872 PCADDR UNUSED pc = abuf->addr;
1873 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1876 SI opval = INVSI (* FLD (i_sr));
1877 * FLD (i_dr) = opval;
1878 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1885 CASE (sem, INSN_RAC) : /* rac */
1887 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1888 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1889 #define FLD(f) abuf->fields.fmt_rac.f
1890 int UNUSED written = 0;
1891 PCADDR UNUSED pc = abuf->addr;
1892 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1896 tmp_tmp1 = SLLDI (m32rbf_h_accum_get (current_cpu), 1);
1897 tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768));
1899 DI opval = (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000)));
1900 m32rbf_h_accum_set (current_cpu, opval);
1901 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1909 CASE (sem, INSN_RACH) : /* rach */
1911 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1912 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1913 #define FLD(f) abuf->fields.fmt_rac.f
1914 int UNUSED written = 0;
1915 PCADDR UNUSED pc = abuf->addr;
1916 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1920 tmp_tmp1 = ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (16777215, 0xffffffff));
1921 if (ANDIF (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
1922 tmp_tmp1 = MAKEDI (16383, 0x80000000);
1924 if (ANDIF (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
1925 tmp_tmp1 = MAKEDI (16760832, 0);
1927 tmp_tmp1 = ANDDI (ADDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
1930 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
1932 DI opval = SRADI (SLLDI (tmp_tmp1, 7), 7);
1933 m32rbf_h_accum_set (current_cpu, opval);
1934 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1942 CASE (sem, INSN_RTE) : /* rte */
1944 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1945 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1946 #define FLD(f) abuf->fields.cti.fields.fmt_rte.f
1947 int UNUSED written = 0;
1948 PCADDR UNUSED pc = abuf->addr;
1950 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1954 USI opval = ANDSI (m32rbf_h_cr_get (current_cpu, ((UINT) 6)), -4);
1955 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1956 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1959 USI opval = m32rbf_h_cr_get (current_cpu, ((UINT) 14));
1960 m32rbf_h_cr_set (current_cpu, ((UINT) 6), opval);
1961 TRACE_RESULT (current_cpu, abuf, "cr-6", 'x', opval);
1964 UQI opval = CPU (h_bpsw);
1965 m32rbf_h_psw_set (current_cpu, opval);
1966 TRACE_RESULT (current_cpu, abuf, "psw-0", 'x', opval);
1969 UQI opval = CPU (h_bbpsw);
1970 CPU (h_bpsw) = opval;
1971 TRACE_RESULT (current_cpu, abuf, "bpsw-0", 'x', opval);
1980 CASE (sem, INSN_SETH) : /* seth $dr,$hash$hi16 */
1982 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1983 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1984 #define FLD(f) abuf->fields.fmt_seth.f
1985 int UNUSED written = 0;
1986 PCADDR UNUSED pc = abuf->addr;
1987 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1990 SI opval = SLLSI (FLD (f_hi16), 16);
1991 * FLD (i_dr) = opval;
1992 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1999 CASE (sem, INSN_SLL) : /* sll $dr,$sr */
2001 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2002 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2003 #define FLD(f) abuf->fields.fmt_add.f
2004 int UNUSED written = 0;
2005 PCADDR UNUSED pc = abuf->addr;
2006 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2009 SI opval = SLLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2010 * FLD (i_dr) = opval;
2011 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2018 CASE (sem, INSN_SLL3) : /* sll3 $dr,$sr,$simm16 */
2020 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2021 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2022 #define FLD(f) abuf->fields.fmt_sll3.f
2023 int UNUSED written = 0;
2024 PCADDR UNUSED pc = abuf->addr;
2025 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2028 SI opval = SLLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2029 * FLD (i_dr) = opval;
2030 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2037 CASE (sem, INSN_SLLI) : /* slli $dr,$uimm5 */
2039 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2040 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2041 #define FLD(f) abuf->fields.fmt_slli.f
2042 int UNUSED written = 0;
2043 PCADDR UNUSED pc = abuf->addr;
2044 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2047 SI opval = SLLSI (* FLD (i_dr), FLD (f_uimm5));
2048 * FLD (i_dr) = opval;
2049 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2056 CASE (sem, INSN_SRA) : /* sra $dr,$sr */
2058 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2059 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2060 #define FLD(f) abuf->fields.fmt_add.f
2061 int UNUSED written = 0;
2062 PCADDR UNUSED pc = abuf->addr;
2063 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2066 SI opval = SRASI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2067 * FLD (i_dr) = opval;
2068 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2075 CASE (sem, INSN_SRA3) : /* sra3 $dr,$sr,$simm16 */
2077 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2078 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2079 #define FLD(f) abuf->fields.fmt_sll3.f
2080 int UNUSED written = 0;
2081 PCADDR UNUSED pc = abuf->addr;
2082 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2085 SI opval = SRASI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2086 * FLD (i_dr) = opval;
2087 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2094 CASE (sem, INSN_SRAI) : /* srai $dr,$uimm5 */
2096 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2097 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2098 #define FLD(f) abuf->fields.fmt_slli.f
2099 int UNUSED written = 0;
2100 PCADDR UNUSED pc = abuf->addr;
2101 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2104 SI opval = SRASI (* FLD (i_dr), FLD (f_uimm5));
2105 * FLD (i_dr) = opval;
2106 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2113 CASE (sem, INSN_SRL) : /* srl $dr,$sr */
2115 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2116 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2117 #define FLD(f) abuf->fields.fmt_add.f
2118 int UNUSED written = 0;
2119 PCADDR UNUSED pc = abuf->addr;
2120 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2123 SI opval = SRLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2124 * FLD (i_dr) = opval;
2125 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2132 CASE (sem, INSN_SRL3) : /* srl3 $dr,$sr,$simm16 */
2134 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2135 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2136 #define FLD(f) abuf->fields.fmt_sll3.f
2137 int UNUSED written = 0;
2138 PCADDR UNUSED pc = abuf->addr;
2139 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2142 SI opval = SRLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2143 * FLD (i_dr) = opval;
2144 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2151 CASE (sem, INSN_SRLI) : /* srli $dr,$uimm5 */
2153 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2154 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2155 #define FLD(f) abuf->fields.fmt_slli.f
2156 int UNUSED written = 0;
2157 PCADDR UNUSED pc = abuf->addr;
2158 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2161 SI opval = SRLSI (* FLD (i_dr), FLD (f_uimm5));
2162 * FLD (i_dr) = opval;
2163 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2170 CASE (sem, INSN_ST) : /* st $src1,@$src2 */
2172 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2173 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2174 #define FLD(f) abuf->fields.fmt_st.f
2175 int UNUSED written = 0;
2176 PCADDR UNUSED pc = abuf->addr;
2177 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2180 SI opval = * FLD (i_src1);
2181 SETMEMSI (current_cpu, * FLD (i_src2), opval);
2182 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2189 CASE (sem, INSN_ST_D) : /* st $src1,@($slo16,$src2) */
2191 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2192 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2193 #define FLD(f) abuf->fields.fmt_st_d.f
2194 int UNUSED written = 0;
2195 PCADDR UNUSED pc = abuf->addr;
2196 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2199 SI opval = * FLD (i_src1);
2200 SETMEMSI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2201 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2208 CASE (sem, INSN_STB) : /* stb $src1,@$src2 */
2210 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2211 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2212 #define FLD(f) abuf->fields.fmt_stb.f
2213 int UNUSED written = 0;
2214 PCADDR UNUSED pc = abuf->addr;
2215 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2218 QI opval = * FLD (i_src1);
2219 SETMEMQI (current_cpu, * FLD (i_src2), opval);
2220 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2227 CASE (sem, INSN_STB_D) : /* stb $src1,@($slo16,$src2) */
2229 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2230 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2231 #define FLD(f) abuf->fields.fmt_stb_d.f
2232 int UNUSED written = 0;
2233 PCADDR UNUSED pc = abuf->addr;
2234 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2237 QI opval = * FLD (i_src1);
2238 SETMEMQI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2239 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2246 CASE (sem, INSN_STH) : /* sth $src1,@$src2 */
2248 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2249 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2250 #define FLD(f) abuf->fields.fmt_sth.f
2251 int UNUSED written = 0;
2252 PCADDR UNUSED pc = abuf->addr;
2253 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2256 HI opval = * FLD (i_src1);
2257 SETMEMHI (current_cpu, * FLD (i_src2), opval);
2258 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2265 CASE (sem, INSN_STH_D) : /* sth $src1,@($slo16,$src2) */
2267 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2268 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2269 #define FLD(f) abuf->fields.fmt_sth_d.f
2270 int UNUSED written = 0;
2271 PCADDR UNUSED pc = abuf->addr;
2272 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2275 HI opval = * FLD (i_src1);
2276 SETMEMHI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2277 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2284 CASE (sem, INSN_ST_PLUS) : /* st $src1,@+$src2 */
2286 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2287 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2288 #define FLD(f) abuf->fields.fmt_st_plus.f
2289 int UNUSED written = 0;
2290 PCADDR UNUSED pc = abuf->addr;
2291 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2295 tmp_new_src2 = ADDSI (* FLD (i_src2), 4);
2297 SI opval = * FLD (i_src1);
2298 SETMEMSI (current_cpu, tmp_new_src2, opval);
2299 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2302 SI opval = tmp_new_src2;
2303 * FLD (i_src2) = opval;
2304 TRACE_RESULT (current_cpu, abuf, "src2", 'x', opval);
2312 CASE (sem, INSN_ST_MINUS) : /* st $src1,@-$src2 */
2314 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2315 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2316 #define FLD(f) abuf->fields.fmt_st_plus.f
2317 int UNUSED written = 0;
2318 PCADDR UNUSED pc = abuf->addr;
2319 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2323 tmp_new_src2 = SUBSI (* FLD (i_src2), 4);
2325 SI opval = * FLD (i_src1);
2326 SETMEMSI (current_cpu, tmp_new_src2, opval);
2327 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2330 SI opval = tmp_new_src2;
2331 * FLD (i_src2) = opval;
2332 TRACE_RESULT (current_cpu, abuf, "src2", 'x', opval);
2340 CASE (sem, INSN_SUB) : /* sub $dr,$sr */
2342 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2343 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2344 #define FLD(f) abuf->fields.fmt_add.f
2345 int UNUSED written = 0;
2346 PCADDR UNUSED pc = abuf->addr;
2347 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2350 SI opval = SUBSI (* FLD (i_dr), * FLD (i_sr));
2351 * FLD (i_dr) = opval;
2352 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2359 CASE (sem, INSN_SUBV) : /* subv $dr,$sr */
2361 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2362 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2363 #define FLD(f) abuf->fields.fmt_addv.f
2364 int UNUSED written = 0;
2365 PCADDR UNUSED pc = abuf->addr;
2366 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2370 temp0 = SUBSI (* FLD (i_dr), * FLD (i_sr));
2371 temp1 = SUBOFSI (* FLD (i_dr), * FLD (i_sr), 0);
2374 * FLD (i_dr) = opval;
2375 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2379 CPU (h_cond) = opval;
2380 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
2388 CASE (sem, INSN_SUBX) : /* subx $dr,$sr */
2390 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2391 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2392 #define FLD(f) abuf->fields.fmt_addx.f
2393 int UNUSED written = 0;
2394 PCADDR UNUSED pc = abuf->addr;
2395 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2399 temp0 = SUBCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
2400 temp1 = SUBCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
2403 * FLD (i_dr) = opval;
2404 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2408 CPU (h_cond) = opval;
2409 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
2417 CASE (sem, INSN_TRAP) : /* trap $uimm4 */
2419 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2420 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2421 #define FLD(f) abuf->fields.cti.fields.fmt_trap.f
2422 int UNUSED written = 0;
2423 PCADDR UNUSED pc = abuf->addr;
2425 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2429 USI opval = m32rbf_h_cr_get (current_cpu, ((UINT) 6));
2430 m32rbf_h_cr_set (current_cpu, ((UINT) 14), opval);
2431 TRACE_RESULT (current_cpu, abuf, "cr-14", 'x', opval);
2434 USI opval = ADDSI (pc, 4);
2435 m32rbf_h_cr_set (current_cpu, ((UINT) 6), opval);
2436 TRACE_RESULT (current_cpu, abuf, "cr-6", 'x', opval);
2439 UQI opval = CPU (h_bpsw);
2440 CPU (h_bbpsw) = opval;
2441 TRACE_RESULT (current_cpu, abuf, "bbpsw-0", 'x', opval);
2444 UQI opval = m32rbf_h_psw_get (current_cpu);
2445 CPU (h_bpsw) = opval;
2446 TRACE_RESULT (current_cpu, abuf, "bpsw-0", 'x', opval);
2449 UQI opval = ANDQI (m32rbf_h_psw_get (current_cpu), 128);
2450 m32rbf_h_psw_set (current_cpu, opval);
2451 TRACE_RESULT (current_cpu, abuf, "psw-0", 'x', opval);
2454 SI opval = m32r_trap (current_cpu, pc, FLD (f_uimm4));
2455 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2456 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
2465 CASE (sem, INSN_UNLOCK) : /* unlock $src1,@$src2 */
2467 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2468 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2469 #define FLD(f) abuf->fields.fmt_unlock.f
2470 int UNUSED written = 0;
2471 PCADDR UNUSED pc = abuf->addr;
2472 vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2477 SI opval = * FLD (i_src1);
2478 SETMEMSI (current_cpu, * FLD (i_src2), opval);
2479 written |= (1 << 3);
2480 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2485 CPU (h_lock) = opval;
2486 TRACE_RESULT (current_cpu, abuf, "lock-0", 'x', opval);
2490 abuf->written = written;
2497 ENDSWITCH (sem) /* End of semantic switch. */
2499 /* At this point `vpc' contains the next insn to execute. */
2502 #undef DEFINE_SWITCH
2503 #endif /* DEFINE_SWITCH */