* configure.in: Call SIM_AC_OPTION_INLINE.
[deliverable/binutils-gdb.git] / sim / m32r / sem.c
CommitLineData
99c53aa9 1/* Simulator instruction semantics for m32rbf.
646c6f2b 2
190659a2 3THIS FILE IS MACHINE GENERATED WITH CGEN.
b8a9943d 4
9d70630e 5Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
646c6f2b 6
9d70630e 7This file is part of the GNU Simulators.
646c6f2b
DE
8
9This program is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2, or (at your option)
12any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License along
20with this program; if not, write to the Free Software Foundation, Inc.,
2159 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23*/
24
9d70630e 25#define WANT_CPU
99c53aa9 26#define WANT_CPU_M32RBF
9d70630e 27
646c6f2b 28#include "sim-main.h"
9d70630e
DE
29#include "cgen-mem.h"
30#include "cgen-ops.h"
9d70630e
DE
31
32#undef GET_ATTR
a8981d67
DE
33#define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->idesc->opcode, CGEN_INSN_##attr)
34
99c53aa9 35/* x-invalid: --invalid-- */
9d70630e 36
99c53aa9
DE
37SEM_PC
38SEM_FN_NAME (m32rbf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 39{
99c53aa9 40#define FLD(f) abuf->fields.fmt_empty.f
646c6f2b 41 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
42 int UNUSED written = 0;
43 PCADDR UNUSED pc = abuf->addr;
44 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
b8a9943d 45
190659a2 46 {
99c53aa9
DE
47#if WITH_SCACHE
48 /* Update the recorded pc in the cpu state struct. */
49 SET_H_PC (pc);
50#endif
51 sim_engine_invalid_insn (current_cpu, pc);
52 sim_io_error (CPU_STATE (current_cpu), "invalid insn not handled\n");
53 /* NOTREACHED */
190659a2 54 }
b8a9943d 55
99c53aa9
DE
56 return vpc;
57#undef FLD
58}
59
60/* x-after: --after-- */
61
62SEM_PC
63SEM_FN_NAME (m32rbf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
64{
65#define FLD(f) abuf->fields.fmt_empty.f
66 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
67 int UNUSED written = 0;
68 PCADDR UNUSED pc = abuf->addr;
69 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
a8981d67 70
99c53aa9
DE
71 {
72#if WITH_SCACHE_PBB
73 m32rbf_pbb_after (current_cpu, sem_arg);
646c6f2b 74#endif
99c53aa9 75 }
b8a9943d 76
99c53aa9 77 return vpc;
646c6f2b
DE
78#undef FLD
79}
80
99c53aa9 81/* x-before: --before-- */
a8981d67 82
99c53aa9
DE
83SEM_PC
84SEM_FN_NAME (m32rbf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 85{
99c53aa9 86#define FLD(f) abuf->fields.fmt_empty.f
646c6f2b 87 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
88 int UNUSED written = 0;
89 PCADDR UNUSED pc = abuf->addr;
90 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
b8a9943d 91
190659a2 92 {
99c53aa9
DE
93#if WITH_SCACHE_PBB
94 m32rbf_pbb_before (current_cpu, sem_arg);
95#endif
190659a2 96 }
b8a9943d 97
99c53aa9
DE
98 return vpc;
99#undef FLD
100}
101
102/* x-cti-chain: --cti-chain-- */
103
104SEM_PC
105SEM_FN_NAME (m32rbf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
106{
107#define FLD(f) abuf->fields.fmt_empty.f
108 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
109 int UNUSED written = 0;
110 PCADDR UNUSED pc = abuf->addr;
111 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
a8981d67 112
99c53aa9
DE
113 {
114#if WITH_SCACHE_PBB
115#ifdef DEFINE_SWITCH
116 vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
117 pbb_br_npc_ptr, pbb_br_npc);
118 BREAK (sem);
119#else
120 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
121 vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
122 CPU_PBB_BR_NPC_PTR (current_cpu),
123 CPU_PBB_BR_NPC (current_cpu));
646c6f2b 124#endif
99c53aa9
DE
125#endif
126 }
b8a9943d 127
99c53aa9 128 return vpc;
646c6f2b
DE
129#undef FLD
130}
131
99c53aa9 132/* x-chain: --chain-- */
a8981d67 133
99c53aa9
DE
134SEM_PC
135SEM_FN_NAME (m32rbf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 136{
99c53aa9 137#define FLD(f) abuf->fields.fmt_empty.f
646c6f2b 138 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
139 int UNUSED written = 0;
140 PCADDR UNUSED pc = abuf->addr;
141 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
b8a9943d 142
190659a2 143 {
99c53aa9
DE
144#if WITH_SCACHE_PBB
145 vpc = m32rbf_pbb_chain (current_cpu, sem_arg);
146#ifdef DEFINE_SWITCH
147 BREAK (sem);
148#endif
149#endif
190659a2 150 }
b8a9943d 151
99c53aa9
DE
152 return vpc;
153#undef FLD
154}
155
156/* x-begin: --begin-- */
157
158SEM_PC
159SEM_FN_NAME (m32rbf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
160{
161#define FLD(f) abuf->fields.fmt_empty.f
162 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
163 int UNUSED written = 0;
164 PCADDR UNUSED pc = abuf->addr;
165 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
a8981d67 166
99c53aa9
DE
167 {
168#if WITH_SCACHE_PBB
169#ifdef DEFINE_SWITCH
170 /* In the switch case FAST_P is a constant, allowing several optimizations
171 in any called inline functions. */
172 vpc = m32rbf_pbb_begin (current_cpu, FAST_P);
173#else
174 vpc = m32rbf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
175#endif
646c6f2b 176#endif
99c53aa9 177 }
b8a9943d 178
99c53aa9 179 return vpc;
646c6f2b
DE
180#undef FLD
181}
182
99c53aa9 183/* add: add $dr,$sr */
a8981d67 184
99c53aa9
DE
185SEM_PC
186SEM_FN_NAME (m32rbf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 187{
99c53aa9 188#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 189 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
190 int UNUSED written = 0;
191 PCADDR UNUSED pc = abuf->addr;
192 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 193
190659a2 194 {
99c53aa9
DE
195 SI opval = ADDSI (* FLD (i_dr), * FLD (i_sr));
196 * FLD (i_dr) = opval;
0a18a6b8 197 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 198 }
b8a9943d 199
99c53aa9
DE
200 return vpc;
201#undef FLD
202}
a8981d67 203
99c53aa9 204/* add3: add3 $dr,$sr,$hash$slo16 */
b8a9943d 205
99c53aa9
DE
206SEM_PC
207SEM_FN_NAME (m32rbf,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
208{
209#define FLD(f) abuf->fields.fmt_add3.f
210 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
211 int UNUSED written = 0;
212 PCADDR UNUSED pc = abuf->addr;
213 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
214
215 {
216 SI opval = ADDSI (* FLD (i_sr), FLD (f_simm16));
217 * FLD (i_dr) = opval;
0a18a6b8 218 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
99c53aa9
DE
219 }
220
221 return vpc;
646c6f2b
DE
222#undef FLD
223}
224
99c53aa9 225/* and: and $dr,$sr */
a8981d67 226
99c53aa9
DE
227SEM_PC
228SEM_FN_NAME (m32rbf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 229{
970a8fd6 230#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 231 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
232 int UNUSED written = 0;
233 PCADDR UNUSED pc = abuf->addr;
234 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 235
190659a2 236 {
99c53aa9
DE
237 SI opval = ANDSI (* FLD (i_dr), * FLD (i_sr));
238 * FLD (i_dr) = opval;
0a18a6b8 239 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 240 }
b8a9943d 241
99c53aa9
DE
242 return vpc;
243#undef FLD
244}
245
246/* and3: and3 $dr,$sr,$uimm16 */
a8981d67 247
99c53aa9
DE
248SEM_PC
249SEM_FN_NAME (m32rbf,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
250{
251#define FLD(f) abuf->fields.fmt_and3.f
252 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
253 int UNUSED written = 0;
254 PCADDR UNUSED pc = abuf->addr;
255 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 256
99c53aa9
DE
257 {
258 SI opval = ANDSI (* FLD (i_sr), FLD (f_uimm16));
259 * FLD (i_dr) = opval;
0a18a6b8 260 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
99c53aa9
DE
261 }
262
263 return vpc;
646c6f2b
DE
264#undef FLD
265}
266
99c53aa9 267/* or: or $dr,$sr */
a8981d67 268
99c53aa9
DE
269SEM_PC
270SEM_FN_NAME (m32rbf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 271{
99c53aa9 272#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 273 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
274 int UNUSED written = 0;
275 PCADDR UNUSED pc = abuf->addr;
276 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 277
190659a2 278 {
99c53aa9
DE
279 SI opval = ORSI (* FLD (i_dr), * FLD (i_sr));
280 * FLD (i_dr) = opval;
0a18a6b8 281 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 282 }
b8a9943d 283
99c53aa9
DE
284 return vpc;
285#undef FLD
286}
a8981d67 287
99c53aa9
DE
288/* or3: or3 $dr,$sr,$hash$ulo16 */
289
290SEM_PC
291SEM_FN_NAME (m32rbf,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
292{
293#define FLD(f) abuf->fields.fmt_or3.f
294 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
295 int UNUSED written = 0;
296 PCADDR UNUSED pc = abuf->addr;
297 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
298
299 {
300 SI opval = ORSI (* FLD (i_sr), FLD (f_uimm16));
301 * FLD (i_dr) = opval;
0a18a6b8 302 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
99c53aa9 303 }
b8a9943d 304
99c53aa9 305 return vpc;
646c6f2b
DE
306#undef FLD
307}
308
99c53aa9 309/* xor: xor $dr,$sr */
a8981d67 310
99c53aa9
DE
311SEM_PC
312SEM_FN_NAME (m32rbf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 313{
970a8fd6 314#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 315 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
316 int UNUSED written = 0;
317 PCADDR UNUSED pc = abuf->addr;
318 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 319
190659a2 320 {
99c53aa9
DE
321 SI opval = XORSI (* FLD (i_dr), * FLD (i_sr));
322 * FLD (i_dr) = opval;
0a18a6b8 323 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 324 }
b8a9943d 325
99c53aa9 326 return vpc;
646c6f2b
DE
327#undef FLD
328}
329
99c53aa9 330/* xor3: xor3 $dr,$sr,$uimm16 */
a8981d67 331
99c53aa9
DE
332SEM_PC
333SEM_FN_NAME (m32rbf,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 334{
970a8fd6 335#define FLD(f) abuf->fields.fmt_and3.f
646c6f2b 336 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
337 int UNUSED written = 0;
338 PCADDR UNUSED pc = abuf->addr;
339 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 340
190659a2 341 {
99c53aa9
DE
342 SI opval = XORSI (* FLD (i_sr), FLD (f_uimm16));
343 * FLD (i_dr) = opval;
0a18a6b8 344 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 345 }
b8a9943d 346
99c53aa9 347 return vpc;
646c6f2b
DE
348#undef FLD
349}
350
99c53aa9 351/* addi: addi $dr,$simm8 */
a8981d67 352
99c53aa9
DE
353SEM_PC
354SEM_FN_NAME (m32rbf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 355{
970a8fd6 356#define FLD(f) abuf->fields.fmt_addi.f
646c6f2b 357 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
358 int UNUSED written = 0;
359 PCADDR UNUSED pc = abuf->addr;
360 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 361
190659a2 362 {
99c53aa9
DE
363 SI opval = ADDSI (* FLD (i_dr), FLD (f_simm8));
364 * FLD (i_dr) = opval;
0a18a6b8 365 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 366 }
b8a9943d 367
99c53aa9 368 return vpc;
646c6f2b
DE
369#undef FLD
370}
371
99c53aa9 372/* addv: addv $dr,$sr */
a8981d67 373
99c53aa9
DE
374SEM_PC
375SEM_FN_NAME (m32rbf,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 376{
970a8fd6 377#define FLD(f) abuf->fields.fmt_addv.f
646c6f2b 378 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
379 int UNUSED written = 0;
380 PCADDR UNUSED pc = abuf->addr;
381 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 382
646c6f2b 383do {
99c53aa9
DE
384 BI temp1;SI temp0;
385 temp0 = ADDSI (* FLD (i_dr), * FLD (i_sr));
386 temp1 = ADDOFSI (* FLD (i_dr), * FLD (i_sr), 0);
190659a2
DE
387 {
388 SI opval = temp0;
99c53aa9 389 * FLD (i_dr) = opval;
0a18a6b8 390 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2
DE
391 }
392 {
99c53aa9 393 BI opval = temp1;
190659a2 394 CPU (h_cond) = opval;
0a18a6b8 395 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 396 }
646c6f2b 397} while (0);
b8a9943d 398
99c53aa9 399 return vpc;
646c6f2b
DE
400#undef FLD
401}
402
99c53aa9 403/* addv3: addv3 $dr,$sr,$simm16 */
a8981d67 404
99c53aa9
DE
405SEM_PC
406SEM_FN_NAME (m32rbf,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 407{
970a8fd6 408#define FLD(f) abuf->fields.fmt_addv3.f
646c6f2b 409 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
410 int UNUSED written = 0;
411 PCADDR UNUSED pc = abuf->addr;
412 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 413
646c6f2b 414do {
99c53aa9
DE
415 BI temp1;SI temp0;
416 temp0 = ADDSI (* FLD (i_sr), FLD (f_simm16));
417 temp1 = ADDOFSI (* FLD (i_sr), FLD (f_simm16), 0);
190659a2
DE
418 {
419 SI opval = temp0;
99c53aa9 420 * FLD (i_dr) = opval;
0a18a6b8 421 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2
DE
422 }
423 {
99c53aa9 424 BI opval = temp1;
190659a2 425 CPU (h_cond) = opval;
0a18a6b8 426 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 427 }
646c6f2b 428} while (0);
b8a9943d 429
99c53aa9 430 return vpc;
646c6f2b
DE
431#undef FLD
432}
433
99c53aa9 434/* addx: addx $dr,$sr */
a8981d67 435
99c53aa9
DE
436SEM_PC
437SEM_FN_NAME (m32rbf,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 438{
970a8fd6 439#define FLD(f) abuf->fields.fmt_addx.f
646c6f2b 440 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
441 int UNUSED written = 0;
442 PCADDR UNUSED pc = abuf->addr;
443 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 444
646c6f2b 445do {
99c53aa9
DE
446 BI temp1;SI temp0;
447 temp0 = ADDCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
448 temp1 = ADDCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
190659a2
DE
449 {
450 SI opval = temp0;
99c53aa9 451 * FLD (i_dr) = opval;
0a18a6b8 452 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2
DE
453 }
454 {
99c53aa9 455 BI opval = temp1;
190659a2 456 CPU (h_cond) = opval;
0a18a6b8 457 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 458 }
646c6f2b 459} while (0);
b8a9943d 460
99c53aa9 461 return vpc;
646c6f2b
DE
462#undef FLD
463}
464
99c53aa9 465/* bc8: bc.s $disp8 */
a8981d67 466
99c53aa9
DE
467SEM_PC
468SEM_FN_NAME (m32rbf,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 469{
99c53aa9 470#define FLD(f) abuf->fields.cti.fields.fmt_bc8.f
646c6f2b 471 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
472 int UNUSED written = 0;
473 PCADDR UNUSED pc = abuf->addr;
474 SEM_BRANCH_INIT
475 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 476
9d70630e 477if (CPU (h_cond)) {
190659a2
DE
478 {
479 USI opval = FLD (f_disp8);
99c53aa9
DE
480 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
481 written |= (1 << 2);
0a18a6b8 482 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 483 }
646c6f2b 484}
b8a9943d 485
99c53aa9
DE
486 abuf->written = written;
487 SEM_BRANCH_FINI
488 return vpc;
646c6f2b
DE
489#undef FLD
490}
491
99c53aa9 492/* bc24: bc.l $disp24 */
a8981d67 493
99c53aa9
DE
494SEM_PC
495SEM_FN_NAME (m32rbf,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 496{
99c53aa9 497#define FLD(f) abuf->fields.cti.fields.fmt_bc24.f
646c6f2b 498 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
499 int UNUSED written = 0;
500 PCADDR UNUSED pc = abuf->addr;
501 SEM_BRANCH_INIT
502 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 503
9d70630e 504if (CPU (h_cond)) {
190659a2
DE
505 {
506 USI opval = FLD (f_disp24);
99c53aa9
DE
507 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
508 written |= (1 << 2);
0a18a6b8 509 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 510 }
646c6f2b 511}
b8a9943d 512
99c53aa9
DE
513 abuf->written = written;
514 SEM_BRANCH_FINI
515 return vpc;
646c6f2b
DE
516#undef FLD
517}
518
99c53aa9 519/* beq: beq $src1,$src2,$disp16 */
a8981d67 520
99c53aa9
DE
521SEM_PC
522SEM_FN_NAME (m32rbf,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 523{
99c53aa9 524#define FLD(f) abuf->fields.cti.fields.fmt_beq.f
646c6f2b 525 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
526 int UNUSED written = 0;
527 PCADDR UNUSED pc = abuf->addr;
528 SEM_BRANCH_INIT
529 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 530
99c53aa9 531if (EQSI (* FLD (i_src1), * FLD (i_src2))) {
190659a2
DE
532 {
533 USI opval = FLD (f_disp16);
99c53aa9
DE
534 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
535 written |= (1 << 3);
0a18a6b8 536 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 537 }
646c6f2b 538}
b8a9943d 539
99c53aa9
DE
540 abuf->written = written;
541 SEM_BRANCH_FINI
542 return vpc;
646c6f2b
DE
543#undef FLD
544}
545
99c53aa9 546/* beqz: beqz $src2,$disp16 */
a8981d67 547
99c53aa9
DE
548SEM_PC
549SEM_FN_NAME (m32rbf,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 550{
99c53aa9 551#define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
646c6f2b 552 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
553 int UNUSED written = 0;
554 PCADDR UNUSED pc = abuf->addr;
555 SEM_BRANCH_INIT
556 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 557
99c53aa9 558if (EQSI (* FLD (i_src2), 0)) {
190659a2
DE
559 {
560 USI opval = FLD (f_disp16);
99c53aa9
DE
561 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
562 written |= (1 << 2);
0a18a6b8 563 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 564 }
646c6f2b 565}
b8a9943d 566
99c53aa9
DE
567 abuf->written = written;
568 SEM_BRANCH_FINI
569 return vpc;
646c6f2b
DE
570#undef FLD
571}
572
99c53aa9 573/* bgez: bgez $src2,$disp16 */
a8981d67 574
99c53aa9
DE
575SEM_PC
576SEM_FN_NAME (m32rbf,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 577{
99c53aa9 578#define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
646c6f2b 579 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
580 int UNUSED written = 0;
581 PCADDR UNUSED pc = abuf->addr;
582 SEM_BRANCH_INIT
583 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 584
99c53aa9 585if (GESI (* FLD (i_src2), 0)) {
190659a2
DE
586 {
587 USI opval = FLD (f_disp16);
99c53aa9
DE
588 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
589 written |= (1 << 2);
0a18a6b8 590 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 591 }
646c6f2b 592}
b8a9943d 593
99c53aa9
DE
594 abuf->written = written;
595 SEM_BRANCH_FINI
596 return vpc;
646c6f2b
DE
597#undef FLD
598}
599
99c53aa9 600/* bgtz: bgtz $src2,$disp16 */
a8981d67 601
99c53aa9
DE
602SEM_PC
603SEM_FN_NAME (m32rbf,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 604{
99c53aa9 605#define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
646c6f2b 606 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
607 int UNUSED written = 0;
608 PCADDR UNUSED pc = abuf->addr;
609 SEM_BRANCH_INIT
610 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 611
99c53aa9 612if (GTSI (* FLD (i_src2), 0)) {
190659a2
DE
613 {
614 USI opval = FLD (f_disp16);
99c53aa9
DE
615 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
616 written |= (1 << 2);
0a18a6b8 617 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 618 }
646c6f2b 619}
b8a9943d 620
99c53aa9
DE
621 abuf->written = written;
622 SEM_BRANCH_FINI
623 return vpc;
646c6f2b
DE
624#undef FLD
625}
626
99c53aa9 627/* blez: blez $src2,$disp16 */
a8981d67 628
99c53aa9
DE
629SEM_PC
630SEM_FN_NAME (m32rbf,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 631{
99c53aa9 632#define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
646c6f2b 633 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
634 int UNUSED written = 0;
635 PCADDR UNUSED pc = abuf->addr;
636 SEM_BRANCH_INIT
637 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 638
99c53aa9 639if (LESI (* FLD (i_src2), 0)) {
190659a2
DE
640 {
641 USI opval = FLD (f_disp16);
99c53aa9
DE
642 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
643 written |= (1 << 2);
0a18a6b8 644 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 645 }
646c6f2b 646}
b8a9943d 647
99c53aa9
DE
648 abuf->written = written;
649 SEM_BRANCH_FINI
650 return vpc;
646c6f2b
DE
651#undef FLD
652}
653
99c53aa9 654/* bltz: bltz $src2,$disp16 */
a8981d67 655
99c53aa9
DE
656SEM_PC
657SEM_FN_NAME (m32rbf,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 658{
99c53aa9 659#define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
646c6f2b 660 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
661 int UNUSED written = 0;
662 PCADDR UNUSED pc = abuf->addr;
663 SEM_BRANCH_INIT
664 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 665
99c53aa9 666if (LTSI (* FLD (i_src2), 0)) {
190659a2
DE
667 {
668 USI opval = FLD (f_disp16);
99c53aa9
DE
669 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
670 written |= (1 << 2);
0a18a6b8 671 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 672 }
646c6f2b 673}
b8a9943d 674
99c53aa9
DE
675 abuf->written = written;
676 SEM_BRANCH_FINI
677 return vpc;
646c6f2b
DE
678#undef FLD
679}
680
99c53aa9 681/* bnez: bnez $src2,$disp16 */
a8981d67 682
99c53aa9
DE
683SEM_PC
684SEM_FN_NAME (m32rbf,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 685{
99c53aa9 686#define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
646c6f2b 687 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
688 int UNUSED written = 0;
689 PCADDR UNUSED pc = abuf->addr;
690 SEM_BRANCH_INIT
691 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 692
99c53aa9 693if (NESI (* FLD (i_src2), 0)) {
190659a2
DE
694 {
695 USI opval = FLD (f_disp16);
99c53aa9
DE
696 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
697 written |= (1 << 2);
0a18a6b8 698 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 699 }
646c6f2b 700}
b8a9943d 701
99c53aa9
DE
702 abuf->written = written;
703 SEM_BRANCH_FINI
704 return vpc;
646c6f2b
DE
705#undef FLD
706}
707
99c53aa9 708/* bl8: bl.s $disp8 */
a8981d67 709
99c53aa9
DE
710SEM_PC
711SEM_FN_NAME (m32rbf,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 712{
99c53aa9 713#define FLD(f) abuf->fields.cti.fields.fmt_bl8.f
646c6f2b 714 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
715 int UNUSED written = 0;
716 PCADDR UNUSED pc = abuf->addr;
717 SEM_BRANCH_INIT
718 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 719
9d70630e 720do {
190659a2 721 {
99c53aa9
DE
722 SI opval = ADDSI (ANDSI (pc, -4), 4);
723 CPU (h_gr[((UINT) 14)]) = opval;
0a18a6b8 724 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
190659a2
DE
725 }
726 {
727 USI opval = FLD (f_disp8);
99c53aa9 728 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
0a18a6b8 729 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 730 }
9d70630e 731} while (0);
b8a9943d 732
99c53aa9
DE
733 SEM_BRANCH_FINI
734 return vpc;
646c6f2b
DE
735#undef FLD
736}
737
99c53aa9 738/* bl24: bl.l $disp24 */
a8981d67 739
99c53aa9
DE
740SEM_PC
741SEM_FN_NAME (m32rbf,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 742{
99c53aa9 743#define FLD(f) abuf->fields.cti.fields.fmt_bl24.f
646c6f2b 744 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
745 int UNUSED written = 0;
746 PCADDR UNUSED pc = abuf->addr;
747 SEM_BRANCH_INIT
748 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 749
9d70630e 750do {
190659a2 751 {
99c53aa9
DE
752 SI opval = ADDSI (pc, 4);
753 CPU (h_gr[((UINT) 14)]) = opval;
0a18a6b8 754 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
190659a2
DE
755 }
756 {
757 USI opval = FLD (f_disp24);
99c53aa9 758 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
0a18a6b8 759 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 760 }
9d70630e 761} while (0);
b8a9943d 762
99c53aa9
DE
763 SEM_BRANCH_FINI
764 return vpc;
646c6f2b
DE
765#undef FLD
766}
767
99c53aa9 768/* bnc8: bnc.s $disp8 */
a8981d67 769
99c53aa9
DE
770SEM_PC
771SEM_FN_NAME (m32rbf,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 772{
99c53aa9 773#define FLD(f) abuf->fields.cti.fields.fmt_bc8.f
646c6f2b 774 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
775 int UNUSED written = 0;
776 PCADDR UNUSED pc = abuf->addr;
777 SEM_BRANCH_INIT
778 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 779
9d70630e 780if (NOTBI (CPU (h_cond))) {
190659a2
DE
781 {
782 USI opval = FLD (f_disp8);
99c53aa9
DE
783 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
784 written |= (1 << 2);
0a18a6b8 785 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 786 }
646c6f2b 787}
b8a9943d 788
99c53aa9
DE
789 abuf->written = written;
790 SEM_BRANCH_FINI
791 return vpc;
646c6f2b
DE
792#undef FLD
793}
794
99c53aa9 795/* bnc24: bnc.l $disp24 */
a8981d67 796
99c53aa9
DE
797SEM_PC
798SEM_FN_NAME (m32rbf,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 799{
99c53aa9 800#define FLD(f) abuf->fields.cti.fields.fmt_bc24.f
646c6f2b 801 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
802 int UNUSED written = 0;
803 PCADDR UNUSED pc = abuf->addr;
804 SEM_BRANCH_INIT
805 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 806
9d70630e 807if (NOTBI (CPU (h_cond))) {
190659a2
DE
808 {
809 USI opval = FLD (f_disp24);
99c53aa9
DE
810 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
811 written |= (1 << 2);
0a18a6b8 812 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 813 }
646c6f2b 814}
b8a9943d 815
99c53aa9
DE
816 abuf->written = written;
817 SEM_BRANCH_FINI
818 return vpc;
646c6f2b
DE
819#undef FLD
820}
821
99c53aa9 822/* bne: bne $src1,$src2,$disp16 */
a8981d67 823
99c53aa9
DE
824SEM_PC
825SEM_FN_NAME (m32rbf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 826{
99c53aa9 827#define FLD(f) abuf->fields.cti.fields.fmt_beq.f
646c6f2b 828 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
829 int UNUSED written = 0;
830 PCADDR UNUSED pc = abuf->addr;
831 SEM_BRANCH_INIT
832 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 833
99c53aa9 834if (NESI (* FLD (i_src1), * FLD (i_src2))) {
190659a2
DE
835 {
836 USI opval = FLD (f_disp16);
99c53aa9
DE
837 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
838 written |= (1 << 3);
0a18a6b8 839 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 840 }
646c6f2b 841}
b8a9943d 842
99c53aa9
DE
843 abuf->written = written;
844 SEM_BRANCH_FINI
845 return vpc;
646c6f2b
DE
846#undef FLD
847}
848
99c53aa9 849/* bra8: bra.s $disp8 */
a8981d67 850
99c53aa9
DE
851SEM_PC
852SEM_FN_NAME (m32rbf,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 853{
99c53aa9 854#define FLD(f) abuf->fields.cti.fields.fmt_bra8.f
646c6f2b 855 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
856 int UNUSED written = 0;
857 PCADDR UNUSED pc = abuf->addr;
858 SEM_BRANCH_INIT
859 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 860
190659a2
DE
861 {
862 USI opval = FLD (f_disp8);
99c53aa9 863 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
0a18a6b8 864 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 865 }
a8981d67 866
99c53aa9
DE
867 SEM_BRANCH_FINI
868 return vpc;
646c6f2b
DE
869#undef FLD
870}
871
99c53aa9 872/* bra24: bra.l $disp24 */
a8981d67 873
99c53aa9
DE
874SEM_PC
875SEM_FN_NAME (m32rbf,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 876{
99c53aa9 877#define FLD(f) abuf->fields.cti.fields.fmt_bra24.f
646c6f2b 878 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
879 int UNUSED written = 0;
880 PCADDR UNUSED pc = abuf->addr;
881 SEM_BRANCH_INIT
882 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 883
190659a2
DE
884 {
885 USI opval = FLD (f_disp24);
99c53aa9 886 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
0a18a6b8 887 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 888 }
a8981d67 889
99c53aa9
DE
890 SEM_BRANCH_FINI
891 return vpc;
646c6f2b
DE
892#undef FLD
893}
894
99c53aa9 895/* cmp: cmp $src1,$src2 */
a8981d67 896
99c53aa9
DE
897SEM_PC
898SEM_FN_NAME (m32rbf,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 899{
970a8fd6 900#define FLD(f) abuf->fields.fmt_cmp.f
646c6f2b 901 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
902 int UNUSED written = 0;
903 PCADDR UNUSED pc = abuf->addr;
904 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 905
190659a2 906 {
99c53aa9 907 BI opval = LTSI (* FLD (i_src1), * FLD (i_src2));
190659a2 908 CPU (h_cond) = opval;
0a18a6b8 909 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 910 }
b8a9943d 911
99c53aa9 912 return vpc;
646c6f2b
DE
913#undef FLD
914}
915
99c53aa9 916/* cmpi: cmpi $src2,$simm16 */
a8981d67 917
99c53aa9
DE
918SEM_PC
919SEM_FN_NAME (m32rbf,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 920{
970a8fd6 921#define FLD(f) abuf->fields.fmt_cmpi.f
646c6f2b 922 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
923 int UNUSED written = 0;
924 PCADDR UNUSED pc = abuf->addr;
925 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 926
190659a2 927 {
99c53aa9 928 BI opval = LTSI (* FLD (i_src2), FLD (f_simm16));
190659a2 929 CPU (h_cond) = opval;
0a18a6b8 930 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 931 }
b8a9943d 932
99c53aa9 933 return vpc;
646c6f2b
DE
934#undef FLD
935}
936
99c53aa9 937/* cmpu: cmpu $src1,$src2 */
a8981d67 938
99c53aa9
DE
939SEM_PC
940SEM_FN_NAME (m32rbf,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 941{
970a8fd6 942#define FLD(f) abuf->fields.fmt_cmp.f
646c6f2b 943 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
944 int UNUSED written = 0;
945 PCADDR UNUSED pc = abuf->addr;
946 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 947
190659a2 948 {
99c53aa9 949 BI opval = LTUSI (* FLD (i_src1), * FLD (i_src2));
190659a2 950 CPU (h_cond) = opval;
0a18a6b8 951 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 952 }
b8a9943d 953
99c53aa9 954 return vpc;
646c6f2b
DE
955#undef FLD
956}
957
99c53aa9 958/* cmpui: cmpui $src2,$simm16 */
a8981d67 959
99c53aa9
DE
960SEM_PC
961SEM_FN_NAME (m32rbf,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 962{
970a8fd6 963#define FLD(f) abuf->fields.fmt_cmpi.f
646c6f2b 964 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
965 int UNUSED written = 0;
966 PCADDR UNUSED pc = abuf->addr;
967 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 968
190659a2 969 {
99c53aa9 970 BI opval = LTUSI (* FLD (i_src2), FLD (f_simm16));
190659a2 971 CPU (h_cond) = opval;
0a18a6b8 972 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 973 }
b8a9943d 974
99c53aa9 975 return vpc;
646c6f2b
DE
976#undef FLD
977}
978
99c53aa9 979/* div: div $dr,$sr */
a8981d67 980
99c53aa9
DE
981SEM_PC
982SEM_FN_NAME (m32rbf,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 983{
970a8fd6 984#define FLD(f) abuf->fields.fmt_div.f
646c6f2b 985 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
986 int UNUSED written = 0;
987 PCADDR UNUSED pc = abuf->addr;
988 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 989
99c53aa9 990if (NESI (* FLD (i_sr), 0)) {
190659a2 991 {
99c53aa9
DE
992 SI opval = DIVSI (* FLD (i_dr), * FLD (i_sr));
993 * FLD (i_dr) = opval;
994 written |= (1 << 2);
0a18a6b8 995 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 996 }
646c6f2b 997}
b8a9943d 998
99c53aa9
DE
999 abuf->written = written;
1000 return vpc;
646c6f2b
DE
1001#undef FLD
1002}
1003
99c53aa9 1004/* divu: divu $dr,$sr */
a8981d67 1005
99c53aa9
DE
1006SEM_PC
1007SEM_FN_NAME (m32rbf,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1008{
970a8fd6 1009#define FLD(f) abuf->fields.fmt_div.f
646c6f2b 1010 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1011 int UNUSED written = 0;
1012 PCADDR UNUSED pc = abuf->addr;
1013 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1014
99c53aa9 1015if (NESI (* FLD (i_sr), 0)) {
190659a2 1016 {
99c53aa9
DE
1017 SI opval = UDIVSI (* FLD (i_dr), * FLD (i_sr));
1018 * FLD (i_dr) = opval;
1019 written |= (1 << 2);
0a18a6b8 1020 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1021 }
646c6f2b 1022}
b8a9943d 1023
99c53aa9
DE
1024 abuf->written = written;
1025 return vpc;
646c6f2b
DE
1026#undef FLD
1027}
1028
99c53aa9 1029/* rem: rem $dr,$sr */
a8981d67 1030
99c53aa9
DE
1031SEM_PC
1032SEM_FN_NAME (m32rbf,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1033{
970a8fd6 1034#define FLD(f) abuf->fields.fmt_div.f
646c6f2b 1035 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1036 int UNUSED written = 0;
1037 PCADDR UNUSED pc = abuf->addr;
1038 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1039
99c53aa9 1040if (NESI (* FLD (i_sr), 0)) {
190659a2 1041 {
99c53aa9
DE
1042 SI opval = MODSI (* FLD (i_dr), * FLD (i_sr));
1043 * FLD (i_dr) = opval;
1044 written |= (1 << 2);
0a18a6b8 1045 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1046 }
646c6f2b 1047}
b8a9943d 1048
99c53aa9
DE
1049 abuf->written = written;
1050 return vpc;
646c6f2b
DE
1051#undef FLD
1052}
1053
99c53aa9 1054/* remu: remu $dr,$sr */
a8981d67 1055
99c53aa9
DE
1056SEM_PC
1057SEM_FN_NAME (m32rbf,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1058{
970a8fd6 1059#define FLD(f) abuf->fields.fmt_div.f
646c6f2b 1060 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1061 int UNUSED written = 0;
1062 PCADDR UNUSED pc = abuf->addr;
1063 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1064
99c53aa9 1065if (NESI (* FLD (i_sr), 0)) {
190659a2 1066 {
99c53aa9
DE
1067 SI opval = UMODSI (* FLD (i_dr), * FLD (i_sr));
1068 * FLD (i_dr) = opval;
1069 written |= (1 << 2);
0a18a6b8 1070 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1071 }
646c6f2b 1072}
b8a9943d 1073
99c53aa9
DE
1074 abuf->written = written;
1075 return vpc;
646c6f2b
DE
1076#undef FLD
1077}
1078
99c53aa9 1079/* jl: jl $sr */
a8981d67 1080
99c53aa9
DE
1081SEM_PC
1082SEM_FN_NAME (m32rbf,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1083{
99c53aa9 1084#define FLD(f) abuf->fields.cti.fields.fmt_jl.f
646c6f2b 1085 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1086 int UNUSED written = 0;
1087 PCADDR UNUSED pc = abuf->addr;
1088 SEM_BRANCH_INIT
1089 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1090
646c6f2b 1091do {
a040908c 1092 USI temp1;SI temp0;
99c53aa9
DE
1093 temp0 = ADDSI (ANDSI (pc, -4), 4);
1094 temp1 = ANDSI (* FLD (i_sr), -4);
190659a2
DE
1095 {
1096 SI opval = temp0;
99c53aa9 1097 CPU (h_gr[((UINT) 14)]) = opval;
0a18a6b8 1098 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
190659a2
DE
1099 }
1100 {
1101 USI opval = temp1;
99c53aa9 1102 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
0a18a6b8 1103 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 1104 }
646c6f2b 1105} while (0);
b8a9943d 1106
99c53aa9
DE
1107 SEM_BRANCH_FINI
1108 return vpc;
646c6f2b
DE
1109#undef FLD
1110}
1111
99c53aa9 1112/* jmp: jmp $sr */
a8981d67 1113
99c53aa9
DE
1114SEM_PC
1115SEM_FN_NAME (m32rbf,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1116{
99c53aa9 1117#define FLD(f) abuf->fields.cti.fields.fmt_jmp.f
646c6f2b 1118 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1119 int UNUSED written = 0;
1120 PCADDR UNUSED pc = abuf->addr;
1121 SEM_BRANCH_INIT
1122 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1123
190659a2 1124 {
99c53aa9
DE
1125 USI opval = ANDSI (* FLD (i_sr), -4);
1126 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
0a18a6b8 1127 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 1128 }
a8981d67 1129
99c53aa9
DE
1130 SEM_BRANCH_FINI
1131 return vpc;
646c6f2b
DE
1132#undef FLD
1133}
1134
99c53aa9 1135/* ld: ld $dr,@$sr */
a8981d67 1136
99c53aa9
DE
1137SEM_PC
1138SEM_FN_NAME (m32rbf,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1139{
970a8fd6 1140#define FLD(f) abuf->fields.fmt_ld.f
646c6f2b 1141 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1142 int UNUSED written = 0;
1143 PCADDR UNUSED pc = abuf->addr;
1144 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1145
190659a2 1146 {
99c53aa9
DE
1147 SI opval = GETMEMSI (current_cpu, * FLD (i_sr));
1148 * FLD (i_dr) = opval;
0a18a6b8 1149 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1150 }
b8a9943d 1151
99c53aa9 1152 return vpc;
646c6f2b
DE
1153#undef FLD
1154}
1155
99c53aa9 1156/* ld-d: ld $dr,@($slo16,$sr) */
a8981d67 1157
99c53aa9
DE
1158SEM_PC
1159SEM_FN_NAME (m32rbf,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1160{
970a8fd6 1161#define FLD(f) abuf->fields.fmt_ld_d.f
646c6f2b 1162 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1163 int UNUSED written = 0;
1164 PCADDR UNUSED pc = abuf->addr;
1165 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1166
190659a2 1167 {
99c53aa9
DE
1168 SI opval = GETMEMSI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16)));
1169 * FLD (i_dr) = opval;
0a18a6b8 1170 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1171 }
b8a9943d 1172
99c53aa9 1173 return vpc;
646c6f2b
DE
1174#undef FLD
1175}
1176
99c53aa9 1177/* ldb: ldb $dr,@$sr */
a8981d67 1178
99c53aa9
DE
1179SEM_PC
1180SEM_FN_NAME (m32rbf,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1181{
970a8fd6 1182#define FLD(f) abuf->fields.fmt_ldb.f
646c6f2b 1183 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1184 int UNUSED written = 0;
1185 PCADDR UNUSED pc = abuf->addr;
1186 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1187
190659a2 1188 {
99c53aa9
DE
1189 SI opval = EXTQISI (GETMEMQI (current_cpu, * FLD (i_sr)));
1190 * FLD (i_dr) = opval;
0a18a6b8 1191 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1192 }
b8a9943d 1193
99c53aa9 1194 return vpc;
646c6f2b
DE
1195#undef FLD
1196}
1197
99c53aa9 1198/* ldb-d: ldb $dr,@($slo16,$sr) */
a8981d67 1199
99c53aa9
DE
1200SEM_PC
1201SEM_FN_NAME (m32rbf,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1202{
970a8fd6 1203#define FLD(f) abuf->fields.fmt_ldb_d.f
646c6f2b 1204 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1205 int UNUSED written = 0;
1206 PCADDR UNUSED pc = abuf->addr;
1207 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1208
190659a2 1209 {
99c53aa9
DE
1210 SI opval = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1211 * FLD (i_dr) = opval;
0a18a6b8 1212 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1213 }
b8a9943d 1214
99c53aa9 1215 return vpc;
646c6f2b
DE
1216#undef FLD
1217}
1218
99c53aa9 1219/* ldh: ldh $dr,@$sr */
a8981d67 1220
99c53aa9
DE
1221SEM_PC
1222SEM_FN_NAME (m32rbf,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1223{
970a8fd6 1224#define FLD(f) abuf->fields.fmt_ldh.f
646c6f2b 1225 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1226 int UNUSED written = 0;
1227 PCADDR UNUSED pc = abuf->addr;
1228 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1229
190659a2 1230 {
99c53aa9
DE
1231 SI opval = EXTHISI (GETMEMHI (current_cpu, * FLD (i_sr)));
1232 * FLD (i_dr) = opval;
0a18a6b8 1233 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1234 }
b8a9943d 1235
99c53aa9 1236 return vpc;
646c6f2b
DE
1237#undef FLD
1238}
1239
99c53aa9 1240/* ldh-d: ldh $dr,@($slo16,$sr) */
a8981d67 1241
99c53aa9
DE
1242SEM_PC
1243SEM_FN_NAME (m32rbf,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1244{
970a8fd6 1245#define FLD(f) abuf->fields.fmt_ldh_d.f
646c6f2b 1246 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1247 int UNUSED written = 0;
1248 PCADDR UNUSED pc = abuf->addr;
1249 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1250
190659a2 1251 {
99c53aa9
DE
1252 SI opval = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1253 * FLD (i_dr) = opval;
0a18a6b8 1254 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1255 }
b8a9943d 1256
99c53aa9 1257 return vpc;
646c6f2b
DE
1258#undef FLD
1259}
1260
99c53aa9 1261/* ldub: ldub $dr,@$sr */
a8981d67 1262
99c53aa9
DE
1263SEM_PC
1264SEM_FN_NAME (m32rbf,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1265{
970a8fd6 1266#define FLD(f) abuf->fields.fmt_ldb.f
646c6f2b 1267 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1268 int UNUSED written = 0;
1269 PCADDR UNUSED pc = abuf->addr;
1270 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1271
190659a2 1272 {
99c53aa9
DE
1273 SI opval = ZEXTQISI (GETMEMQI (current_cpu, * FLD (i_sr)));
1274 * FLD (i_dr) = opval;
0a18a6b8 1275 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1276 }
b8a9943d 1277
99c53aa9 1278 return vpc;
646c6f2b
DE
1279#undef FLD
1280}
1281
99c53aa9 1282/* ldub-d: ldub $dr,@($slo16,$sr) */
a8981d67 1283
99c53aa9
DE
1284SEM_PC
1285SEM_FN_NAME (m32rbf,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1286{
970a8fd6 1287#define FLD(f) abuf->fields.fmt_ldb_d.f
646c6f2b 1288 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1289 int UNUSED written = 0;
1290 PCADDR UNUSED pc = abuf->addr;
1291 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1292
190659a2 1293 {
99c53aa9
DE
1294 SI opval = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1295 * FLD (i_dr) = opval;
0a18a6b8 1296 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1297 }
b8a9943d 1298
99c53aa9 1299 return vpc;
646c6f2b
DE
1300#undef FLD
1301}
1302
99c53aa9 1303/* lduh: lduh $dr,@$sr */
a8981d67 1304
99c53aa9
DE
1305SEM_PC
1306SEM_FN_NAME (m32rbf,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1307{
970a8fd6 1308#define FLD(f) abuf->fields.fmt_ldh.f
646c6f2b 1309 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1310 int UNUSED written = 0;
1311 PCADDR UNUSED pc = abuf->addr;
1312 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1313
190659a2 1314 {
99c53aa9
DE
1315 SI opval = ZEXTHISI (GETMEMHI (current_cpu, * FLD (i_sr)));
1316 * FLD (i_dr) = opval;
0a18a6b8 1317 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1318 }
b8a9943d 1319
99c53aa9 1320 return vpc;
646c6f2b
DE
1321#undef FLD
1322}
1323
99c53aa9 1324/* lduh-d: lduh $dr,@($slo16,$sr) */
a8981d67 1325
99c53aa9
DE
1326SEM_PC
1327SEM_FN_NAME (m32rbf,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1328{
970a8fd6 1329#define FLD(f) abuf->fields.fmt_ldh_d.f
646c6f2b 1330 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1331 int UNUSED written = 0;
1332 PCADDR UNUSED pc = abuf->addr;
1333 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1334
190659a2 1335 {
99c53aa9
DE
1336 SI opval = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1337 * FLD (i_dr) = opval;
0a18a6b8 1338 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1339 }
b8a9943d 1340
99c53aa9 1341 return vpc;
646c6f2b
DE
1342#undef FLD
1343}
1344
99c53aa9 1345/* ld-plus: ld $dr,@$sr+ */
a8981d67 1346
99c53aa9
DE
1347SEM_PC
1348SEM_FN_NAME (m32rbf,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1349{
970a8fd6 1350#define FLD(f) abuf->fields.fmt_ld_plus.f
646c6f2b 1351 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1352 int UNUSED written = 0;
1353 PCADDR UNUSED pc = abuf->addr;
1354 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1355
646c6f2b
DE
1356do {
1357 SI temp1;SI temp0;
99c53aa9
DE
1358 temp0 = GETMEMSI (current_cpu, * FLD (i_sr));
1359 temp1 = ADDSI (* FLD (i_sr), 4);
190659a2
DE
1360 {
1361 SI opval = temp0;
99c53aa9 1362 * FLD (i_dr) = opval;
0a18a6b8 1363 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2
DE
1364 }
1365 {
1366 SI opval = temp1;
99c53aa9 1367 * FLD (i_sr) = opval;
0a18a6b8 1368 TRACE_RESULT (current_cpu, abuf, "sr", 'x', opval);
190659a2 1369 }
646c6f2b 1370} while (0);
b8a9943d 1371
99c53aa9 1372 return vpc;
646c6f2b
DE
1373#undef FLD
1374}
1375
99c53aa9 1376/* ld24: ld24 $dr,$uimm24 */
a8981d67 1377
99c53aa9
DE
1378SEM_PC
1379SEM_FN_NAME (m32rbf,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1380{
970a8fd6 1381#define FLD(f) abuf->fields.fmt_ld24.f
646c6f2b 1382 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1383 int UNUSED written = 0;
1384 PCADDR UNUSED pc = abuf->addr;
1385 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1386
190659a2
DE
1387 {
1388 SI opval = FLD (f_uimm24);
99c53aa9 1389 * FLD (i_dr) = opval;
0a18a6b8 1390 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1391 }
b8a9943d 1392
99c53aa9 1393 return vpc;
646c6f2b
DE
1394#undef FLD
1395}
1396
99c53aa9 1397/* ldi8: ldi8 $dr,$simm8 */
a8981d67 1398
99c53aa9
DE
1399SEM_PC
1400SEM_FN_NAME (m32rbf,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1401{
970a8fd6 1402#define FLD(f) abuf->fields.fmt_ldi8.f
646c6f2b 1403 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1404 int UNUSED written = 0;
1405 PCADDR UNUSED pc = abuf->addr;
1406 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1407
190659a2
DE
1408 {
1409 SI opval = FLD (f_simm8);
99c53aa9 1410 * FLD (i_dr) = opval;
0a18a6b8 1411 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1412 }
b8a9943d 1413
99c53aa9 1414 return vpc;
646c6f2b
DE
1415#undef FLD
1416}
1417
99c53aa9 1418/* ldi16: ldi16 $dr,$hash$slo16 */
a8981d67 1419
99c53aa9
DE
1420SEM_PC
1421SEM_FN_NAME (m32rbf,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1422{
970a8fd6 1423#define FLD(f) abuf->fields.fmt_ldi16.f
646c6f2b 1424 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1425 int UNUSED written = 0;
1426 PCADDR UNUSED pc = abuf->addr;
1427 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1428
190659a2
DE
1429 {
1430 SI opval = FLD (f_simm16);
99c53aa9 1431 * FLD (i_dr) = opval;
0a18a6b8 1432 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1433 }
b8a9943d 1434
99c53aa9 1435 return vpc;
646c6f2b
DE
1436#undef FLD
1437}
1438
99c53aa9 1439/* lock: lock $dr,@$sr */
a8981d67 1440
99c53aa9
DE
1441SEM_PC
1442SEM_FN_NAME (m32rbf,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1443{
970a8fd6 1444#define FLD(f) abuf->fields.fmt_lock.f
646c6f2b 1445 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1446 int UNUSED written = 0;
1447 PCADDR UNUSED pc = abuf->addr;
1448 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1449
cab58155 1450do {
190659a2 1451 {
99c53aa9 1452 BI opval = 1;
190659a2 1453 CPU (h_lock) = opval;
0a18a6b8 1454 TRACE_RESULT (current_cpu, abuf, "lock-0", 'x', opval);
190659a2
DE
1455 }
1456 {
99c53aa9
DE
1457 SI opval = GETMEMSI (current_cpu, * FLD (i_sr));
1458 * FLD (i_dr) = opval;
0a18a6b8 1459 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1460 }
cab58155 1461} while (0);
b8a9943d 1462
99c53aa9 1463 return vpc;
646c6f2b
DE
1464#undef FLD
1465}
1466
99c53aa9 1467/* machi: machi $src1,$src2 */
a8981d67 1468
99c53aa9
DE
1469SEM_PC
1470SEM_FN_NAME (m32rbf,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1471{
970a8fd6 1472#define FLD(f) abuf->fields.fmt_machi.f
646c6f2b 1473 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1474 int UNUSED written = 0;
1475 PCADDR UNUSED pc = abuf->addr;
1476 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1477
190659a2 1478 {
99c53aa9
DE
1479 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);
1480 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1481 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1482 }
b8a9943d 1483
99c53aa9 1484 return vpc;
646c6f2b
DE
1485#undef FLD
1486}
1487
99c53aa9 1488/* maclo: maclo $src1,$src2 */
a8981d67 1489
99c53aa9
DE
1490SEM_PC
1491SEM_FN_NAME (m32rbf,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1492{
970a8fd6 1493#define FLD(f) abuf->fields.fmt_machi.f
646c6f2b 1494 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1495 int UNUSED written = 0;
1496 PCADDR UNUSED pc = abuf->addr;
1497 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1498
190659a2 1499 {
99c53aa9
DE
1500 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);
1501 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1502 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1503 }
b8a9943d 1504
99c53aa9 1505 return vpc;
646c6f2b
DE
1506#undef FLD
1507}
1508
99c53aa9 1509/* macwhi: macwhi $src1,$src2 */
a8981d67 1510
99c53aa9
DE
1511SEM_PC
1512SEM_FN_NAME (m32rbf,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1513{
970a8fd6 1514#define FLD(f) abuf->fields.fmt_machi.f
646c6f2b 1515 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1516 int UNUSED written = 0;
1517 PCADDR UNUSED pc = abuf->addr;
1518 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1519
190659a2 1520 {
99c53aa9
DE
1521 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);
1522 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1523 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1524 }
b8a9943d 1525
99c53aa9 1526 return vpc;
646c6f2b
DE
1527#undef FLD
1528}
1529
99c53aa9 1530/* macwlo: macwlo $src1,$src2 */
a8981d67 1531
99c53aa9
DE
1532SEM_PC
1533SEM_FN_NAME (m32rbf,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1534{
970a8fd6 1535#define FLD(f) abuf->fields.fmt_machi.f
646c6f2b 1536 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1537 int UNUSED written = 0;
1538 PCADDR UNUSED pc = abuf->addr;
1539 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1540
190659a2 1541 {
99c53aa9
DE
1542 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
1543 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1544 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1545 }
b8a9943d 1546
99c53aa9 1547 return vpc;
646c6f2b
DE
1548#undef FLD
1549}
1550
99c53aa9 1551/* mul: mul $dr,$sr */
a8981d67 1552
99c53aa9
DE
1553SEM_PC
1554SEM_FN_NAME (m32rbf,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1555{
970a8fd6 1556#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 1557 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1558 int UNUSED written = 0;
1559 PCADDR UNUSED pc = abuf->addr;
1560 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1561
190659a2 1562 {
99c53aa9
DE
1563 SI opval = MULSI (* FLD (i_dr), * FLD (i_sr));
1564 * FLD (i_dr) = opval;
0a18a6b8 1565 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1566 }
b8a9943d 1567
99c53aa9 1568 return vpc;
646c6f2b
DE
1569#undef FLD
1570}
1571
99c53aa9 1572/* mulhi: mulhi $src1,$src2 */
a8981d67 1573
99c53aa9
DE
1574SEM_PC
1575SEM_FN_NAME (m32rbf,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1576{
970a8fd6 1577#define FLD(f) abuf->fields.fmt_mulhi.f
646c6f2b 1578 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1579 int UNUSED written = 0;
1580 PCADDR UNUSED pc = abuf->addr;
1581 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1582
190659a2 1583 {
99c53aa9
DE
1584 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 16), 16);
1585 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1586 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1587 }
b8a9943d 1588
99c53aa9 1589 return vpc;
646c6f2b
DE
1590#undef FLD
1591}
1592
99c53aa9 1593/* mullo: mullo $src1,$src2 */
a8981d67 1594
99c53aa9
DE
1595SEM_PC
1596SEM_FN_NAME (m32rbf,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1597{
970a8fd6 1598#define FLD(f) abuf->fields.fmt_mulhi.f
646c6f2b 1599 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1600 int UNUSED written = 0;
1601 PCADDR UNUSED pc = abuf->addr;
1602 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1603
190659a2 1604 {
99c53aa9
DE
1605 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 16), 16);
1606 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1607 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1608 }
b8a9943d 1609
99c53aa9 1610 return vpc;
646c6f2b
DE
1611#undef FLD
1612}
1613
99c53aa9 1614/* mulwhi: mulwhi $src1,$src2 */
a8981d67 1615
99c53aa9
DE
1616SEM_PC
1617SEM_FN_NAME (m32rbf,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1618{
970a8fd6 1619#define FLD(f) abuf->fields.fmt_mulhi.f
646c6f2b 1620 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1621 int UNUSED written = 0;
1622 PCADDR UNUSED pc = abuf->addr;
1623 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1624
190659a2 1625 {
99c53aa9
DE
1626 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 8), 8);
1627 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1628 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1629 }
b8a9943d 1630
99c53aa9 1631 return vpc;
646c6f2b
DE
1632#undef FLD
1633}
1634
99c53aa9 1635/* mulwlo: mulwlo $src1,$src2 */
a8981d67 1636
99c53aa9
DE
1637SEM_PC
1638SEM_FN_NAME (m32rbf,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1639{
970a8fd6 1640#define FLD(f) abuf->fields.fmt_mulhi.f
646c6f2b 1641 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1642 int UNUSED written = 0;
1643 PCADDR UNUSED pc = abuf->addr;
1644 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1645
190659a2 1646 {
99c53aa9
DE
1647 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 8), 8);
1648 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1649 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1650 }
b8a9943d 1651
99c53aa9 1652 return vpc;
646c6f2b
DE
1653#undef FLD
1654}
1655
99c53aa9 1656/* mv: mv $dr,$sr */
a8981d67 1657
99c53aa9
DE
1658SEM_PC
1659SEM_FN_NAME (m32rbf,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1660{
970a8fd6 1661#define FLD(f) abuf->fields.fmt_mv.f
646c6f2b 1662 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1663 int UNUSED written = 0;
1664 PCADDR UNUSED pc = abuf->addr;
1665 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1666
190659a2 1667 {
99c53aa9
DE
1668 SI opval = * FLD (i_sr);
1669 * FLD (i_dr) = opval;
0a18a6b8 1670 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1671 }
b8a9943d 1672
99c53aa9 1673 return vpc;
646c6f2b
DE
1674#undef FLD
1675}
1676
99c53aa9 1677/* mvfachi: mvfachi $dr */
a8981d67 1678
99c53aa9
DE
1679SEM_PC
1680SEM_FN_NAME (m32rbf,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1681{
970a8fd6 1682#define FLD(f) abuf->fields.fmt_mvfachi.f
646c6f2b 1683 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1684 int UNUSED written = 0;
1685 PCADDR UNUSED pc = abuf->addr;
1686 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1687
190659a2 1688 {
99c53aa9
DE
1689 SI opval = TRUNCDISI (SRADI (m32rbf_h_accum_get (current_cpu), 32));
1690 * FLD (i_dr) = opval;
0a18a6b8 1691 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1692 }
b8a9943d 1693
99c53aa9 1694 return vpc;
646c6f2b
DE
1695#undef FLD
1696}
1697
99c53aa9 1698/* mvfaclo: mvfaclo $dr */
a8981d67 1699
99c53aa9
DE
1700SEM_PC
1701SEM_FN_NAME (m32rbf,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1702{
970a8fd6 1703#define FLD(f) abuf->fields.fmt_mvfachi.f
646c6f2b 1704 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1705 int UNUSED written = 0;
1706 PCADDR UNUSED pc = abuf->addr;
1707 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1708
190659a2 1709 {
99c53aa9
DE
1710 SI opval = TRUNCDISI (m32rbf_h_accum_get (current_cpu));
1711 * FLD (i_dr) = opval;
0a18a6b8 1712 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1713 }
b8a9943d 1714
99c53aa9 1715 return vpc;
646c6f2b
DE
1716#undef FLD
1717}
1718
99c53aa9 1719/* mvfacmi: mvfacmi $dr */
a8981d67 1720
99c53aa9
DE
1721SEM_PC
1722SEM_FN_NAME (m32rbf,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1723{
970a8fd6 1724#define FLD(f) abuf->fields.fmt_mvfachi.f
646c6f2b 1725 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1726 int UNUSED written = 0;
1727 PCADDR UNUSED pc = abuf->addr;
1728 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1729
190659a2 1730 {
99c53aa9
DE
1731 SI opval = TRUNCDISI (SRADI (m32rbf_h_accum_get (current_cpu), 16));
1732 * FLD (i_dr) = opval;
0a18a6b8 1733 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1734 }
b8a9943d 1735
99c53aa9 1736 return vpc;
646c6f2b
DE
1737#undef FLD
1738}
1739
99c53aa9 1740/* mvfc: mvfc $dr,$scr */
a8981d67 1741
99c53aa9
DE
1742SEM_PC
1743SEM_FN_NAME (m32rbf,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1744{
970a8fd6 1745#define FLD(f) abuf->fields.fmt_mvfc.f
646c6f2b 1746 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1747 int UNUSED written = 0;
1748 PCADDR UNUSED pc = abuf->addr;
1749 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1750
190659a2 1751 {
99c53aa9
DE
1752 SI opval = m32rbf_h_cr_get (current_cpu, FLD (f_r2));
1753 * FLD (i_dr) = opval;
0a18a6b8 1754 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1755 }
b8a9943d 1756
99c53aa9 1757 return vpc;
646c6f2b
DE
1758#undef FLD
1759}
1760
99c53aa9 1761/* mvtachi: mvtachi $src1 */
a8981d67 1762
99c53aa9
DE
1763SEM_PC
1764SEM_FN_NAME (m32rbf,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1765{
970a8fd6 1766#define FLD(f) abuf->fields.fmt_mvtachi.f
646c6f2b 1767 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1768 int UNUSED written = 0;
1769 PCADDR UNUSED pc = abuf->addr;
1770 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1771
190659a2 1772 {
99c53aa9
DE
1773 DI opval = ORDI (ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (i_src1)), 32));
1774 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1775 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1776 }
b8a9943d 1777
99c53aa9 1778 return vpc;
646c6f2b
DE
1779#undef FLD
1780}
1781
99c53aa9 1782/* mvtaclo: mvtaclo $src1 */
a8981d67 1783
99c53aa9
DE
1784SEM_PC
1785SEM_FN_NAME (m32rbf,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1786{
970a8fd6 1787#define FLD(f) abuf->fields.fmt_mvtachi.f
646c6f2b 1788 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1789 int UNUSED written = 0;
1790 PCADDR UNUSED pc = abuf->addr;
1791 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1792
190659a2 1793 {
99c53aa9
DE
1794 DI opval = ORDI (ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (i_src1)));
1795 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1796 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1797 }
b8a9943d 1798
99c53aa9 1799 return vpc;
646c6f2b
DE
1800#undef FLD
1801}
1802
99c53aa9 1803/* mvtc: mvtc $sr,$dcr */
a8981d67 1804
99c53aa9
DE
1805SEM_PC
1806SEM_FN_NAME (m32rbf,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1807{
970a8fd6 1808#define FLD(f) abuf->fields.fmt_mvtc.f
646c6f2b 1809 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1810 int UNUSED written = 0;
1811 PCADDR UNUSED pc = abuf->addr;
1812 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1813
190659a2 1814 {
99c53aa9
DE
1815 USI opval = * FLD (i_sr);
1816 m32rbf_h_cr_set (current_cpu, FLD (f_r1), opval);
0a18a6b8 1817 TRACE_RESULT (current_cpu, abuf, "dcr", 'x', opval);
190659a2 1818 }
b8a9943d 1819
99c53aa9 1820 return vpc;
646c6f2b
DE
1821#undef FLD
1822}
1823
99c53aa9 1824/* neg: neg $dr,$sr */
a8981d67 1825
99c53aa9
DE
1826SEM_PC
1827SEM_FN_NAME (m32rbf,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1828{
970a8fd6 1829#define FLD(f) abuf->fields.fmt_mv.f
646c6f2b 1830 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1831 int UNUSED written = 0;
1832 PCADDR UNUSED pc = abuf->addr;
1833 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1834
190659a2 1835 {
99c53aa9
DE
1836 SI opval = NEGSI (* FLD (i_sr));
1837 * FLD (i_dr) = opval;
0a18a6b8 1838 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1839 }
b8a9943d 1840
99c53aa9 1841 return vpc;
646c6f2b
DE
1842#undef FLD
1843}
1844
99c53aa9 1845/* nop: nop */
a8981d67 1846
99c53aa9
DE
1847SEM_PC
1848SEM_FN_NAME (m32rbf,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1849{
970a8fd6 1850#define FLD(f) abuf->fields.fmt_nop.f
646c6f2b 1851 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1852 int UNUSED written = 0;
1853 PCADDR UNUSED pc = abuf->addr;
1854 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1855
646c6f2b 1856PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
b8a9943d 1857
99c53aa9 1858 return vpc;
646c6f2b
DE
1859#undef FLD
1860}
1861
99c53aa9 1862/* not: not $dr,$sr */
a8981d67 1863
99c53aa9
DE
1864SEM_PC
1865SEM_FN_NAME (m32rbf,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1866{
970a8fd6 1867#define FLD(f) abuf->fields.fmt_mv.f
646c6f2b 1868 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1869 int UNUSED written = 0;
1870 PCADDR UNUSED pc = abuf->addr;
1871 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1872
190659a2 1873 {
99c53aa9
DE
1874 SI opval = INVSI (* FLD (i_sr));
1875 * FLD (i_dr) = opval;
0a18a6b8 1876 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1877 }
b8a9943d 1878
99c53aa9 1879 return vpc;
646c6f2b
DE
1880#undef FLD
1881}
1882
99c53aa9 1883/* rac: rac */
a8981d67 1884
99c53aa9
DE
1885SEM_PC
1886SEM_FN_NAME (m32rbf,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1887{
970a8fd6 1888#define FLD(f) abuf->fields.fmt_rac.f
646c6f2b 1889 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1890 int UNUSED written = 0;
1891 PCADDR UNUSED pc = abuf->addr;
1892 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1893
9d70630e 1894do {
646c6f2b 1895 DI tmp_tmp1;
99c53aa9 1896 tmp_tmp1 = SLLDI (m32rbf_h_accum_get (current_cpu), 1);
e0bd6e18 1897 tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768));
190659a2
DE
1898 {
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)));
99c53aa9 1900 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1901 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1902 }
9d70630e 1903} while (0);
b8a9943d 1904
99c53aa9 1905 return vpc;
646c6f2b
DE
1906#undef FLD
1907}
1908
99c53aa9 1909/* rach: rach */
a8981d67 1910
99c53aa9
DE
1911SEM_PC
1912SEM_FN_NAME (m32rbf,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1913{
970a8fd6 1914#define FLD(f) abuf->fields.fmt_rac.f
646c6f2b 1915 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1916 int UNUSED written = 0;
1917 PCADDR UNUSED pc = abuf->addr;
1918 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1919
9d70630e 1920do {
646c6f2b 1921 DI tmp_tmp1;
99c53aa9 1922 tmp_tmp1 = ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (16777215, 0xffffffff));
a040908c 1923if (ANDIF (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
646c6f2b
DE
1924 tmp_tmp1 = MAKEDI (16383, 0x80000000);
1925} else {
a040908c 1926if (ANDIF (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
646c6f2b
DE
1927 tmp_tmp1 = MAKEDI (16760832, 0);
1928} else {
99c53aa9 1929 tmp_tmp1 = ANDDI (ADDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
646c6f2b
DE
1930}
1931}
9d70630e 1932 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
190659a2
DE
1933 {
1934 DI opval = SRADI (SLLDI (tmp_tmp1, 7), 7);
99c53aa9 1935 m32rbf_h_accum_set (current_cpu, opval);
0a18a6b8 1936 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
190659a2 1937 }
9d70630e 1938} while (0);
b8a9943d 1939
99c53aa9 1940 return vpc;
646c6f2b
DE
1941#undef FLD
1942}
1943
99c53aa9 1944/* rte: rte */
a8981d67 1945
99c53aa9
DE
1946SEM_PC
1947SEM_FN_NAME (m32rbf,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1948{
99c53aa9 1949#define FLD(f) abuf->fields.cti.fields.fmt_rte.f
646c6f2b 1950 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1951 int UNUSED written = 0;
1952 PCADDR UNUSED pc = abuf->addr;
1953 SEM_BRANCH_INIT
1954 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 1955
9d70630e 1956do {
190659a2 1957 {
99c53aa9
DE
1958 USI opval = ANDSI (m32rbf_h_cr_get (current_cpu, ((UINT) 6)), -4);
1959 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
0a18a6b8 1960 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2
DE
1961 }
1962 {
99c53aa9
DE
1963 USI opval = m32rbf_h_cr_get (current_cpu, ((UINT) 14));
1964 m32rbf_h_cr_set (current_cpu, ((UINT) 6), opval);
0a18a6b8 1965 TRACE_RESULT (current_cpu, abuf, "cr-6", 'x', opval);
190659a2
DE
1966 }
1967 {
99c53aa9
DE
1968 UQI opval = CPU (h_bpsw);
1969 m32rbf_h_psw_set (current_cpu, opval);
0a18a6b8 1970 TRACE_RESULT (current_cpu, abuf, "psw-0", 'x', opval);
190659a2
DE
1971 }
1972 {
99c53aa9
DE
1973 UQI opval = CPU (h_bbpsw);
1974 CPU (h_bpsw) = opval;
0a18a6b8 1975 TRACE_RESULT (current_cpu, abuf, "bpsw-0", 'x', opval);
190659a2 1976 }
9d70630e 1977} while (0);
b8a9943d 1978
99c53aa9
DE
1979 SEM_BRANCH_FINI
1980 return vpc;
646c6f2b
DE
1981#undef FLD
1982}
1983
99c53aa9 1984/* seth: seth $dr,$hash$hi16 */
a8981d67 1985
99c53aa9
DE
1986SEM_PC
1987SEM_FN_NAME (m32rbf,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 1988{
970a8fd6 1989#define FLD(f) abuf->fields.fmt_seth.f
646c6f2b 1990 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
1991 int UNUSED written = 0;
1992 PCADDR UNUSED pc = abuf->addr;
1993 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 1994
190659a2
DE
1995 {
1996 SI opval = SLLSI (FLD (f_hi16), 16);
99c53aa9 1997 * FLD (i_dr) = opval;
0a18a6b8 1998 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 1999 }
b8a9943d 2000
99c53aa9 2001 return vpc;
646c6f2b
DE
2002#undef FLD
2003}
2004
99c53aa9 2005/* sll: sll $dr,$sr */
a8981d67 2006
99c53aa9
DE
2007SEM_PC
2008SEM_FN_NAME (m32rbf,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2009{
970a8fd6 2010#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 2011 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2012 int UNUSED written = 0;
2013 PCADDR UNUSED pc = abuf->addr;
2014 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2015
190659a2 2016 {
99c53aa9
DE
2017 SI opval = SLLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2018 * FLD (i_dr) = opval;
0a18a6b8 2019 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2020 }
b8a9943d 2021
99c53aa9 2022 return vpc;
646c6f2b
DE
2023#undef FLD
2024}
2025
99c53aa9 2026/* sll3: sll3 $dr,$sr,$simm16 */
a8981d67 2027
99c53aa9
DE
2028SEM_PC
2029SEM_FN_NAME (m32rbf,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2030{
970a8fd6 2031#define FLD(f) abuf->fields.fmt_sll3.f
646c6f2b 2032 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2033 int UNUSED written = 0;
2034 PCADDR UNUSED pc = abuf->addr;
2035 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 2036
190659a2 2037 {
99c53aa9
DE
2038 SI opval = SLLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2039 * FLD (i_dr) = opval;
0a18a6b8 2040 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2041 }
b8a9943d 2042
99c53aa9 2043 return vpc;
646c6f2b
DE
2044#undef FLD
2045}
2046
99c53aa9 2047/* slli: slli $dr,$uimm5 */
a8981d67 2048
99c53aa9
DE
2049SEM_PC
2050SEM_FN_NAME (m32rbf,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2051{
970a8fd6 2052#define FLD(f) abuf->fields.fmt_slli.f
646c6f2b 2053 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2054 int UNUSED written = 0;
2055 PCADDR UNUSED pc = abuf->addr;
2056 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2057
190659a2 2058 {
99c53aa9
DE
2059 SI opval = SLLSI (* FLD (i_dr), FLD (f_uimm5));
2060 * FLD (i_dr) = opval;
0a18a6b8 2061 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2062 }
b8a9943d 2063
99c53aa9 2064 return vpc;
646c6f2b
DE
2065#undef FLD
2066}
2067
99c53aa9 2068/* sra: sra $dr,$sr */
a8981d67 2069
99c53aa9
DE
2070SEM_PC
2071SEM_FN_NAME (m32rbf,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2072{
970a8fd6 2073#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 2074 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2075 int UNUSED written = 0;
2076 PCADDR UNUSED pc = abuf->addr;
2077 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2078
190659a2 2079 {
99c53aa9
DE
2080 SI opval = SRASI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2081 * FLD (i_dr) = opval;
0a18a6b8 2082 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2083 }
b8a9943d 2084
99c53aa9 2085 return vpc;
646c6f2b
DE
2086#undef FLD
2087}
2088
99c53aa9 2089/* sra3: sra3 $dr,$sr,$simm16 */
a8981d67 2090
99c53aa9
DE
2091SEM_PC
2092SEM_FN_NAME (m32rbf,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2093{
970a8fd6 2094#define FLD(f) abuf->fields.fmt_sll3.f
646c6f2b 2095 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2096 int UNUSED written = 0;
2097 PCADDR UNUSED pc = abuf->addr;
2098 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 2099
190659a2 2100 {
99c53aa9
DE
2101 SI opval = SRASI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2102 * FLD (i_dr) = opval;
0a18a6b8 2103 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2104 }
b8a9943d 2105
99c53aa9 2106 return vpc;
646c6f2b
DE
2107#undef FLD
2108}
2109
99c53aa9 2110/* srai: srai $dr,$uimm5 */
a8981d67 2111
99c53aa9
DE
2112SEM_PC
2113SEM_FN_NAME (m32rbf,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2114{
970a8fd6 2115#define FLD(f) abuf->fields.fmt_slli.f
646c6f2b 2116 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2117 int UNUSED written = 0;
2118 PCADDR UNUSED pc = abuf->addr;
2119 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2120
190659a2 2121 {
99c53aa9
DE
2122 SI opval = SRASI (* FLD (i_dr), FLD (f_uimm5));
2123 * FLD (i_dr) = opval;
0a18a6b8 2124 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2125 }
b8a9943d 2126
99c53aa9 2127 return vpc;
646c6f2b
DE
2128#undef FLD
2129}
2130
99c53aa9 2131/* srl: srl $dr,$sr */
a8981d67 2132
99c53aa9
DE
2133SEM_PC
2134SEM_FN_NAME (m32rbf,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2135{
970a8fd6 2136#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 2137 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2138 int UNUSED written = 0;
2139 PCADDR UNUSED pc = abuf->addr;
2140 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2141
190659a2 2142 {
99c53aa9
DE
2143 SI opval = SRLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2144 * FLD (i_dr) = opval;
0a18a6b8 2145 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2146 }
b8a9943d 2147
99c53aa9 2148 return vpc;
646c6f2b
DE
2149#undef FLD
2150}
2151
99c53aa9 2152/* srl3: srl3 $dr,$sr,$simm16 */
a8981d67 2153
99c53aa9
DE
2154SEM_PC
2155SEM_FN_NAME (m32rbf,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2156{
970a8fd6 2157#define FLD(f) abuf->fields.fmt_sll3.f
646c6f2b 2158 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2159 int UNUSED written = 0;
2160 PCADDR UNUSED pc = abuf->addr;
2161 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 2162
190659a2 2163 {
99c53aa9
DE
2164 SI opval = SRLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2165 * FLD (i_dr) = opval;
0a18a6b8 2166 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2167 }
b8a9943d 2168
99c53aa9 2169 return vpc;
646c6f2b
DE
2170#undef FLD
2171}
2172
99c53aa9 2173/* srli: srli $dr,$uimm5 */
a8981d67 2174
99c53aa9
DE
2175SEM_PC
2176SEM_FN_NAME (m32rbf,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2177{
970a8fd6 2178#define FLD(f) abuf->fields.fmt_slli.f
646c6f2b 2179 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2180 int UNUSED written = 0;
2181 PCADDR UNUSED pc = abuf->addr;
2182 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2183
190659a2 2184 {
99c53aa9
DE
2185 SI opval = SRLSI (* FLD (i_dr), FLD (f_uimm5));
2186 * FLD (i_dr) = opval;
0a18a6b8 2187 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2188 }
b8a9943d 2189
99c53aa9 2190 return vpc;
646c6f2b
DE
2191#undef FLD
2192}
2193
99c53aa9 2194/* st: st $src1,@$src2 */
a8981d67 2195
99c53aa9
DE
2196SEM_PC
2197SEM_FN_NAME (m32rbf,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2198{
970a8fd6 2199#define FLD(f) abuf->fields.fmt_st.f
646c6f2b 2200 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2201 int UNUSED written = 0;
2202 PCADDR UNUSED pc = abuf->addr;
2203 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2204
190659a2 2205 {
99c53aa9
DE
2206 SI opval = * FLD (i_src1);
2207 SETMEMSI (current_cpu, * FLD (i_src2), opval);
0a18a6b8 2208 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2 2209 }
a8981d67 2210
99c53aa9 2211 return vpc;
646c6f2b
DE
2212#undef FLD
2213}
2214
99c53aa9 2215/* st-d: st $src1,@($slo16,$src2) */
a8981d67 2216
99c53aa9
DE
2217SEM_PC
2218SEM_FN_NAME (m32rbf,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2219{
970a8fd6 2220#define FLD(f) abuf->fields.fmt_st_d.f
646c6f2b 2221 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2222 int UNUSED written = 0;
2223 PCADDR UNUSED pc = abuf->addr;
2224 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 2225
190659a2 2226 {
99c53aa9
DE
2227 SI opval = * FLD (i_src1);
2228 SETMEMSI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
0a18a6b8 2229 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2 2230 }
a8981d67 2231
99c53aa9 2232 return vpc;
646c6f2b
DE
2233#undef FLD
2234}
2235
99c53aa9 2236/* stb: stb $src1,@$src2 */
a8981d67 2237
99c53aa9
DE
2238SEM_PC
2239SEM_FN_NAME (m32rbf,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2240{
970a8fd6 2241#define FLD(f) abuf->fields.fmt_stb.f
646c6f2b 2242 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2243 int UNUSED written = 0;
2244 PCADDR UNUSED pc = abuf->addr;
2245 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2246
190659a2 2247 {
99c53aa9
DE
2248 QI opval = * FLD (i_src1);
2249 SETMEMQI (current_cpu, * FLD (i_src2), opval);
0a18a6b8 2250 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2 2251 }
a8981d67 2252
99c53aa9 2253 return vpc;
646c6f2b
DE
2254#undef FLD
2255}
2256
99c53aa9 2257/* stb-d: stb $src1,@($slo16,$src2) */
a8981d67 2258
99c53aa9
DE
2259SEM_PC
2260SEM_FN_NAME (m32rbf,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2261{
970a8fd6 2262#define FLD(f) abuf->fields.fmt_stb_d.f
646c6f2b 2263 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2264 int UNUSED written = 0;
2265 PCADDR UNUSED pc = abuf->addr;
2266 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 2267
190659a2 2268 {
99c53aa9
DE
2269 QI opval = * FLD (i_src1);
2270 SETMEMQI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
0a18a6b8 2271 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2 2272 }
a8981d67 2273
99c53aa9 2274 return vpc;
646c6f2b
DE
2275#undef FLD
2276}
2277
99c53aa9 2278/* sth: sth $src1,@$src2 */
a8981d67 2279
99c53aa9
DE
2280SEM_PC
2281SEM_FN_NAME (m32rbf,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2282{
970a8fd6 2283#define FLD(f) abuf->fields.fmt_sth.f
646c6f2b 2284 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2285 int UNUSED written = 0;
2286 PCADDR UNUSED pc = abuf->addr;
2287 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2288
190659a2 2289 {
99c53aa9
DE
2290 HI opval = * FLD (i_src1);
2291 SETMEMHI (current_cpu, * FLD (i_src2), opval);
0a18a6b8 2292 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2 2293 }
a8981d67 2294
99c53aa9 2295 return vpc;
646c6f2b
DE
2296#undef FLD
2297}
2298
99c53aa9 2299/* sth-d: sth $src1,@($slo16,$src2) */
a8981d67 2300
99c53aa9
DE
2301SEM_PC
2302SEM_FN_NAME (m32rbf,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2303{
970a8fd6 2304#define FLD(f) abuf->fields.fmt_sth_d.f
646c6f2b 2305 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2306 int UNUSED written = 0;
2307 PCADDR UNUSED pc = abuf->addr;
2308 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
b8a9943d 2309
190659a2 2310 {
99c53aa9
DE
2311 HI opval = * FLD (i_src1);
2312 SETMEMHI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
0a18a6b8 2313 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2 2314 }
a8981d67 2315
99c53aa9 2316 return vpc;
646c6f2b
DE
2317#undef FLD
2318}
2319
99c53aa9 2320/* st-plus: st $src1,@+$src2 */
a8981d67 2321
99c53aa9
DE
2322SEM_PC
2323SEM_FN_NAME (m32rbf,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2324{
970a8fd6 2325#define FLD(f) abuf->fields.fmt_st_plus.f
646c6f2b 2326 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2327 int UNUSED written = 0;
2328 PCADDR UNUSED pc = abuf->addr;
2329 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2330
9d70630e 2331do {
02310b01 2332 SI tmp_new_src2;
99c53aa9 2333 tmp_new_src2 = ADDSI (* FLD (i_src2), 4);
190659a2 2334 {
99c53aa9 2335 SI opval = * FLD (i_src1);
190659a2 2336 SETMEMSI (current_cpu, tmp_new_src2, opval);
0a18a6b8 2337 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2
DE
2338 }
2339 {
2340 SI opval = tmp_new_src2;
99c53aa9 2341 * FLD (i_src2) = opval;
0a18a6b8 2342 TRACE_RESULT (current_cpu, abuf, "src2", 'x', opval);
190659a2 2343 }
9d70630e 2344} while (0);
b8a9943d 2345
99c53aa9 2346 return vpc;
646c6f2b
DE
2347#undef FLD
2348}
2349
99c53aa9 2350/* st-minus: st $src1,@-$src2 */
a8981d67 2351
99c53aa9
DE
2352SEM_PC
2353SEM_FN_NAME (m32rbf,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2354{
970a8fd6 2355#define FLD(f) abuf->fields.fmt_st_plus.f
646c6f2b 2356 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2357 int UNUSED written = 0;
2358 PCADDR UNUSED pc = abuf->addr;
2359 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2360
9d70630e 2361do {
02310b01 2362 SI tmp_new_src2;
99c53aa9 2363 tmp_new_src2 = SUBSI (* FLD (i_src2), 4);
190659a2 2364 {
99c53aa9 2365 SI opval = * FLD (i_src1);
190659a2 2366 SETMEMSI (current_cpu, tmp_new_src2, opval);
0a18a6b8 2367 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2
DE
2368 }
2369 {
2370 SI opval = tmp_new_src2;
99c53aa9 2371 * FLD (i_src2) = opval;
0a18a6b8 2372 TRACE_RESULT (current_cpu, abuf, "src2", 'x', opval);
190659a2 2373 }
9d70630e 2374} while (0);
b8a9943d 2375
99c53aa9 2376 return vpc;
646c6f2b
DE
2377#undef FLD
2378}
2379
99c53aa9 2380/* sub: sub $dr,$sr */
a8981d67 2381
99c53aa9
DE
2382SEM_PC
2383SEM_FN_NAME (m32rbf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2384{
970a8fd6 2385#define FLD(f) abuf->fields.fmt_add.f
646c6f2b 2386 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2387 int UNUSED written = 0;
2388 PCADDR UNUSED pc = abuf->addr;
2389 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2390
190659a2 2391 {
99c53aa9
DE
2392 SI opval = SUBSI (* FLD (i_dr), * FLD (i_sr));
2393 * FLD (i_dr) = opval;
0a18a6b8 2394 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2 2395 }
b8a9943d 2396
99c53aa9 2397 return vpc;
646c6f2b
DE
2398#undef FLD
2399}
2400
99c53aa9 2401/* subv: subv $dr,$sr */
a8981d67 2402
99c53aa9
DE
2403SEM_PC
2404SEM_FN_NAME (m32rbf,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2405{
970a8fd6 2406#define FLD(f) abuf->fields.fmt_addv.f
646c6f2b 2407 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2408 int UNUSED written = 0;
2409 PCADDR UNUSED pc = abuf->addr;
2410 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2411
646c6f2b 2412do {
99c53aa9
DE
2413 BI temp1;SI temp0;
2414 temp0 = SUBSI (* FLD (i_dr), * FLD (i_sr));
2415 temp1 = SUBOFSI (* FLD (i_dr), * FLD (i_sr), 0);
190659a2
DE
2416 {
2417 SI opval = temp0;
99c53aa9 2418 * FLD (i_dr) = opval;
0a18a6b8 2419 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2
DE
2420 }
2421 {
99c53aa9 2422 BI opval = temp1;
190659a2 2423 CPU (h_cond) = opval;
0a18a6b8 2424 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 2425 }
646c6f2b 2426} while (0);
b8a9943d 2427
99c53aa9 2428 return vpc;
646c6f2b
DE
2429#undef FLD
2430}
2431
99c53aa9 2432/* subx: subx $dr,$sr */
a8981d67 2433
99c53aa9
DE
2434SEM_PC
2435SEM_FN_NAME (m32rbf,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2436{
970a8fd6 2437#define FLD(f) abuf->fields.fmt_addx.f
646c6f2b 2438 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2439 int UNUSED written = 0;
2440 PCADDR UNUSED pc = abuf->addr;
2441 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2442
646c6f2b 2443do {
99c53aa9
DE
2444 BI temp1;SI temp0;
2445 temp0 = SUBCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
2446 temp1 = SUBCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
190659a2
DE
2447 {
2448 SI opval = temp0;
99c53aa9 2449 * FLD (i_dr) = opval;
0a18a6b8 2450 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
190659a2
DE
2451 }
2452 {
99c53aa9 2453 BI opval = temp1;
190659a2 2454 CPU (h_cond) = opval;
0a18a6b8 2455 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
190659a2 2456 }
646c6f2b 2457} while (0);
b8a9943d 2458
99c53aa9 2459 return vpc;
646c6f2b
DE
2460#undef FLD
2461}
2462
99c53aa9 2463/* trap: trap $uimm4 */
a8981d67 2464
99c53aa9
DE
2465SEM_PC
2466SEM_FN_NAME (m32rbf,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2467{
99c53aa9 2468#define FLD(f) abuf->fields.cti.fields.fmt_trap.f
646c6f2b 2469 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2470 int UNUSED written = 0;
2471 PCADDR UNUSED pc = abuf->addr;
2472 SEM_BRANCH_INIT
2473 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2474
cab58155 2475do {
190659a2 2476 {
99c53aa9
DE
2477 USI opval = m32rbf_h_cr_get (current_cpu, ((UINT) 6));
2478 m32rbf_h_cr_set (current_cpu, ((UINT) 14), opval);
0a18a6b8 2479 TRACE_RESULT (current_cpu, abuf, "cr-14", 'x', opval);
99c53aa9
DE
2480 }
2481 {
2482 USI opval = ADDSI (pc, 4);
2483 m32rbf_h_cr_set (current_cpu, ((UINT) 6), opval);
0a18a6b8 2484 TRACE_RESULT (current_cpu, abuf, "cr-6", 'x', opval);
190659a2
DE
2485 }
2486 {
99c53aa9
DE
2487 UQI opval = CPU (h_bpsw);
2488 CPU (h_bbpsw) = opval;
0a18a6b8 2489 TRACE_RESULT (current_cpu, abuf, "bbpsw-0", 'x', opval);
99c53aa9
DE
2490 }
2491 {
2492 UQI opval = m32rbf_h_psw_get (current_cpu);
2493 CPU (h_bpsw) = opval;
0a18a6b8 2494 TRACE_RESULT (current_cpu, abuf, "bpsw-0", 'x', opval);
190659a2
DE
2495 }
2496 {
99c53aa9
DE
2497 UQI opval = ANDQI (m32rbf_h_psw_get (current_cpu), 128);
2498 m32rbf_h_psw_set (current_cpu, opval);
0a18a6b8 2499 TRACE_RESULT (current_cpu, abuf, "psw-0", 'x', opval);
99c53aa9
DE
2500 }
2501 {
2502 SI opval = m32r_trap (current_cpu, pc, FLD (f_uimm4));
2503 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
0a18a6b8 2504 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
190659a2 2505 }
cab58155 2506} while (0);
b8a9943d 2507
99c53aa9
DE
2508 SEM_BRANCH_FINI
2509 return vpc;
646c6f2b
DE
2510#undef FLD
2511}
2512
99c53aa9 2513/* unlock: unlock $src1,@$src2 */
a8981d67 2514
99c53aa9
DE
2515SEM_PC
2516SEM_FN_NAME (m32rbf,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
646c6f2b 2517{
970a8fd6 2518#define FLD(f) abuf->fields.fmt_unlock.f
646c6f2b 2519 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99c53aa9
DE
2520 int UNUSED written = 0;
2521 PCADDR UNUSED pc = abuf->addr;
2522 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
b8a9943d 2523
cab58155
DE
2524do {
2525if (CPU (h_lock)) {
190659a2 2526 {
99c53aa9
DE
2527 SI opval = * FLD (i_src1);
2528 SETMEMSI (current_cpu, * FLD (i_src2), opval);
2529 written |= (1 << 3);
0a18a6b8 2530 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
190659a2
DE
2531 }
2532}
2533 {
99c53aa9 2534 BI opval = 0;
190659a2 2535 CPU (h_lock) = opval;
0a18a6b8 2536 TRACE_RESULT (current_cpu, abuf, "lock-0", 'x', opval);
190659a2 2537 }
cab58155 2538} while (0);
b8a9943d 2539
99c53aa9
DE
2540 abuf->written = written;
2541 return vpc;
646c6f2b
DE
2542#undef FLD
2543}
2544
This page took 0.26477 seconds and 4 git commands to generate.