No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / sim / iq2000 / sem.c
blobb730bed6c7b0168b9d7768371ef7425b3fbb9507
1 /* Simulator instruction semantics for iq2000bf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 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)
12 any later version.
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.
25 #define WANT_CPU iq2000bf
26 #define WANT_CPU_IQ2000BF
28 #include "sim-main.h"
29 #include "cgen-mem.h"
30 #include "cgen-ops.h"
32 #undef GET_ATTR
33 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
34 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
35 #else
36 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_/**/attr)
37 #endif
39 /* This is used so that we can compile two copies of the semantic code,
40 one with full feature support and one without that runs fast(er).
41 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */
42 #if FAST_P
43 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
44 #undef TRACE_RESULT
45 #define TRACE_RESULT(cpu, abuf, name, type, val)
46 #else
47 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
48 #endif
50 /* x-invalid: --invalid-- */
52 static SEM_PC
53 SEM_FN_NAME (iq2000bf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
55 #define FLD(f) abuf->fields.fmt_empty.f
56 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
57 int UNUSED written = 0;
58 IADDR UNUSED pc = abuf->addr;
59 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
62 /* Update the recorded pc in the cpu state struct.
63 Only necessary for WITH_SCACHE case, but to avoid the
64 conditional compilation .... */
65 SET_H_PC (pc);
66 /* Virtual insns have zero size. Overwrite vpc with address of next insn
67 using the default-insn-bitsize spec. When executing insns in parallel
68 we may want to queue the fault and continue execution. */
69 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
70 vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
73 return vpc;
74 #undef FLD
77 /* x-after: --after-- */
79 static SEM_PC
80 SEM_FN_NAME (iq2000bf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
82 #define FLD(f) abuf->fields.fmt_empty.f
83 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
84 int UNUSED written = 0;
85 IADDR UNUSED pc = abuf->addr;
86 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
89 #if WITH_SCACHE_PBB_IQ2000BF
90 iq2000bf_pbb_after (current_cpu, sem_arg);
91 #endif
94 return vpc;
95 #undef FLD
98 /* x-before: --before-- */
100 static SEM_PC
101 SEM_FN_NAME (iq2000bf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
103 #define FLD(f) abuf->fields.fmt_empty.f
104 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
105 int UNUSED written = 0;
106 IADDR UNUSED pc = abuf->addr;
107 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
110 #if WITH_SCACHE_PBB_IQ2000BF
111 iq2000bf_pbb_before (current_cpu, sem_arg);
112 #endif
115 return vpc;
116 #undef FLD
119 /* x-cti-chain: --cti-chain-- */
121 static SEM_PC
122 SEM_FN_NAME (iq2000bf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
124 #define FLD(f) abuf->fields.fmt_empty.f
125 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
126 int UNUSED written = 0;
127 IADDR UNUSED pc = abuf->addr;
128 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
131 #if WITH_SCACHE_PBB_IQ2000BF
132 #ifdef DEFINE_SWITCH
133 vpc = iq2000bf_pbb_cti_chain (current_cpu, sem_arg,
134 pbb_br_type, pbb_br_npc);
135 BREAK (sem);
136 #else
137 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
138 vpc = iq2000bf_pbb_cti_chain (current_cpu, sem_arg,
139 CPU_PBB_BR_TYPE (current_cpu),
140 CPU_PBB_BR_NPC (current_cpu));
141 #endif
142 #endif
145 return vpc;
146 #undef FLD
149 /* x-chain: --chain-- */
151 static SEM_PC
152 SEM_FN_NAME (iq2000bf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
154 #define FLD(f) abuf->fields.fmt_empty.f
155 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
156 int UNUSED written = 0;
157 IADDR UNUSED pc = abuf->addr;
158 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
161 #if WITH_SCACHE_PBB_IQ2000BF
162 vpc = iq2000bf_pbb_chain (current_cpu, sem_arg);
163 #ifdef DEFINE_SWITCH
164 BREAK (sem);
165 #endif
166 #endif
169 return vpc;
170 #undef FLD
173 /* x-begin: --begin-- */
175 static SEM_PC
176 SEM_FN_NAME (iq2000bf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
178 #define FLD(f) abuf->fields.fmt_empty.f
179 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
180 int UNUSED written = 0;
181 IADDR UNUSED pc = abuf->addr;
182 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
185 #if WITH_SCACHE_PBB_IQ2000BF
186 #if defined DEFINE_SWITCH || defined FAST_P
187 /* In the switch case FAST_P is a constant, allowing several optimizations
188 in any called inline functions. */
189 vpc = iq2000bf_pbb_begin (current_cpu, FAST_P);
190 #else
191 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
192 vpc = iq2000bf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
193 #else
194 vpc = iq2000bf_pbb_begin (current_cpu, 0);
195 #endif
196 #endif
197 #endif
200 return vpc;
201 #undef FLD
204 /* add: add $rd,$rs,$rt */
206 static SEM_PC
207 SEM_FN_NAME (iq2000bf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
209 #define FLD(f) abuf->fields.sfmt_mrgb.f
210 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
211 int UNUSED written = 0;
212 IADDR UNUSED pc = abuf->addr;
213 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
216 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
217 SET_H_GR (FLD (f_rd), opval);
218 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
221 return vpc;
222 #undef FLD
225 /* addi: addi $rt,$rs,$lo16 */
227 static SEM_PC
228 SEM_FN_NAME (iq2000bf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
230 #define FLD(f) abuf->fields.sfmt_addi.f
231 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
232 int UNUSED written = 0;
233 IADDR UNUSED pc = abuf->addr;
234 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
237 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
238 SET_H_GR (FLD (f_rt), opval);
239 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
242 return vpc;
243 #undef FLD
246 /* addiu: addiu $rt,$rs,$lo16 */
248 static SEM_PC
249 SEM_FN_NAME (iq2000bf,addiu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
251 #define FLD(f) abuf->fields.sfmt_addi.f
252 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
253 int UNUSED written = 0;
254 IADDR UNUSED pc = abuf->addr;
255 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
258 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
259 SET_H_GR (FLD (f_rt), opval);
260 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
263 return vpc;
264 #undef FLD
267 /* addu: addu $rd,$rs,$rt */
269 static SEM_PC
270 SEM_FN_NAME (iq2000bf,addu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
272 #define FLD(f) abuf->fields.sfmt_mrgb.f
273 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
274 int UNUSED written = 0;
275 IADDR UNUSED pc = abuf->addr;
276 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
279 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
280 SET_H_GR (FLD (f_rd), opval);
281 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
284 return vpc;
285 #undef FLD
288 /* ado16: ado16 $rd,$rs,$rt */
290 static SEM_PC
291 SEM_FN_NAME (iq2000bf,ado16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
293 #define FLD(f) abuf->fields.sfmt_mrgb.f
294 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
295 int UNUSED written = 0;
296 IADDR UNUSED pc = abuf->addr;
297 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
300 HI tmp_high;
301 HI tmp_low;
302 tmp_low = ADDHI (ANDHI (GET_H_GR (FLD (f_rs)), 65535), ANDHI (GET_H_GR (FLD (f_rt)), 65535));
303 tmp_high = ADDHI (SRLSI (GET_H_GR (FLD (f_rs)), 16), SRLSI (GET_H_GR (FLD (f_rt)), 16));
305 SI opval = ORSI (SLLSI (tmp_high, 16), tmp_low);
306 SET_H_GR (FLD (f_rd), opval);
307 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
311 return vpc;
312 #undef FLD
315 /* and: and $rd,$rs,$rt */
317 static SEM_PC
318 SEM_FN_NAME (iq2000bf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
320 #define FLD(f) abuf->fields.sfmt_mrgb.f
321 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
322 int UNUSED written = 0;
323 IADDR UNUSED pc = abuf->addr;
324 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
327 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
328 SET_H_GR (FLD (f_rd), opval);
329 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
332 return vpc;
333 #undef FLD
336 /* andi: andi $rt,$rs,$lo16 */
338 static SEM_PC
339 SEM_FN_NAME (iq2000bf,andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
341 #define FLD(f) abuf->fields.sfmt_addi.f
342 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
343 int UNUSED written = 0;
344 IADDR UNUSED pc = abuf->addr;
345 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
348 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
349 SET_H_GR (FLD (f_rt), opval);
350 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
353 return vpc;
354 #undef FLD
357 /* andoi: andoi $rt,$rs,$lo16 */
359 static SEM_PC
360 SEM_FN_NAME (iq2000bf,andoi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
362 #define FLD(f) abuf->fields.sfmt_addi.f
363 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
364 int UNUSED written = 0;
365 IADDR UNUSED pc = abuf->addr;
366 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
369 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ORSI (0xffff0000, EXTHISI (TRUNCSIHI (FLD (f_imm)))));
370 SET_H_GR (FLD (f_rt), opval);
371 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
374 return vpc;
375 #undef FLD
378 /* nor: nor $rd,$rs,$rt */
380 static SEM_PC
381 SEM_FN_NAME (iq2000bf,nor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
383 #define FLD(f) abuf->fields.sfmt_mrgb.f
384 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
385 int UNUSED written = 0;
386 IADDR UNUSED pc = abuf->addr;
387 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
390 SI opval = INVSI (ORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt))));
391 SET_H_GR (FLD (f_rd), opval);
392 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
395 return vpc;
396 #undef FLD
399 /* or: or $rd,$rs,$rt */
401 static SEM_PC
402 SEM_FN_NAME (iq2000bf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
404 #define FLD(f) abuf->fields.sfmt_mrgb.f
405 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
406 int UNUSED written = 0;
407 IADDR UNUSED pc = abuf->addr;
408 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
411 SI opval = ORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
412 SET_H_GR (FLD (f_rd), opval);
413 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
416 return vpc;
417 #undef FLD
420 /* ori: ori $rt,$rs,$lo16 */
422 static SEM_PC
423 SEM_FN_NAME (iq2000bf,ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
425 #define FLD(f) abuf->fields.sfmt_addi.f
426 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
427 int UNUSED written = 0;
428 IADDR UNUSED pc = abuf->addr;
429 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
432 SI opval = ORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
433 SET_H_GR (FLD (f_rt), opval);
434 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
437 return vpc;
438 #undef FLD
441 /* ram: ram $rd,$rt,$shamt,$maskl,$maskr */
443 static SEM_PC
444 SEM_FN_NAME (iq2000bf,ram) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
446 #define FLD(f) abuf->fields.sfmt_ram.f
447 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
448 int UNUSED written = 0;
449 IADDR UNUSED pc = abuf->addr;
450 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
454 SI opval = RORSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
455 SET_H_GR (FLD (f_rd), opval);
456 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
459 SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SRLSI (0xffffffff, FLD (f_maskl)));
460 SET_H_GR (FLD (f_rd), opval);
461 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
464 SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SLLSI (0xffffffff, FLD (f_rs)));
465 SET_H_GR (FLD (f_rd), opval);
466 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
470 return vpc;
471 #undef FLD
474 /* sll: sll $rd,$rt,$shamt */
476 static SEM_PC
477 SEM_FN_NAME (iq2000bf,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
479 #define FLD(f) abuf->fields.sfmt_ram.f
480 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
481 int UNUSED written = 0;
482 IADDR UNUSED pc = abuf->addr;
483 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
486 SI opval = SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
487 SET_H_GR (FLD (f_rd), opval);
488 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
491 return vpc;
492 #undef FLD
495 /* sllv: sllv $rd,$rt,$rs */
497 static SEM_PC
498 SEM_FN_NAME (iq2000bf,sllv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
500 #define FLD(f) abuf->fields.sfmt_mrgb.f
501 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
502 int UNUSED written = 0;
503 IADDR UNUSED pc = abuf->addr;
504 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
507 SI opval = SLLSI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
508 SET_H_GR (FLD (f_rd), opval);
509 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
512 return vpc;
513 #undef FLD
516 /* slmv: slmv $rd,$rt,$rs,$shamt */
518 static SEM_PC
519 SEM_FN_NAME (iq2000bf,slmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
521 #define FLD(f) abuf->fields.sfmt_ram.f
522 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
523 int UNUSED written = 0;
524 IADDR UNUSED pc = abuf->addr;
525 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
528 SI opval = ANDSI (SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt)), SRLSI (0xffffffff, GET_H_GR (FLD (f_rs))));
529 SET_H_GR (FLD (f_rd), opval);
530 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
533 return vpc;
534 #undef FLD
537 /* slt: slt $rd,$rs,$rt */
539 static SEM_PC
540 SEM_FN_NAME (iq2000bf,slt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
542 #define FLD(f) abuf->fields.sfmt_mrgb.f
543 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
544 int UNUSED written = 0;
545 IADDR UNUSED pc = abuf->addr;
546 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
548 if (LTSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
550 SI opval = 1;
551 SET_H_GR (FLD (f_rd), opval);
552 written |= (1 << 2);
553 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
555 } else {
557 SI opval = 0;
558 SET_H_GR (FLD (f_rd), opval);
559 written |= (1 << 2);
560 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
564 abuf->written = written;
565 return vpc;
566 #undef FLD
569 /* slti: slti $rt,$rs,$imm */
571 static SEM_PC
572 SEM_FN_NAME (iq2000bf,slti) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
574 #define FLD(f) abuf->fields.sfmt_addi.f
575 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
576 int UNUSED written = 0;
577 IADDR UNUSED pc = abuf->addr;
578 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
580 if (LTSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
582 SI opval = 1;
583 SET_H_GR (FLD (f_rt), opval);
584 written |= (1 << 2);
585 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
587 } else {
589 SI opval = 0;
590 SET_H_GR (FLD (f_rt), opval);
591 written |= (1 << 2);
592 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
596 abuf->written = written;
597 return vpc;
598 #undef FLD
601 /* sltiu: sltiu $rt,$rs,$imm */
603 static SEM_PC
604 SEM_FN_NAME (iq2000bf,sltiu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
606 #define FLD(f) abuf->fields.sfmt_addi.f
607 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
608 int UNUSED written = 0;
609 IADDR UNUSED pc = abuf->addr;
610 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
612 if (LTUSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
614 SI opval = 1;
615 SET_H_GR (FLD (f_rt), opval);
616 written |= (1 << 2);
617 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
619 } else {
621 SI opval = 0;
622 SET_H_GR (FLD (f_rt), opval);
623 written |= (1 << 2);
624 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
628 abuf->written = written;
629 return vpc;
630 #undef FLD
633 /* sltu: sltu $rd,$rs,$rt */
635 static SEM_PC
636 SEM_FN_NAME (iq2000bf,sltu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
638 #define FLD(f) abuf->fields.sfmt_mrgb.f
639 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
640 int UNUSED written = 0;
641 IADDR UNUSED pc = abuf->addr;
642 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
644 if (LTUSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
646 SI opval = 1;
647 SET_H_GR (FLD (f_rd), opval);
648 written |= (1 << 2);
649 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
651 } else {
653 SI opval = 0;
654 SET_H_GR (FLD (f_rd), opval);
655 written |= (1 << 2);
656 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
660 abuf->written = written;
661 return vpc;
662 #undef FLD
665 /* sra: sra $rd,$rt,$shamt */
667 static SEM_PC
668 SEM_FN_NAME (iq2000bf,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
670 #define FLD(f) abuf->fields.sfmt_ram.f
671 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
672 int UNUSED written = 0;
673 IADDR UNUSED pc = abuf->addr;
674 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
677 SI opval = SRASI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
678 SET_H_GR (FLD (f_rd), opval);
679 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
682 return vpc;
683 #undef FLD
686 /* srav: srav $rd,$rt,$rs */
688 static SEM_PC
689 SEM_FN_NAME (iq2000bf,srav) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
691 #define FLD(f) abuf->fields.sfmt_mrgb.f
692 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
693 int UNUSED written = 0;
694 IADDR UNUSED pc = abuf->addr;
695 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
698 SI opval = SRASI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
699 SET_H_GR (FLD (f_rd), opval);
700 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
703 return vpc;
704 #undef FLD
707 /* srl: srl $rd,$rt,$shamt */
709 static SEM_PC
710 SEM_FN_NAME (iq2000bf,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
712 #define FLD(f) abuf->fields.sfmt_ram.f
713 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
714 int UNUSED written = 0;
715 IADDR UNUSED pc = abuf->addr;
716 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
719 SI opval = SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
720 SET_H_GR (FLD (f_rd), opval);
721 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
724 return vpc;
725 #undef FLD
728 /* srlv: srlv $rd,$rt,$rs */
730 static SEM_PC
731 SEM_FN_NAME (iq2000bf,srlv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
733 #define FLD(f) abuf->fields.sfmt_mrgb.f
734 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
735 int UNUSED written = 0;
736 IADDR UNUSED pc = abuf->addr;
737 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
740 SI opval = SRLSI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
741 SET_H_GR (FLD (f_rd), opval);
742 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
745 return vpc;
746 #undef FLD
749 /* srmv: srmv $rd,$rt,$rs,$shamt */
751 static SEM_PC
752 SEM_FN_NAME (iq2000bf,srmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
754 #define FLD(f) abuf->fields.sfmt_ram.f
755 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
756 int UNUSED written = 0;
757 IADDR UNUSED pc = abuf->addr;
758 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
761 SI opval = ANDSI (SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt)), SLLSI (0xffffffff, GET_H_GR (FLD (f_rs))));
762 SET_H_GR (FLD (f_rd), opval);
763 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
766 return vpc;
767 #undef FLD
770 /* sub: sub $rd,$rs,$rt */
772 static SEM_PC
773 SEM_FN_NAME (iq2000bf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
775 #define FLD(f) abuf->fields.sfmt_mrgb.f
776 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
777 int UNUSED written = 0;
778 IADDR UNUSED pc = abuf->addr;
779 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
782 SI opval = SUBSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
783 SET_H_GR (FLD (f_rd), opval);
784 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
787 return vpc;
788 #undef FLD
791 /* subu: subu $rd,$rs,$rt */
793 static SEM_PC
794 SEM_FN_NAME (iq2000bf,subu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
796 #define FLD(f) abuf->fields.sfmt_mrgb.f
797 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
798 int UNUSED written = 0;
799 IADDR UNUSED pc = abuf->addr;
800 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
803 SI opval = SUBSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
804 SET_H_GR (FLD (f_rd), opval);
805 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
808 return vpc;
809 #undef FLD
812 /* xor: xor $rd,$rs,$rt */
814 static SEM_PC
815 SEM_FN_NAME (iq2000bf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
817 #define FLD(f) abuf->fields.sfmt_mrgb.f
818 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
819 int UNUSED written = 0;
820 IADDR UNUSED pc = abuf->addr;
821 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
824 SI opval = XORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
825 SET_H_GR (FLD (f_rd), opval);
826 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
829 return vpc;
830 #undef FLD
833 /* xori: xori $rt,$rs,$lo16 */
835 static SEM_PC
836 SEM_FN_NAME (iq2000bf,xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
838 #define FLD(f) abuf->fields.sfmt_addi.f
839 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
840 int UNUSED written = 0;
841 IADDR UNUSED pc = abuf->addr;
842 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
845 SI opval = XORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
846 SET_H_GR (FLD (f_rt), opval);
847 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
850 return vpc;
851 #undef FLD
854 /* bbi: bbi $rs($bitnum),$offset */
856 static SEM_PC
857 SEM_FN_NAME (iq2000bf,bbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
859 #define FLD(f) abuf->fields.sfmt_bbi.f
860 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
861 int UNUSED written = 0;
862 IADDR UNUSED pc = abuf->addr;
863 SEM_BRANCH_INIT
864 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
866 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt)))) {
869 USI opval = FLD (i_offset);
870 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
871 written |= (1 << 3);
872 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
877 abuf->written = written;
878 SEM_BRANCH_FINI (vpc);
879 return vpc;
880 #undef FLD
883 /* bbin: bbin $rs($bitnum),$offset */
885 static SEM_PC
886 SEM_FN_NAME (iq2000bf,bbin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
888 #define FLD(f) abuf->fields.sfmt_bbi.f
889 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
890 int UNUSED written = 0;
891 IADDR UNUSED pc = abuf->addr;
892 SEM_BRANCH_INIT
893 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
895 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt))))) {
898 USI opval = FLD (i_offset);
899 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
900 written |= (1 << 3);
901 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
906 abuf->written = written;
907 SEM_BRANCH_FINI (vpc);
908 return vpc;
909 #undef FLD
912 /* bbv: bbv $rs,$rt,$offset */
914 static SEM_PC
915 SEM_FN_NAME (iq2000bf,bbv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
917 #define FLD(f) abuf->fields.sfmt_bbi.f
918 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
919 int UNUSED written = 0;
920 IADDR UNUSED pc = abuf->addr;
921 SEM_BRANCH_INIT
922 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
924 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31)))) {
927 USI opval = FLD (i_offset);
928 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
929 written |= (1 << 3);
930 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
935 abuf->written = written;
936 SEM_BRANCH_FINI (vpc);
937 return vpc;
938 #undef FLD
941 /* bbvn: bbvn $rs,$rt,$offset */
943 static SEM_PC
944 SEM_FN_NAME (iq2000bf,bbvn) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
946 #define FLD(f) abuf->fields.sfmt_bbi.f
947 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
948 int UNUSED written = 0;
949 IADDR UNUSED pc = abuf->addr;
950 SEM_BRANCH_INIT
951 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
953 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31))))) {
956 USI opval = FLD (i_offset);
957 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
958 written |= (1 << 3);
959 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
964 abuf->written = written;
965 SEM_BRANCH_FINI (vpc);
966 return vpc;
967 #undef FLD
970 /* beq: beq $rs,$rt,$offset */
972 static SEM_PC
973 SEM_FN_NAME (iq2000bf,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
975 #define FLD(f) abuf->fields.sfmt_bbi.f
976 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
977 int UNUSED written = 0;
978 IADDR UNUSED pc = abuf->addr;
979 SEM_BRANCH_INIT
980 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
982 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
985 USI opval = FLD (i_offset);
986 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
987 written |= (1 << 3);
988 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
993 abuf->written = written;
994 SEM_BRANCH_FINI (vpc);
995 return vpc;
996 #undef FLD
999 /* beql: beql $rs,$rt,$offset */
1001 static SEM_PC
1002 SEM_FN_NAME (iq2000bf,beql) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1004 #define FLD(f) abuf->fields.sfmt_bbi.f
1005 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1006 int UNUSED written = 0;
1007 IADDR UNUSED pc = abuf->addr;
1008 SEM_BRANCH_INIT
1009 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1011 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1014 USI opval = FLD (i_offset);
1015 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1016 written |= (1 << 3);
1017 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1020 } else {
1021 if (1)
1022 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1025 abuf->written = written;
1026 SEM_BRANCH_FINI (vpc);
1027 return vpc;
1028 #undef FLD
1031 /* bgez: bgez $rs,$offset */
1033 static SEM_PC
1034 SEM_FN_NAME (iq2000bf,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1036 #define FLD(f) abuf->fields.sfmt_bbi.f
1037 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1038 int UNUSED written = 0;
1039 IADDR UNUSED pc = abuf->addr;
1040 SEM_BRANCH_INIT
1041 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1043 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1046 USI opval = FLD (i_offset);
1047 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1048 written |= (1 << 2);
1049 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1054 abuf->written = written;
1055 SEM_BRANCH_FINI (vpc);
1056 return vpc;
1057 #undef FLD
1060 /* bgezal: bgezal $rs,$offset */
1062 static SEM_PC
1063 SEM_FN_NAME (iq2000bf,bgezal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1065 #define FLD(f) abuf->fields.sfmt_bbi.f
1066 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1067 int UNUSED written = 0;
1068 IADDR UNUSED pc = abuf->addr;
1069 SEM_BRANCH_INIT
1070 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1072 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1075 SI opval = ADDSI (pc, 8);
1076 SET_H_GR (((UINT) 31), opval);
1077 written |= (1 << 3);
1078 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1082 USI opval = FLD (i_offset);
1083 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1084 written |= (1 << 4);
1085 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1091 abuf->written = written;
1092 SEM_BRANCH_FINI (vpc);
1093 return vpc;
1094 #undef FLD
1097 /* bgezall: bgezall $rs,$offset */
1099 static SEM_PC
1100 SEM_FN_NAME (iq2000bf,bgezall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1102 #define FLD(f) abuf->fields.sfmt_bbi.f
1103 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1104 int UNUSED written = 0;
1105 IADDR UNUSED pc = abuf->addr;
1106 SEM_BRANCH_INIT
1107 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1109 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1112 SI opval = ADDSI (pc, 8);
1113 SET_H_GR (((UINT) 31), opval);
1114 written |= (1 << 3);
1115 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1119 USI opval = FLD (i_offset);
1120 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1121 written |= (1 << 4);
1122 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1126 } else {
1127 if (1)
1128 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1131 abuf->written = written;
1132 SEM_BRANCH_FINI (vpc);
1133 return vpc;
1134 #undef FLD
1137 /* bgezl: bgezl $rs,$offset */
1139 static SEM_PC
1140 SEM_FN_NAME (iq2000bf,bgezl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1142 #define FLD(f) abuf->fields.sfmt_bbi.f
1143 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1144 int UNUSED written = 0;
1145 IADDR UNUSED pc = abuf->addr;
1146 SEM_BRANCH_INIT
1147 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1149 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1152 USI opval = FLD (i_offset);
1153 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1154 written |= (1 << 2);
1155 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1158 } else {
1159 if (1)
1160 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1163 abuf->written = written;
1164 SEM_BRANCH_FINI (vpc);
1165 return vpc;
1166 #undef FLD
1169 /* bltz: bltz $rs,$offset */
1171 static SEM_PC
1172 SEM_FN_NAME (iq2000bf,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1174 #define FLD(f) abuf->fields.sfmt_bbi.f
1175 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1176 int UNUSED written = 0;
1177 IADDR UNUSED pc = abuf->addr;
1178 SEM_BRANCH_INIT
1179 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1181 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1184 USI opval = FLD (i_offset);
1185 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1186 written |= (1 << 2);
1187 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1192 abuf->written = written;
1193 SEM_BRANCH_FINI (vpc);
1194 return vpc;
1195 #undef FLD
1198 /* bltzl: bltzl $rs,$offset */
1200 static SEM_PC
1201 SEM_FN_NAME (iq2000bf,bltzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1203 #define FLD(f) abuf->fields.sfmt_bbi.f
1204 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1205 int UNUSED written = 0;
1206 IADDR UNUSED pc = abuf->addr;
1207 SEM_BRANCH_INIT
1208 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1210 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1213 USI opval = FLD (i_offset);
1214 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1215 written |= (1 << 2);
1216 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1219 } else {
1220 if (1)
1221 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1224 abuf->written = written;
1225 SEM_BRANCH_FINI (vpc);
1226 return vpc;
1227 #undef FLD
1230 /* bltzal: bltzal $rs,$offset */
1232 static SEM_PC
1233 SEM_FN_NAME (iq2000bf,bltzal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1235 #define FLD(f) abuf->fields.sfmt_bbi.f
1236 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1237 int UNUSED written = 0;
1238 IADDR UNUSED pc = abuf->addr;
1239 SEM_BRANCH_INIT
1240 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1242 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1245 SI opval = ADDSI (pc, 8);
1246 SET_H_GR (((UINT) 31), opval);
1247 written |= (1 << 3);
1248 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1252 USI opval = FLD (i_offset);
1253 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1254 written |= (1 << 4);
1255 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1261 abuf->written = written;
1262 SEM_BRANCH_FINI (vpc);
1263 return vpc;
1264 #undef FLD
1267 /* bltzall: bltzall $rs,$offset */
1269 static SEM_PC
1270 SEM_FN_NAME (iq2000bf,bltzall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1272 #define FLD(f) abuf->fields.sfmt_bbi.f
1273 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1274 int UNUSED written = 0;
1275 IADDR UNUSED pc = abuf->addr;
1276 SEM_BRANCH_INIT
1277 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1279 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1282 SI opval = ADDSI (pc, 8);
1283 SET_H_GR (((UINT) 31), opval);
1284 written |= (1 << 3);
1285 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1289 USI opval = FLD (i_offset);
1290 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1291 written |= (1 << 4);
1292 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1296 } else {
1297 if (1)
1298 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1301 abuf->written = written;
1302 SEM_BRANCH_FINI (vpc);
1303 return vpc;
1304 #undef FLD
1307 /* bmb0: bmb0 $rs,$rt,$offset */
1309 static SEM_PC
1310 SEM_FN_NAME (iq2000bf,bmb0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1312 #define FLD(f) abuf->fields.sfmt_bbi.f
1313 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1314 int UNUSED written = 0;
1315 IADDR UNUSED pc = abuf->addr;
1316 SEM_BRANCH_INIT
1317 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1319 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
1322 USI opval = FLD (i_offset);
1323 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1324 written |= (1 << 3);
1325 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1330 abuf->written = written;
1331 SEM_BRANCH_FINI (vpc);
1332 return vpc;
1333 #undef FLD
1336 /* bmb1: bmb1 $rs,$rt,$offset */
1338 static SEM_PC
1339 SEM_FN_NAME (iq2000bf,bmb1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1341 #define FLD(f) abuf->fields.sfmt_bbi.f
1342 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1343 int UNUSED written = 0;
1344 IADDR UNUSED pc = abuf->addr;
1345 SEM_BRANCH_INIT
1346 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1348 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
1351 USI opval = FLD (i_offset);
1352 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1353 written |= (1 << 3);
1354 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1359 abuf->written = written;
1360 SEM_BRANCH_FINI (vpc);
1361 return vpc;
1362 #undef FLD
1365 /* bmb2: bmb2 $rs,$rt,$offset */
1367 static SEM_PC
1368 SEM_FN_NAME (iq2000bf,bmb2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1370 #define FLD(f) abuf->fields.sfmt_bbi.f
1371 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1372 int UNUSED written = 0;
1373 IADDR UNUSED pc = abuf->addr;
1374 SEM_BRANCH_INIT
1375 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1377 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
1380 USI opval = FLD (i_offset);
1381 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1382 written |= (1 << 3);
1383 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1388 abuf->written = written;
1389 SEM_BRANCH_FINI (vpc);
1390 return vpc;
1391 #undef FLD
1394 /* bmb3: bmb3 $rs,$rt,$offset */
1396 static SEM_PC
1397 SEM_FN_NAME (iq2000bf,bmb3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1399 #define FLD(f) abuf->fields.sfmt_bbi.f
1400 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1401 int UNUSED written = 0;
1402 IADDR UNUSED pc = abuf->addr;
1403 SEM_BRANCH_INIT
1404 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1406 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
1409 USI opval = FLD (i_offset);
1410 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1411 written |= (1 << 3);
1412 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1417 abuf->written = written;
1418 SEM_BRANCH_FINI (vpc);
1419 return vpc;
1420 #undef FLD
1423 /* bne: bne $rs,$rt,$offset */
1425 static SEM_PC
1426 SEM_FN_NAME (iq2000bf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1428 #define FLD(f) abuf->fields.sfmt_bbi.f
1429 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1430 int UNUSED written = 0;
1431 IADDR UNUSED pc = abuf->addr;
1432 SEM_BRANCH_INIT
1433 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1435 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1438 USI opval = FLD (i_offset);
1439 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1440 written |= (1 << 3);
1441 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1446 abuf->written = written;
1447 SEM_BRANCH_FINI (vpc);
1448 return vpc;
1449 #undef FLD
1452 /* bnel: bnel $rs,$rt,$offset */
1454 static SEM_PC
1455 SEM_FN_NAME (iq2000bf,bnel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1457 #define FLD(f) abuf->fields.sfmt_bbi.f
1458 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1459 int UNUSED written = 0;
1460 IADDR UNUSED pc = abuf->addr;
1461 SEM_BRANCH_INIT
1462 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1464 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1467 USI opval = FLD (i_offset);
1468 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1469 written |= (1 << 3);
1470 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1473 } else {
1474 if (1)
1475 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1478 abuf->written = written;
1479 SEM_BRANCH_FINI (vpc);
1480 return vpc;
1481 #undef FLD
1484 /* jalr: jalr $rd,$rs */
1486 static SEM_PC
1487 SEM_FN_NAME (iq2000bf,jalr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1489 #define FLD(f) abuf->fields.sfmt_mrgb.f
1490 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1491 int UNUSED written = 0;
1492 IADDR UNUSED pc = abuf->addr;
1493 SEM_BRANCH_INIT
1494 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1499 SI opval = ADDSI (pc, 8);
1500 SET_H_GR (FLD (f_rd), opval);
1501 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1504 USI opval = GET_H_GR (FLD (f_rs));
1505 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1506 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1511 SEM_BRANCH_FINI (vpc);
1512 return vpc;
1513 #undef FLD
1516 /* jr: jr $rs */
1518 static SEM_PC
1519 SEM_FN_NAME (iq2000bf,jr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1521 #define FLD(f) abuf->fields.sfmt_bbi.f
1522 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1523 int UNUSED written = 0;
1524 IADDR UNUSED pc = abuf->addr;
1525 SEM_BRANCH_INIT
1526 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1530 USI opval = GET_H_GR (FLD (f_rs));
1531 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1532 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1536 SEM_BRANCH_FINI (vpc);
1537 return vpc;
1538 #undef FLD
1541 /* lb: lb $rt,$lo16($base) */
1543 static SEM_PC
1544 SEM_FN_NAME (iq2000bf,lb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1546 #define FLD(f) abuf->fields.sfmt_addi.f
1547 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1548 int UNUSED written = 0;
1549 IADDR UNUSED pc = abuf->addr;
1550 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1553 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1554 SET_H_GR (FLD (f_rt), opval);
1555 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1558 return vpc;
1559 #undef FLD
1562 /* lbu: lbu $rt,$lo16($base) */
1564 static SEM_PC
1565 SEM_FN_NAME (iq2000bf,lbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1567 #define FLD(f) abuf->fields.sfmt_addi.f
1568 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1569 int UNUSED written = 0;
1570 IADDR UNUSED pc = abuf->addr;
1571 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1574 SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1575 SET_H_GR (FLD (f_rt), opval);
1576 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1579 return vpc;
1580 #undef FLD
1583 /* lh: lh $rt,$lo16($base) */
1585 static SEM_PC
1586 SEM_FN_NAME (iq2000bf,lh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1588 #define FLD(f) abuf->fields.sfmt_addi.f
1589 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1590 int UNUSED written = 0;
1591 IADDR UNUSED pc = abuf->addr;
1592 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1595 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1596 SET_H_GR (FLD (f_rt), opval);
1597 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1600 return vpc;
1601 #undef FLD
1604 /* lhu: lhu $rt,$lo16($base) */
1606 static SEM_PC
1607 SEM_FN_NAME (iq2000bf,lhu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1609 #define FLD(f) abuf->fields.sfmt_addi.f
1610 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1611 int UNUSED written = 0;
1612 IADDR UNUSED pc = abuf->addr;
1613 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1616 SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1617 SET_H_GR (FLD (f_rt), opval);
1618 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1621 return vpc;
1622 #undef FLD
1625 /* lui: lui $rt,$hi16 */
1627 static SEM_PC
1628 SEM_FN_NAME (iq2000bf,lui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1630 #define FLD(f) abuf->fields.sfmt_addi.f
1631 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1632 int UNUSED written = 0;
1633 IADDR UNUSED pc = abuf->addr;
1634 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1637 SI opval = SLLSI (FLD (f_imm), 16);
1638 SET_H_GR (FLD (f_rt), opval);
1639 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1642 return vpc;
1643 #undef FLD
1646 /* lw: lw $rt,$lo16($base) */
1648 static SEM_PC
1649 SEM_FN_NAME (iq2000bf,lw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1651 #define FLD(f) abuf->fields.sfmt_addi.f
1652 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1653 int UNUSED written = 0;
1654 IADDR UNUSED pc = abuf->addr;
1655 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1658 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))));
1659 SET_H_GR (FLD (f_rt), opval);
1660 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1663 return vpc;
1664 #undef FLD
1667 /* sb: sb $rt,$lo16($base) */
1669 static SEM_PC
1670 SEM_FN_NAME (iq2000bf,sb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1672 #define FLD(f) abuf->fields.sfmt_addi.f
1673 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1674 int UNUSED written = 0;
1675 IADDR UNUSED pc = abuf->addr;
1676 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1679 QI opval = ANDQI (GET_H_GR (FLD (f_rt)), 255);
1680 SETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1681 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1684 return vpc;
1685 #undef FLD
1688 /* sh: sh $rt,$lo16($base) */
1690 static SEM_PC
1691 SEM_FN_NAME (iq2000bf,sh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1693 #define FLD(f) abuf->fields.sfmt_addi.f
1694 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1695 int UNUSED written = 0;
1696 IADDR UNUSED pc = abuf->addr;
1697 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1700 HI opval = ANDHI (GET_H_GR (FLD (f_rt)), 65535);
1701 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1702 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1705 return vpc;
1706 #undef FLD
1709 /* sw: sw $rt,$lo16($base) */
1711 static SEM_PC
1712 SEM_FN_NAME (iq2000bf,sw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1714 #define FLD(f) abuf->fields.sfmt_addi.f
1715 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1716 int UNUSED written = 0;
1717 IADDR UNUSED pc = abuf->addr;
1718 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1721 SI opval = GET_H_GR (FLD (f_rt));
1722 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1723 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1726 return vpc;
1727 #undef FLD
1730 /* break: break */
1732 static SEM_PC
1733 SEM_FN_NAME (iq2000bf,break) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1735 #define FLD(f) abuf->fields.fmt_empty.f
1736 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1737 int UNUSED written = 0;
1738 IADDR UNUSED pc = abuf->addr;
1739 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1741 do_break (current_cpu, pc);
1743 return vpc;
1744 #undef FLD
1747 /* syscall: syscall */
1749 static SEM_PC
1750 SEM_FN_NAME (iq2000bf,syscall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1752 #define FLD(f) abuf->fields.fmt_empty.f
1753 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1754 int UNUSED written = 0;
1755 IADDR UNUSED pc = abuf->addr;
1756 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1758 do_syscall (current_cpu);
1760 return vpc;
1761 #undef FLD
1764 /* andoui: andoui $rt,$rs,$hi16 */
1766 static SEM_PC
1767 SEM_FN_NAME (iq2000bf,andoui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1769 #define FLD(f) abuf->fields.sfmt_addi.f
1770 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1771 int UNUSED written = 0;
1772 IADDR UNUSED pc = abuf->addr;
1773 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1776 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ORSI (SLLSI (FLD (f_imm), 16), 65535));
1777 SET_H_GR (FLD (f_rt), opval);
1778 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1781 return vpc;
1782 #undef FLD
1785 /* orui: orui $rt,$rs,$hi16 */
1787 static SEM_PC
1788 SEM_FN_NAME (iq2000bf,orui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1790 #define FLD(f) abuf->fields.sfmt_addi.f
1791 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1792 int UNUSED written = 0;
1793 IADDR UNUSED pc = abuf->addr;
1794 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1797 SI opval = ORSI (GET_H_GR (FLD (f_rs)), SLLSI (FLD (f_imm), 16));
1798 SET_H_GR (FLD (f_rt), opval);
1799 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1802 return vpc;
1803 #undef FLD
1806 /* bgtz: bgtz $rs,$offset */
1808 static SEM_PC
1809 SEM_FN_NAME (iq2000bf,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1811 #define FLD(f) abuf->fields.sfmt_bbi.f
1812 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1813 int UNUSED written = 0;
1814 IADDR UNUSED pc = abuf->addr;
1815 SEM_BRANCH_INIT
1816 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1818 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1821 USI opval = FLD (i_offset);
1822 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1823 written |= (1 << 2);
1824 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1829 abuf->written = written;
1830 SEM_BRANCH_FINI (vpc);
1831 return vpc;
1832 #undef FLD
1835 /* bgtzl: bgtzl $rs,$offset */
1837 static SEM_PC
1838 SEM_FN_NAME (iq2000bf,bgtzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1840 #define FLD(f) abuf->fields.sfmt_bbi.f
1841 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1842 int UNUSED written = 0;
1843 IADDR UNUSED pc = abuf->addr;
1844 SEM_BRANCH_INIT
1845 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1847 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1850 USI opval = FLD (i_offset);
1851 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1852 written |= (1 << 2);
1853 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1856 } else {
1857 if (1)
1858 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1861 abuf->written = written;
1862 SEM_BRANCH_FINI (vpc);
1863 return vpc;
1864 #undef FLD
1867 /* blez: blez $rs,$offset */
1869 static SEM_PC
1870 SEM_FN_NAME (iq2000bf,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1872 #define FLD(f) abuf->fields.sfmt_bbi.f
1873 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1874 int UNUSED written = 0;
1875 IADDR UNUSED pc = abuf->addr;
1876 SEM_BRANCH_INIT
1877 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1879 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1882 USI opval = FLD (i_offset);
1883 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1884 written |= (1 << 2);
1885 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1890 abuf->written = written;
1891 SEM_BRANCH_FINI (vpc);
1892 return vpc;
1893 #undef FLD
1896 /* blezl: blezl $rs,$offset */
1898 static SEM_PC
1899 SEM_FN_NAME (iq2000bf,blezl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1901 #define FLD(f) abuf->fields.sfmt_bbi.f
1902 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1903 int UNUSED written = 0;
1904 IADDR UNUSED pc = abuf->addr;
1905 SEM_BRANCH_INIT
1906 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1908 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1911 USI opval = FLD (i_offset);
1912 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1913 written |= (1 << 2);
1914 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1917 } else {
1918 if (1)
1919 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1922 abuf->written = written;
1923 SEM_BRANCH_FINI (vpc);
1924 return vpc;
1925 #undef FLD
1928 /* mrgb: mrgb $rd,$rs,$rt,$mask */
1930 static SEM_PC
1931 SEM_FN_NAME (iq2000bf,mrgb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1933 #define FLD(f) abuf->fields.sfmt_mrgb.f
1934 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1935 int UNUSED written = 0;
1936 IADDR UNUSED pc = abuf->addr;
1937 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1940 SI tmp_temp;
1941 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 0)))) {
1942 tmp_temp = ANDSI (GET_H_GR (FLD (f_rs)), 255);
1943 } else {
1944 tmp_temp = ANDSI (GET_H_GR (FLD (f_rt)), 255);
1946 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 1)))) {
1947 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 65280));
1948 } else {
1949 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 65280));
1951 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 2)))) {
1952 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 16711680));
1953 } else {
1954 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 16711680));
1956 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 3)))) {
1957 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000));
1958 } else {
1959 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000));
1962 SI opval = tmp_temp;
1963 SET_H_GR (FLD (f_rd), opval);
1964 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1968 return vpc;
1969 #undef FLD
1972 /* bctxt: bctxt $rs,$offset */
1974 static SEM_PC
1975 SEM_FN_NAME (iq2000bf,bctxt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1977 #define FLD(f) abuf->fields.fmt_empty.f
1978 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1979 int UNUSED written = 0;
1980 IADDR UNUSED pc = abuf->addr;
1981 SEM_BRANCH_INIT
1982 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1984 ((void) 0); /*nop*/
1986 SEM_BRANCH_FINI (vpc);
1987 return vpc;
1988 #undef FLD
1991 /* bc0f: bc0f $offset */
1993 static SEM_PC
1994 SEM_FN_NAME (iq2000bf,bc0f) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1996 #define FLD(f) abuf->fields.fmt_empty.f
1997 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1998 int UNUSED written = 0;
1999 IADDR UNUSED pc = abuf->addr;
2000 SEM_BRANCH_INIT
2001 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2003 ((void) 0); /*nop*/
2005 SEM_BRANCH_FINI (vpc);
2006 return vpc;
2007 #undef FLD
2010 /* bc0fl: bc0fl $offset */
2012 static SEM_PC
2013 SEM_FN_NAME (iq2000bf,bc0fl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2015 #define FLD(f) abuf->fields.fmt_empty.f
2016 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2017 int UNUSED written = 0;
2018 IADDR UNUSED pc = abuf->addr;
2019 SEM_BRANCH_INIT
2020 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2022 ((void) 0); /*nop*/
2024 SEM_BRANCH_FINI (vpc);
2025 return vpc;
2026 #undef FLD
2029 /* bc3f: bc3f $offset */
2031 static SEM_PC
2032 SEM_FN_NAME (iq2000bf,bc3f) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2034 #define FLD(f) abuf->fields.fmt_empty.f
2035 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2036 int UNUSED written = 0;
2037 IADDR UNUSED pc = abuf->addr;
2038 SEM_BRANCH_INIT
2039 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2041 ((void) 0); /*nop*/
2043 SEM_BRANCH_FINI (vpc);
2044 return vpc;
2045 #undef FLD
2048 /* bc3fl: bc3fl $offset */
2050 static SEM_PC
2051 SEM_FN_NAME (iq2000bf,bc3fl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2053 #define FLD(f) abuf->fields.fmt_empty.f
2054 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2055 int UNUSED written = 0;
2056 IADDR UNUSED pc = abuf->addr;
2057 SEM_BRANCH_INIT
2058 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2060 ((void) 0); /*nop*/
2062 SEM_BRANCH_FINI (vpc);
2063 return vpc;
2064 #undef FLD
2067 /* bc0t: bc0t $offset */
2069 static SEM_PC
2070 SEM_FN_NAME (iq2000bf,bc0t) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2072 #define FLD(f) abuf->fields.fmt_empty.f
2073 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2074 int UNUSED written = 0;
2075 IADDR UNUSED pc = abuf->addr;
2076 SEM_BRANCH_INIT
2077 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2079 ((void) 0); /*nop*/
2081 SEM_BRANCH_FINI (vpc);
2082 return vpc;
2083 #undef FLD
2086 /* bc0tl: bc0tl $offset */
2088 static SEM_PC
2089 SEM_FN_NAME (iq2000bf,bc0tl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2091 #define FLD(f) abuf->fields.fmt_empty.f
2092 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2093 int UNUSED written = 0;
2094 IADDR UNUSED pc = abuf->addr;
2095 SEM_BRANCH_INIT
2096 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2098 ((void) 0); /*nop*/
2100 SEM_BRANCH_FINI (vpc);
2101 return vpc;
2102 #undef FLD
2105 /* bc3t: bc3t $offset */
2107 static SEM_PC
2108 SEM_FN_NAME (iq2000bf,bc3t) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2110 #define FLD(f) abuf->fields.fmt_empty.f
2111 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2112 int UNUSED written = 0;
2113 IADDR UNUSED pc = abuf->addr;
2114 SEM_BRANCH_INIT
2115 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2117 ((void) 0); /*nop*/
2119 SEM_BRANCH_FINI (vpc);
2120 return vpc;
2121 #undef FLD
2124 /* bc3tl: bc3tl $offset */
2126 static SEM_PC
2127 SEM_FN_NAME (iq2000bf,bc3tl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2129 #define FLD(f) abuf->fields.fmt_empty.f
2130 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2131 int UNUSED written = 0;
2132 IADDR UNUSED pc = abuf->addr;
2133 SEM_BRANCH_INIT
2134 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2136 ((void) 0); /*nop*/
2138 SEM_BRANCH_FINI (vpc);
2139 return vpc;
2140 #undef FLD
2143 /* cfc0: cfc0 $rt,$rd */
2145 static SEM_PC
2146 SEM_FN_NAME (iq2000bf,cfc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2148 #define FLD(f) abuf->fields.fmt_empty.f
2149 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2150 int UNUSED written = 0;
2151 IADDR UNUSED pc = abuf->addr;
2152 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2154 ((void) 0); /*nop*/
2156 return vpc;
2157 #undef FLD
2160 /* cfc1: cfc1 $rt,$rd */
2162 static SEM_PC
2163 SEM_FN_NAME (iq2000bf,cfc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2165 #define FLD(f) abuf->fields.fmt_empty.f
2166 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2167 int UNUSED written = 0;
2168 IADDR UNUSED pc = abuf->addr;
2169 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2171 ((void) 0); /*nop*/
2173 return vpc;
2174 #undef FLD
2177 /* cfc2: cfc2 $rt,$rd */
2179 static SEM_PC
2180 SEM_FN_NAME (iq2000bf,cfc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2182 #define FLD(f) abuf->fields.fmt_empty.f
2183 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2184 int UNUSED written = 0;
2185 IADDR UNUSED pc = abuf->addr;
2186 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2188 ((void) 0); /*nop*/
2190 return vpc;
2191 #undef FLD
2194 /* cfc3: cfc3 $rt,$rd */
2196 static SEM_PC
2197 SEM_FN_NAME (iq2000bf,cfc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2199 #define FLD(f) abuf->fields.fmt_empty.f
2200 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2201 int UNUSED written = 0;
2202 IADDR UNUSED pc = abuf->addr;
2203 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2205 ((void) 0); /*nop*/
2207 return vpc;
2208 #undef FLD
2211 /* chkhdr: chkhdr $rd,$rt */
2213 static SEM_PC
2214 SEM_FN_NAME (iq2000bf,chkhdr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2216 #define FLD(f) abuf->fields.fmt_empty.f
2217 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2218 int UNUSED written = 0;
2219 IADDR UNUSED pc = abuf->addr;
2220 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2222 ((void) 0); /*nop*/
2224 return vpc;
2225 #undef FLD
2228 /* ctc0: ctc0 $rt,$rd */
2230 static SEM_PC
2231 SEM_FN_NAME (iq2000bf,ctc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2233 #define FLD(f) abuf->fields.fmt_empty.f
2234 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2235 int UNUSED written = 0;
2236 IADDR UNUSED pc = abuf->addr;
2237 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2239 ((void) 0); /*nop*/
2241 return vpc;
2242 #undef FLD
2245 /* ctc1: ctc1 $rt,$rd */
2247 static SEM_PC
2248 SEM_FN_NAME (iq2000bf,ctc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2250 #define FLD(f) abuf->fields.fmt_empty.f
2251 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2252 int UNUSED written = 0;
2253 IADDR UNUSED pc = abuf->addr;
2254 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2256 ((void) 0); /*nop*/
2258 return vpc;
2259 #undef FLD
2262 /* ctc2: ctc2 $rt,$rd */
2264 static SEM_PC
2265 SEM_FN_NAME (iq2000bf,ctc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2267 #define FLD(f) abuf->fields.fmt_empty.f
2268 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2269 int UNUSED written = 0;
2270 IADDR UNUSED pc = abuf->addr;
2271 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2273 ((void) 0); /*nop*/
2275 return vpc;
2276 #undef FLD
2279 /* ctc3: ctc3 $rt,$rd */
2281 static SEM_PC
2282 SEM_FN_NAME (iq2000bf,ctc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2284 #define FLD(f) abuf->fields.fmt_empty.f
2285 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2286 int UNUSED written = 0;
2287 IADDR UNUSED pc = abuf->addr;
2288 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2290 ((void) 0); /*nop*/
2292 return vpc;
2293 #undef FLD
2296 /* jcr: jcr $rs */
2298 static SEM_PC
2299 SEM_FN_NAME (iq2000bf,jcr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2301 #define FLD(f) abuf->fields.fmt_empty.f
2302 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2303 int UNUSED written = 0;
2304 IADDR UNUSED pc = abuf->addr;
2305 SEM_BRANCH_INIT
2306 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2308 ((void) 0); /*nop*/
2310 SEM_BRANCH_FINI (vpc);
2311 return vpc;
2312 #undef FLD
2315 /* luc32: luc32 $rt,$rd */
2317 static SEM_PC
2318 SEM_FN_NAME (iq2000bf,luc32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2320 #define FLD(f) abuf->fields.fmt_empty.f
2321 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2322 int UNUSED written = 0;
2323 IADDR UNUSED pc = abuf->addr;
2324 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2326 ((void) 0); /*nop*/
2328 return vpc;
2329 #undef FLD
2332 /* luc32l: luc32l $rt,$rd */
2334 static SEM_PC
2335 SEM_FN_NAME (iq2000bf,luc32l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2337 #define FLD(f) abuf->fields.fmt_empty.f
2338 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2339 int UNUSED written = 0;
2340 IADDR UNUSED pc = abuf->addr;
2341 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2343 ((void) 0); /*nop*/
2345 return vpc;
2346 #undef FLD
2349 /* luc64: luc64 $rt,$rd */
2351 static SEM_PC
2352 SEM_FN_NAME (iq2000bf,luc64) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2354 #define FLD(f) abuf->fields.fmt_empty.f
2355 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2356 int UNUSED written = 0;
2357 IADDR UNUSED pc = abuf->addr;
2358 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2360 ((void) 0); /*nop*/
2362 return vpc;
2363 #undef FLD
2366 /* luc64l: luc64l $rt,$rd */
2368 static SEM_PC
2369 SEM_FN_NAME (iq2000bf,luc64l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2371 #define FLD(f) abuf->fields.fmt_empty.f
2372 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2373 int UNUSED written = 0;
2374 IADDR UNUSED pc = abuf->addr;
2375 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2377 ((void) 0); /*nop*/
2379 return vpc;
2380 #undef FLD
2383 /* luk: luk $rt,$rd */
2385 static SEM_PC
2386 SEM_FN_NAME (iq2000bf,luk) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2388 #define FLD(f) abuf->fields.fmt_empty.f
2389 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2390 int UNUSED written = 0;
2391 IADDR UNUSED pc = abuf->addr;
2392 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2394 ((void) 0); /*nop*/
2396 return vpc;
2397 #undef FLD
2400 /* lulck: lulck $rt */
2402 static SEM_PC
2403 SEM_FN_NAME (iq2000bf,lulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2405 #define FLD(f) abuf->fields.fmt_empty.f
2406 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2407 int UNUSED written = 0;
2408 IADDR UNUSED pc = abuf->addr;
2409 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2411 ((void) 0); /*nop*/
2413 return vpc;
2414 #undef FLD
2417 /* lum32: lum32 $rt,$rd */
2419 static SEM_PC
2420 SEM_FN_NAME (iq2000bf,lum32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2422 #define FLD(f) abuf->fields.fmt_empty.f
2423 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2424 int UNUSED written = 0;
2425 IADDR UNUSED pc = abuf->addr;
2426 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2428 ((void) 0); /*nop*/
2430 return vpc;
2431 #undef FLD
2434 /* lum32l: lum32l $rt,$rd */
2436 static SEM_PC
2437 SEM_FN_NAME (iq2000bf,lum32l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2439 #define FLD(f) abuf->fields.fmt_empty.f
2440 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2441 int UNUSED written = 0;
2442 IADDR UNUSED pc = abuf->addr;
2443 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2445 ((void) 0); /*nop*/
2447 return vpc;
2448 #undef FLD
2451 /* lum64: lum64 $rt,$rd */
2453 static SEM_PC
2454 SEM_FN_NAME (iq2000bf,lum64) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2456 #define FLD(f) abuf->fields.fmt_empty.f
2457 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2458 int UNUSED written = 0;
2459 IADDR UNUSED pc = abuf->addr;
2460 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2462 ((void) 0); /*nop*/
2464 return vpc;
2465 #undef FLD
2468 /* lum64l: lum64l $rt,$rd */
2470 static SEM_PC
2471 SEM_FN_NAME (iq2000bf,lum64l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2473 #define FLD(f) abuf->fields.fmt_empty.f
2474 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2475 int UNUSED written = 0;
2476 IADDR UNUSED pc = abuf->addr;
2477 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2479 ((void) 0); /*nop*/
2481 return vpc;
2482 #undef FLD
2485 /* lur: lur $rt,$rd */
2487 static SEM_PC
2488 SEM_FN_NAME (iq2000bf,lur) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2490 #define FLD(f) abuf->fields.fmt_empty.f
2491 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2492 int UNUSED written = 0;
2493 IADDR UNUSED pc = abuf->addr;
2494 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2496 ((void) 0); /*nop*/
2498 return vpc;
2499 #undef FLD
2502 /* lurl: lurl $rt,$rd */
2504 static SEM_PC
2505 SEM_FN_NAME (iq2000bf,lurl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2507 #define FLD(f) abuf->fields.fmt_empty.f
2508 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2509 int UNUSED written = 0;
2510 IADDR UNUSED pc = abuf->addr;
2511 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2513 ((void) 0); /*nop*/
2515 return vpc;
2516 #undef FLD
2519 /* luulck: luulck $rt */
2521 static SEM_PC
2522 SEM_FN_NAME (iq2000bf,luulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2524 #define FLD(f) abuf->fields.fmt_empty.f
2525 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2526 int UNUSED written = 0;
2527 IADDR UNUSED pc = abuf->addr;
2528 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2530 ((void) 0); /*nop*/
2532 return vpc;
2533 #undef FLD
2536 /* mfc0: mfc0 $rt,$rd */
2538 static SEM_PC
2539 SEM_FN_NAME (iq2000bf,mfc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2541 #define FLD(f) abuf->fields.fmt_empty.f
2542 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2543 int UNUSED written = 0;
2544 IADDR UNUSED pc = abuf->addr;
2545 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2547 ((void) 0); /*nop*/
2549 return vpc;
2550 #undef FLD
2553 /* mfc1: mfc1 $rt,$rd */
2555 static SEM_PC
2556 SEM_FN_NAME (iq2000bf,mfc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2558 #define FLD(f) abuf->fields.fmt_empty.f
2559 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2560 int UNUSED written = 0;
2561 IADDR UNUSED pc = abuf->addr;
2562 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2564 ((void) 0); /*nop*/
2566 return vpc;
2567 #undef FLD
2570 /* mfc2: mfc2 $rt,$rd */
2572 static SEM_PC
2573 SEM_FN_NAME (iq2000bf,mfc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2575 #define FLD(f) abuf->fields.fmt_empty.f
2576 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2577 int UNUSED written = 0;
2578 IADDR UNUSED pc = abuf->addr;
2579 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2581 ((void) 0); /*nop*/
2583 return vpc;
2584 #undef FLD
2587 /* mfc3: mfc3 $rt,$rd */
2589 static SEM_PC
2590 SEM_FN_NAME (iq2000bf,mfc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2592 #define FLD(f) abuf->fields.fmt_empty.f
2593 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2594 int UNUSED written = 0;
2595 IADDR UNUSED pc = abuf->addr;
2596 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2598 ((void) 0); /*nop*/
2600 return vpc;
2601 #undef FLD
2604 /* mtc0: mtc0 $rt,$rd */
2606 static SEM_PC
2607 SEM_FN_NAME (iq2000bf,mtc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2609 #define FLD(f) abuf->fields.fmt_empty.f
2610 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2611 int UNUSED written = 0;
2612 IADDR UNUSED pc = abuf->addr;
2613 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2615 ((void) 0); /*nop*/
2617 return vpc;
2618 #undef FLD
2621 /* mtc1: mtc1 $rt,$rd */
2623 static SEM_PC
2624 SEM_FN_NAME (iq2000bf,mtc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2626 #define FLD(f) abuf->fields.fmt_empty.f
2627 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2628 int UNUSED written = 0;
2629 IADDR UNUSED pc = abuf->addr;
2630 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2632 ((void) 0); /*nop*/
2634 return vpc;
2635 #undef FLD
2638 /* mtc2: mtc2 $rt,$rd */
2640 static SEM_PC
2641 SEM_FN_NAME (iq2000bf,mtc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2643 #define FLD(f) abuf->fields.fmt_empty.f
2644 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2645 int UNUSED written = 0;
2646 IADDR UNUSED pc = abuf->addr;
2647 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2649 ((void) 0); /*nop*/
2651 return vpc;
2652 #undef FLD
2655 /* mtc3: mtc3 $rt,$rd */
2657 static SEM_PC
2658 SEM_FN_NAME (iq2000bf,mtc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2660 #define FLD(f) abuf->fields.fmt_empty.f
2661 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2662 int UNUSED written = 0;
2663 IADDR UNUSED pc = abuf->addr;
2664 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2666 ((void) 0); /*nop*/
2668 return vpc;
2669 #undef FLD
2672 /* pkrl: pkrl $rd,$rt */
2674 static SEM_PC
2675 SEM_FN_NAME (iq2000bf,pkrl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2677 #define FLD(f) abuf->fields.fmt_empty.f
2678 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2679 int UNUSED written = 0;
2680 IADDR UNUSED pc = abuf->addr;
2681 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2683 ((void) 0); /*nop*/
2685 return vpc;
2686 #undef FLD
2689 /* pkrlr1: pkrlr1 $rt,$index,$count */
2691 static SEM_PC
2692 SEM_FN_NAME (iq2000bf,pkrlr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2694 #define FLD(f) abuf->fields.fmt_empty.f
2695 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2696 int UNUSED written = 0;
2697 IADDR UNUSED pc = abuf->addr;
2698 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2700 ((void) 0); /*nop*/
2702 return vpc;
2703 #undef FLD
2706 /* pkrlr30: pkrlr30 $rt,$index,$count */
2708 static SEM_PC
2709 SEM_FN_NAME (iq2000bf,pkrlr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2711 #define FLD(f) abuf->fields.fmt_empty.f
2712 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2713 int UNUSED written = 0;
2714 IADDR UNUSED pc = abuf->addr;
2715 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2717 ((void) 0); /*nop*/
2719 return vpc;
2720 #undef FLD
2723 /* rb: rb $rd,$rt */
2725 static SEM_PC
2726 SEM_FN_NAME (iq2000bf,rb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2728 #define FLD(f) abuf->fields.fmt_empty.f
2729 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2730 int UNUSED written = 0;
2731 IADDR UNUSED pc = abuf->addr;
2732 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2734 ((void) 0); /*nop*/
2736 return vpc;
2737 #undef FLD
2740 /* rbr1: rbr1 $rt,$index,$count */
2742 static SEM_PC
2743 SEM_FN_NAME (iq2000bf,rbr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2745 #define FLD(f) abuf->fields.fmt_empty.f
2746 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2747 int UNUSED written = 0;
2748 IADDR UNUSED pc = abuf->addr;
2749 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2751 ((void) 0); /*nop*/
2753 return vpc;
2754 #undef FLD
2757 /* rbr30: rbr30 $rt,$index,$count */
2759 static SEM_PC
2760 SEM_FN_NAME (iq2000bf,rbr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2762 #define FLD(f) abuf->fields.fmt_empty.f
2763 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2764 int UNUSED written = 0;
2765 IADDR UNUSED pc = abuf->addr;
2766 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2768 ((void) 0); /*nop*/
2770 return vpc;
2771 #undef FLD
2774 /* rfe: rfe */
2776 static SEM_PC
2777 SEM_FN_NAME (iq2000bf,rfe) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2779 #define FLD(f) abuf->fields.fmt_empty.f
2780 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2781 int UNUSED written = 0;
2782 IADDR UNUSED pc = abuf->addr;
2783 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2785 ((void) 0); /*nop*/
2787 return vpc;
2788 #undef FLD
2791 /* rx: rx $rd,$rt */
2793 static SEM_PC
2794 SEM_FN_NAME (iq2000bf,rx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2796 #define FLD(f) abuf->fields.fmt_empty.f
2797 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2798 int UNUSED written = 0;
2799 IADDR UNUSED pc = abuf->addr;
2800 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2802 ((void) 0); /*nop*/
2804 return vpc;
2805 #undef FLD
2808 /* rxr1: rxr1 $rt,$index,$count */
2810 static SEM_PC
2811 SEM_FN_NAME (iq2000bf,rxr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2813 #define FLD(f) abuf->fields.fmt_empty.f
2814 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2815 int UNUSED written = 0;
2816 IADDR UNUSED pc = abuf->addr;
2817 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2819 ((void) 0); /*nop*/
2821 return vpc;
2822 #undef FLD
2825 /* rxr30: rxr30 $rt,$index,$count */
2827 static SEM_PC
2828 SEM_FN_NAME (iq2000bf,rxr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2830 #define FLD(f) abuf->fields.fmt_empty.f
2831 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2832 int UNUSED written = 0;
2833 IADDR UNUSED pc = abuf->addr;
2834 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2836 ((void) 0); /*nop*/
2838 return vpc;
2839 #undef FLD
2842 /* sleep: sleep */
2844 static SEM_PC
2845 SEM_FN_NAME (iq2000bf,sleep) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2847 #define FLD(f) abuf->fields.fmt_empty.f
2848 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2849 int UNUSED written = 0;
2850 IADDR UNUSED pc = abuf->addr;
2851 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2853 ((void) 0); /*nop*/
2855 return vpc;
2856 #undef FLD
2859 /* srrd: srrd $rt */
2861 static SEM_PC
2862 SEM_FN_NAME (iq2000bf,srrd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2864 #define FLD(f) abuf->fields.fmt_empty.f
2865 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2866 int UNUSED written = 0;
2867 IADDR UNUSED pc = abuf->addr;
2868 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2870 ((void) 0); /*nop*/
2872 return vpc;
2873 #undef FLD
2876 /* srrdl: srrdl $rt */
2878 static SEM_PC
2879 SEM_FN_NAME (iq2000bf,srrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2881 #define FLD(f) abuf->fields.fmt_empty.f
2882 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2883 int UNUSED written = 0;
2884 IADDR UNUSED pc = abuf->addr;
2885 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2887 ((void) 0); /*nop*/
2889 return vpc;
2890 #undef FLD
2893 /* srulck: srulck $rt */
2895 static SEM_PC
2896 SEM_FN_NAME (iq2000bf,srulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2898 #define FLD(f) abuf->fields.fmt_empty.f
2899 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2900 int UNUSED written = 0;
2901 IADDR UNUSED pc = abuf->addr;
2902 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2904 ((void) 0); /*nop*/
2906 return vpc;
2907 #undef FLD
2910 /* srwr: srwr $rt,$rd */
2912 static SEM_PC
2913 SEM_FN_NAME (iq2000bf,srwr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2915 #define FLD(f) abuf->fields.fmt_empty.f
2916 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2917 int UNUSED written = 0;
2918 IADDR UNUSED pc = abuf->addr;
2919 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2921 ((void) 0); /*nop*/
2923 return vpc;
2924 #undef FLD
2927 /* srwru: srwru $rt,$rd */
2929 static SEM_PC
2930 SEM_FN_NAME (iq2000bf,srwru) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2932 #define FLD(f) abuf->fields.fmt_empty.f
2933 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2934 int UNUSED written = 0;
2935 IADDR UNUSED pc = abuf->addr;
2936 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2938 ((void) 0); /*nop*/
2940 return vpc;
2941 #undef FLD
2944 /* trapqfl: trapqfl */
2946 static SEM_PC
2947 SEM_FN_NAME (iq2000bf,trapqfl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2949 #define FLD(f) abuf->fields.fmt_empty.f
2950 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2951 int UNUSED written = 0;
2952 IADDR UNUSED pc = abuf->addr;
2953 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2955 ((void) 0); /*nop*/
2957 return vpc;
2958 #undef FLD
2961 /* trapqne: trapqne */
2963 static SEM_PC
2964 SEM_FN_NAME (iq2000bf,trapqne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2966 #define FLD(f) abuf->fields.fmt_empty.f
2967 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2968 int UNUSED written = 0;
2969 IADDR UNUSED pc = abuf->addr;
2970 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2972 ((void) 0); /*nop*/
2974 return vpc;
2975 #undef FLD
2978 /* traprel: traprel $rt */
2980 static SEM_PC
2981 SEM_FN_NAME (iq2000bf,traprel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2983 #define FLD(f) abuf->fields.fmt_empty.f
2984 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2985 int UNUSED written = 0;
2986 IADDR UNUSED pc = abuf->addr;
2987 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2989 ((void) 0); /*nop*/
2991 return vpc;
2992 #undef FLD
2995 /* wb: wb $rd,$rt */
2997 static SEM_PC
2998 SEM_FN_NAME (iq2000bf,wb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3000 #define FLD(f) abuf->fields.fmt_empty.f
3001 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3002 int UNUSED written = 0;
3003 IADDR UNUSED pc = abuf->addr;
3004 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3006 ((void) 0); /*nop*/
3008 return vpc;
3009 #undef FLD
3012 /* wbu: wbu $rd,$rt */
3014 static SEM_PC
3015 SEM_FN_NAME (iq2000bf,wbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3017 #define FLD(f) abuf->fields.fmt_empty.f
3018 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3019 int UNUSED written = 0;
3020 IADDR UNUSED pc = abuf->addr;
3021 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3023 ((void) 0); /*nop*/
3025 return vpc;
3026 #undef FLD
3029 /* wbr1: wbr1 $rt,$index,$count */
3031 static SEM_PC
3032 SEM_FN_NAME (iq2000bf,wbr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3034 #define FLD(f) abuf->fields.fmt_empty.f
3035 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3036 int UNUSED written = 0;
3037 IADDR UNUSED pc = abuf->addr;
3038 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3040 ((void) 0); /*nop*/
3042 return vpc;
3043 #undef FLD
3046 /* wbr1u: wbr1u $rt,$index,$count */
3048 static SEM_PC
3049 SEM_FN_NAME (iq2000bf,wbr1u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3051 #define FLD(f) abuf->fields.fmt_empty.f
3052 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3053 int UNUSED written = 0;
3054 IADDR UNUSED pc = abuf->addr;
3055 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3057 ((void) 0); /*nop*/
3059 return vpc;
3060 #undef FLD
3063 /* wbr30: wbr30 $rt,$index,$count */
3065 static SEM_PC
3066 SEM_FN_NAME (iq2000bf,wbr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3068 #define FLD(f) abuf->fields.fmt_empty.f
3069 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3070 int UNUSED written = 0;
3071 IADDR UNUSED pc = abuf->addr;
3072 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3074 ((void) 0); /*nop*/
3076 return vpc;
3077 #undef FLD
3080 /* wbr30u: wbr30u $rt,$index,$count */
3082 static SEM_PC
3083 SEM_FN_NAME (iq2000bf,wbr30u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3085 #define FLD(f) abuf->fields.fmt_empty.f
3086 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3087 int UNUSED written = 0;
3088 IADDR UNUSED pc = abuf->addr;
3089 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3091 ((void) 0); /*nop*/
3093 return vpc;
3094 #undef FLD
3097 /* wx: wx $rd,$rt */
3099 static SEM_PC
3100 SEM_FN_NAME (iq2000bf,wx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3102 #define FLD(f) abuf->fields.fmt_empty.f
3103 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3104 int UNUSED written = 0;
3105 IADDR UNUSED pc = abuf->addr;
3106 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3108 ((void) 0); /*nop*/
3110 return vpc;
3111 #undef FLD
3114 /* wxu: wxu $rd,$rt */
3116 static SEM_PC
3117 SEM_FN_NAME (iq2000bf,wxu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3119 #define FLD(f) abuf->fields.fmt_empty.f
3120 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3121 int UNUSED written = 0;
3122 IADDR UNUSED pc = abuf->addr;
3123 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3125 ((void) 0); /*nop*/
3127 return vpc;
3128 #undef FLD
3131 /* wxr1: wxr1 $rt,$index,$count */
3133 static SEM_PC
3134 SEM_FN_NAME (iq2000bf,wxr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3136 #define FLD(f) abuf->fields.fmt_empty.f
3137 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3138 int UNUSED written = 0;
3139 IADDR UNUSED pc = abuf->addr;
3140 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3142 ((void) 0); /*nop*/
3144 return vpc;
3145 #undef FLD
3148 /* wxr1u: wxr1u $rt,$index,$count */
3150 static SEM_PC
3151 SEM_FN_NAME (iq2000bf,wxr1u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3153 #define FLD(f) abuf->fields.fmt_empty.f
3154 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3155 int UNUSED written = 0;
3156 IADDR UNUSED pc = abuf->addr;
3157 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3159 ((void) 0); /*nop*/
3161 return vpc;
3162 #undef FLD
3165 /* wxr30: wxr30 $rt,$index,$count */
3167 static SEM_PC
3168 SEM_FN_NAME (iq2000bf,wxr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3170 #define FLD(f) abuf->fields.fmt_empty.f
3171 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3172 int UNUSED written = 0;
3173 IADDR UNUSED pc = abuf->addr;
3174 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3176 ((void) 0); /*nop*/
3178 return vpc;
3179 #undef FLD
3182 /* wxr30u: wxr30u $rt,$index,$count */
3184 static SEM_PC
3185 SEM_FN_NAME (iq2000bf,wxr30u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3187 #define FLD(f) abuf->fields.fmt_empty.f
3188 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3189 int UNUSED written = 0;
3190 IADDR UNUSED pc = abuf->addr;
3191 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3193 ((void) 0); /*nop*/
3195 return vpc;
3196 #undef FLD
3199 /* ldw: ldw $rt,$lo16($base) */
3201 static SEM_PC
3202 SEM_FN_NAME (iq2000bf,ldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3204 #define FLD(f) abuf->fields.sfmt_addi.f
3205 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3206 int UNUSED written = 0;
3207 IADDR UNUSED pc = abuf->addr;
3208 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3211 SI tmp_addr;
3212 tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3214 SI opval = GETMEMSI (current_cpu, pc, tmp_addr);
3215 SET_H_GR (ADDSI (FLD (f_rt), 1), opval);
3216 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3219 SI opval = GETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4));
3220 SET_H_GR (FLD (f_rt), opval);
3221 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3225 return vpc;
3226 #undef FLD
3229 /* sdw: sdw $rt,$lo16($base) */
3231 static SEM_PC
3232 SEM_FN_NAME (iq2000bf,sdw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3234 #define FLD(f) abuf->fields.sfmt_addi.f
3235 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3236 int UNUSED written = 0;
3237 IADDR UNUSED pc = abuf->addr;
3238 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3241 SI tmp_addr;
3242 tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3244 SI opval = GET_H_GR (FLD (f_rt));
3245 SETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4), opval);
3246 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3249 SI opval = GET_H_GR (ADDSI (FLD (f_rt), 1));
3250 SETMEMSI (current_cpu, pc, tmp_addr, opval);
3251 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3255 return vpc;
3256 #undef FLD
3259 /* j: j $jmptarg */
3261 static SEM_PC
3262 SEM_FN_NAME (iq2000bf,j) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3264 #define FLD(f) abuf->fields.sfmt_j.f
3265 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3266 int UNUSED written = 0;
3267 IADDR UNUSED pc = abuf->addr;
3268 SEM_BRANCH_INIT
3269 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3273 USI opval = FLD (i_jmptarg);
3274 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3275 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3279 SEM_BRANCH_FINI (vpc);
3280 return vpc;
3281 #undef FLD
3284 /* jal: jal $jmptarg */
3286 static SEM_PC
3287 SEM_FN_NAME (iq2000bf,jal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3289 #define FLD(f) abuf->fields.sfmt_j.f
3290 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3291 int UNUSED written = 0;
3292 IADDR UNUSED pc = abuf->addr;
3293 SEM_BRANCH_INIT
3294 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3299 SI opval = ADDSI (pc, 8);
3300 SET_H_GR (((UINT) 31), opval);
3301 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3304 USI opval = FLD (i_jmptarg);
3305 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3306 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3311 SEM_BRANCH_FINI (vpc);
3312 return vpc;
3313 #undef FLD
3316 /* bmb: bmb $rs,$rt,$offset */
3318 static SEM_PC
3319 SEM_FN_NAME (iq2000bf,bmb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3321 #define FLD(f) abuf->fields.sfmt_bbi.f
3322 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3323 int UNUSED written = 0;
3324 IADDR UNUSED pc = abuf->addr;
3325 SEM_BRANCH_INIT
3326 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3329 BI tmp_branch_;
3330 tmp_branch_ = 0;
3331 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
3332 tmp_branch_ = 1;
3334 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
3335 tmp_branch_ = 1;
3337 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
3338 tmp_branch_ = 1;
3340 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
3341 tmp_branch_ = 1;
3343 if (tmp_branch_) {
3346 USI opval = FLD (i_offset);
3347 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3348 written |= (1 << 3);
3349 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3355 abuf->written = written;
3356 SEM_BRANCH_FINI (vpc);
3357 return vpc;
3358 #undef FLD
3361 /* Table of all semantic fns. */
3363 static const struct sem_fn_desc sem_fns[] = {
3364 { IQ2000BF_INSN_X_INVALID, SEM_FN_NAME (iq2000bf,x_invalid) },
3365 { IQ2000BF_INSN_X_AFTER, SEM_FN_NAME (iq2000bf,x_after) },
3366 { IQ2000BF_INSN_X_BEFORE, SEM_FN_NAME (iq2000bf,x_before) },
3367 { IQ2000BF_INSN_X_CTI_CHAIN, SEM_FN_NAME (iq2000bf,x_cti_chain) },
3368 { IQ2000BF_INSN_X_CHAIN, SEM_FN_NAME (iq2000bf,x_chain) },
3369 { IQ2000BF_INSN_X_BEGIN, SEM_FN_NAME (iq2000bf,x_begin) },
3370 { IQ2000BF_INSN_ADD, SEM_FN_NAME (iq2000bf,add) },
3371 { IQ2000BF_INSN_ADDI, SEM_FN_NAME (iq2000bf,addi) },
3372 { IQ2000BF_INSN_ADDIU, SEM_FN_NAME (iq2000bf,addiu) },
3373 { IQ2000BF_INSN_ADDU, SEM_FN_NAME (iq2000bf,addu) },
3374 { IQ2000BF_INSN_ADO16, SEM_FN_NAME (iq2000bf,ado16) },
3375 { IQ2000BF_INSN_AND, SEM_FN_NAME (iq2000bf,and) },
3376 { IQ2000BF_INSN_ANDI, SEM_FN_NAME (iq2000bf,andi) },
3377 { IQ2000BF_INSN_ANDOI, SEM_FN_NAME (iq2000bf,andoi) },
3378 { IQ2000BF_INSN_NOR, SEM_FN_NAME (iq2000bf,nor) },
3379 { IQ2000BF_INSN_OR, SEM_FN_NAME (iq2000bf,or) },
3380 { IQ2000BF_INSN_ORI, SEM_FN_NAME (iq2000bf,ori) },
3381 { IQ2000BF_INSN_RAM, SEM_FN_NAME (iq2000bf,ram) },
3382 { IQ2000BF_INSN_SLL, SEM_FN_NAME (iq2000bf,sll) },
3383 { IQ2000BF_INSN_SLLV, SEM_FN_NAME (iq2000bf,sllv) },
3384 { IQ2000BF_INSN_SLMV, SEM_FN_NAME (iq2000bf,slmv) },
3385 { IQ2000BF_INSN_SLT, SEM_FN_NAME (iq2000bf,slt) },
3386 { IQ2000BF_INSN_SLTI, SEM_FN_NAME (iq2000bf,slti) },
3387 { IQ2000BF_INSN_SLTIU, SEM_FN_NAME (iq2000bf,sltiu) },
3388 { IQ2000BF_INSN_SLTU, SEM_FN_NAME (iq2000bf,sltu) },
3389 { IQ2000BF_INSN_SRA, SEM_FN_NAME (iq2000bf,sra) },
3390 { IQ2000BF_INSN_SRAV, SEM_FN_NAME (iq2000bf,srav) },
3391 { IQ2000BF_INSN_SRL, SEM_FN_NAME (iq2000bf,srl) },
3392 { IQ2000BF_INSN_SRLV, SEM_FN_NAME (iq2000bf,srlv) },
3393 { IQ2000BF_INSN_SRMV, SEM_FN_NAME (iq2000bf,srmv) },
3394 { IQ2000BF_INSN_SUB, SEM_FN_NAME (iq2000bf,sub) },
3395 { IQ2000BF_INSN_SUBU, SEM_FN_NAME (iq2000bf,subu) },
3396 { IQ2000BF_INSN_XOR, SEM_FN_NAME (iq2000bf,xor) },
3397 { IQ2000BF_INSN_XORI, SEM_FN_NAME (iq2000bf,xori) },
3398 { IQ2000BF_INSN_BBI, SEM_FN_NAME (iq2000bf,bbi) },
3399 { IQ2000BF_INSN_BBIN, SEM_FN_NAME (iq2000bf,bbin) },
3400 { IQ2000BF_INSN_BBV, SEM_FN_NAME (iq2000bf,bbv) },
3401 { IQ2000BF_INSN_BBVN, SEM_FN_NAME (iq2000bf,bbvn) },
3402 { IQ2000BF_INSN_BEQ, SEM_FN_NAME (iq2000bf,beq) },
3403 { IQ2000BF_INSN_BEQL, SEM_FN_NAME (iq2000bf,beql) },
3404 { IQ2000BF_INSN_BGEZ, SEM_FN_NAME (iq2000bf,bgez) },
3405 { IQ2000BF_INSN_BGEZAL, SEM_FN_NAME (iq2000bf,bgezal) },
3406 { IQ2000BF_INSN_BGEZALL, SEM_FN_NAME (iq2000bf,bgezall) },
3407 { IQ2000BF_INSN_BGEZL, SEM_FN_NAME (iq2000bf,bgezl) },
3408 { IQ2000BF_INSN_BLTZ, SEM_FN_NAME (iq2000bf,bltz) },
3409 { IQ2000BF_INSN_BLTZL, SEM_FN_NAME (iq2000bf,bltzl) },
3410 { IQ2000BF_INSN_BLTZAL, SEM_FN_NAME (iq2000bf,bltzal) },
3411 { IQ2000BF_INSN_BLTZALL, SEM_FN_NAME (iq2000bf,bltzall) },
3412 { IQ2000BF_INSN_BMB0, SEM_FN_NAME (iq2000bf,bmb0) },
3413 { IQ2000BF_INSN_BMB1, SEM_FN_NAME (iq2000bf,bmb1) },
3414 { IQ2000BF_INSN_BMB2, SEM_FN_NAME (iq2000bf,bmb2) },
3415 { IQ2000BF_INSN_BMB3, SEM_FN_NAME (iq2000bf,bmb3) },
3416 { IQ2000BF_INSN_BNE, SEM_FN_NAME (iq2000bf,bne) },
3417 { IQ2000BF_INSN_BNEL, SEM_FN_NAME (iq2000bf,bnel) },
3418 { IQ2000BF_INSN_JALR, SEM_FN_NAME (iq2000bf,jalr) },
3419 { IQ2000BF_INSN_JR, SEM_FN_NAME (iq2000bf,jr) },
3420 { IQ2000BF_INSN_LB, SEM_FN_NAME (iq2000bf,lb) },
3421 { IQ2000BF_INSN_LBU, SEM_FN_NAME (iq2000bf,lbu) },
3422 { IQ2000BF_INSN_LH, SEM_FN_NAME (iq2000bf,lh) },
3423 { IQ2000BF_INSN_LHU, SEM_FN_NAME (iq2000bf,lhu) },
3424 { IQ2000BF_INSN_LUI, SEM_FN_NAME (iq2000bf,lui) },
3425 { IQ2000BF_INSN_LW, SEM_FN_NAME (iq2000bf,lw) },
3426 { IQ2000BF_INSN_SB, SEM_FN_NAME (iq2000bf,sb) },
3427 { IQ2000BF_INSN_SH, SEM_FN_NAME (iq2000bf,sh) },
3428 { IQ2000BF_INSN_SW, SEM_FN_NAME (iq2000bf,sw) },
3429 { IQ2000BF_INSN_BREAK, SEM_FN_NAME (iq2000bf,break) },
3430 { IQ2000BF_INSN_SYSCALL, SEM_FN_NAME (iq2000bf,syscall) },
3431 { IQ2000BF_INSN_ANDOUI, SEM_FN_NAME (iq2000bf,andoui) },
3432 { IQ2000BF_INSN_ORUI, SEM_FN_NAME (iq2000bf,orui) },
3433 { IQ2000BF_INSN_BGTZ, SEM_FN_NAME (iq2000bf,bgtz) },
3434 { IQ2000BF_INSN_BGTZL, SEM_FN_NAME (iq2000bf,bgtzl) },
3435 { IQ2000BF_INSN_BLEZ, SEM_FN_NAME (iq2000bf,blez) },
3436 { IQ2000BF_INSN_BLEZL, SEM_FN_NAME (iq2000bf,blezl) },
3437 { IQ2000BF_INSN_MRGB, SEM_FN_NAME (iq2000bf,mrgb) },
3438 { IQ2000BF_INSN_BCTXT, SEM_FN_NAME (iq2000bf,bctxt) },
3439 { IQ2000BF_INSN_BC0F, SEM_FN_NAME (iq2000bf,bc0f) },
3440 { IQ2000BF_INSN_BC0FL, SEM_FN_NAME (iq2000bf,bc0fl) },
3441 { IQ2000BF_INSN_BC3F, SEM_FN_NAME (iq2000bf,bc3f) },
3442 { IQ2000BF_INSN_BC3FL, SEM_FN_NAME (iq2000bf,bc3fl) },
3443 { IQ2000BF_INSN_BC0T, SEM_FN_NAME (iq2000bf,bc0t) },
3444 { IQ2000BF_INSN_BC0TL, SEM_FN_NAME (iq2000bf,bc0tl) },
3445 { IQ2000BF_INSN_BC3T, SEM_FN_NAME (iq2000bf,bc3t) },
3446 { IQ2000BF_INSN_BC3TL, SEM_FN_NAME (iq2000bf,bc3tl) },
3447 { IQ2000BF_INSN_CFC0, SEM_FN_NAME (iq2000bf,cfc0) },
3448 { IQ2000BF_INSN_CFC1, SEM_FN_NAME (iq2000bf,cfc1) },
3449 { IQ2000BF_INSN_CFC2, SEM_FN_NAME (iq2000bf,cfc2) },
3450 { IQ2000BF_INSN_CFC3, SEM_FN_NAME (iq2000bf,cfc3) },
3451 { IQ2000BF_INSN_CHKHDR, SEM_FN_NAME (iq2000bf,chkhdr) },
3452 { IQ2000BF_INSN_CTC0, SEM_FN_NAME (iq2000bf,ctc0) },
3453 { IQ2000BF_INSN_CTC1, SEM_FN_NAME (iq2000bf,ctc1) },
3454 { IQ2000BF_INSN_CTC2, SEM_FN_NAME (iq2000bf,ctc2) },
3455 { IQ2000BF_INSN_CTC3, SEM_FN_NAME (iq2000bf,ctc3) },
3456 { IQ2000BF_INSN_JCR, SEM_FN_NAME (iq2000bf,jcr) },
3457 { IQ2000BF_INSN_LUC32, SEM_FN_NAME (iq2000bf,luc32) },
3458 { IQ2000BF_INSN_LUC32L, SEM_FN_NAME (iq2000bf,luc32l) },
3459 { IQ2000BF_INSN_LUC64, SEM_FN_NAME (iq2000bf,luc64) },
3460 { IQ2000BF_INSN_LUC64L, SEM_FN_NAME (iq2000bf,luc64l) },
3461 { IQ2000BF_INSN_LUK, SEM_FN_NAME (iq2000bf,luk) },
3462 { IQ2000BF_INSN_LULCK, SEM_FN_NAME (iq2000bf,lulck) },
3463 { IQ2000BF_INSN_LUM32, SEM_FN_NAME (iq2000bf,lum32) },
3464 { IQ2000BF_INSN_LUM32L, SEM_FN_NAME (iq2000bf,lum32l) },
3465 { IQ2000BF_INSN_LUM64, SEM_FN_NAME (iq2000bf,lum64) },
3466 { IQ2000BF_INSN_LUM64L, SEM_FN_NAME (iq2000bf,lum64l) },
3467 { IQ2000BF_INSN_LUR, SEM_FN_NAME (iq2000bf,lur) },
3468 { IQ2000BF_INSN_LURL, SEM_FN_NAME (iq2000bf,lurl) },
3469 { IQ2000BF_INSN_LUULCK, SEM_FN_NAME (iq2000bf,luulck) },
3470 { IQ2000BF_INSN_MFC0, SEM_FN_NAME (iq2000bf,mfc0) },
3471 { IQ2000BF_INSN_MFC1, SEM_FN_NAME (iq2000bf,mfc1) },
3472 { IQ2000BF_INSN_MFC2, SEM_FN_NAME (iq2000bf,mfc2) },
3473 { IQ2000BF_INSN_MFC3, SEM_FN_NAME (iq2000bf,mfc3) },
3474 { IQ2000BF_INSN_MTC0, SEM_FN_NAME (iq2000bf,mtc0) },
3475 { IQ2000BF_INSN_MTC1, SEM_FN_NAME (iq2000bf,mtc1) },
3476 { IQ2000BF_INSN_MTC2, SEM_FN_NAME (iq2000bf,mtc2) },
3477 { IQ2000BF_INSN_MTC3, SEM_FN_NAME (iq2000bf,mtc3) },
3478 { IQ2000BF_INSN_PKRL, SEM_FN_NAME (iq2000bf,pkrl) },
3479 { IQ2000BF_INSN_PKRLR1, SEM_FN_NAME (iq2000bf,pkrlr1) },
3480 { IQ2000BF_INSN_PKRLR30, SEM_FN_NAME (iq2000bf,pkrlr30) },
3481 { IQ2000BF_INSN_RB, SEM_FN_NAME (iq2000bf,rb) },
3482 { IQ2000BF_INSN_RBR1, SEM_FN_NAME (iq2000bf,rbr1) },
3483 { IQ2000BF_INSN_RBR30, SEM_FN_NAME (iq2000bf,rbr30) },
3484 { IQ2000BF_INSN_RFE, SEM_FN_NAME (iq2000bf,rfe) },
3485 { IQ2000BF_INSN_RX, SEM_FN_NAME (iq2000bf,rx) },
3486 { IQ2000BF_INSN_RXR1, SEM_FN_NAME (iq2000bf,rxr1) },
3487 { IQ2000BF_INSN_RXR30, SEM_FN_NAME (iq2000bf,rxr30) },
3488 { IQ2000BF_INSN_SLEEP, SEM_FN_NAME (iq2000bf,sleep) },
3489 { IQ2000BF_INSN_SRRD, SEM_FN_NAME (iq2000bf,srrd) },
3490 { IQ2000BF_INSN_SRRDL, SEM_FN_NAME (iq2000bf,srrdl) },
3491 { IQ2000BF_INSN_SRULCK, SEM_FN_NAME (iq2000bf,srulck) },
3492 { IQ2000BF_INSN_SRWR, SEM_FN_NAME (iq2000bf,srwr) },
3493 { IQ2000BF_INSN_SRWRU, SEM_FN_NAME (iq2000bf,srwru) },
3494 { IQ2000BF_INSN_TRAPQFL, SEM_FN_NAME (iq2000bf,trapqfl) },
3495 { IQ2000BF_INSN_TRAPQNE, SEM_FN_NAME (iq2000bf,trapqne) },
3496 { IQ2000BF_INSN_TRAPREL, SEM_FN_NAME (iq2000bf,traprel) },
3497 { IQ2000BF_INSN_WB, SEM_FN_NAME (iq2000bf,wb) },
3498 { IQ2000BF_INSN_WBU, SEM_FN_NAME (iq2000bf,wbu) },
3499 { IQ2000BF_INSN_WBR1, SEM_FN_NAME (iq2000bf,wbr1) },
3500 { IQ2000BF_INSN_WBR1U, SEM_FN_NAME (iq2000bf,wbr1u) },
3501 { IQ2000BF_INSN_WBR30, SEM_FN_NAME (iq2000bf,wbr30) },
3502 { IQ2000BF_INSN_WBR30U, SEM_FN_NAME (iq2000bf,wbr30u) },
3503 { IQ2000BF_INSN_WX, SEM_FN_NAME (iq2000bf,wx) },
3504 { IQ2000BF_INSN_WXU, SEM_FN_NAME (iq2000bf,wxu) },
3505 { IQ2000BF_INSN_WXR1, SEM_FN_NAME (iq2000bf,wxr1) },
3506 { IQ2000BF_INSN_WXR1U, SEM_FN_NAME (iq2000bf,wxr1u) },
3507 { IQ2000BF_INSN_WXR30, SEM_FN_NAME (iq2000bf,wxr30) },
3508 { IQ2000BF_INSN_WXR30U, SEM_FN_NAME (iq2000bf,wxr30u) },
3509 { IQ2000BF_INSN_LDW, SEM_FN_NAME (iq2000bf,ldw) },
3510 { IQ2000BF_INSN_SDW, SEM_FN_NAME (iq2000bf,sdw) },
3511 { IQ2000BF_INSN_J, SEM_FN_NAME (iq2000bf,j) },
3512 { IQ2000BF_INSN_JAL, SEM_FN_NAME (iq2000bf,jal) },
3513 { IQ2000BF_INSN_BMB, SEM_FN_NAME (iq2000bf,bmb) },
3514 { 0, 0 }
3517 /* Add the semantic fns to IDESC_TABLE. */
3519 void
3520 SEM_FN_NAME (iq2000bf,init_idesc_table) (SIM_CPU *current_cpu)
3522 IDESC *idesc_table = CPU_IDESC (current_cpu);
3523 const struct sem_fn_desc *sf;
3524 int mach_num = MACH_NUM (CPU_MACH (current_cpu));
3526 for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
3528 const CGEN_INSN *insn = idesc_table[sf->index].idata;
3529 int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
3530 || CGEN_INSN_MACH_HAS_P (insn, mach_num));
3531 #if FAST_P
3532 if (valid_p)
3533 idesc_table[sf->index].sem_fast = sf->fn;
3534 else
3535 idesc_table[sf->index].sem_fast = SEM_FN_NAME (iq2000bf,x_invalid);
3536 #else
3537 if (valid_p)
3538 idesc_table[sf->index].sem_full = sf->fn;
3539 else
3540 idesc_table[sf->index].sem_full = SEM_FN_NAME (iq2000bf,x_invalid);
3541 #endif