gas/
[binutils-gdb.git] / sim / iq2000 / sem.c
blob25c833aee75e27e59ea8777b7a3c4043e717473d
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 3 of the License, or
12 (at your option) 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
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #define WANT_CPU iq2000bf
25 #define WANT_CPU_IQ2000BF
27 #include "sim-main.h"
28 #include "cgen-mem.h"
29 #include "cgen-ops.h"
31 #undef GET_ATTR
32 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
33 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
34 #else
35 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_/**/attr)
36 #endif
38 /* This is used so that we can compile two copies of the semantic code,
39 one with full feature support and one without that runs fast(er).
40 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */
41 #if FAST_P
42 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
43 #undef TRACE_RESULT
44 #define TRACE_RESULT(cpu, abuf, name, type, val)
45 #else
46 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
47 #endif
49 /* x-invalid: --invalid-- */
51 static SEM_PC
52 SEM_FN_NAME (iq2000bf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
54 #define FLD(f) abuf->fields.fmt_empty.f
55 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
56 int UNUSED written = 0;
57 IADDR UNUSED pc = abuf->addr;
58 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
61 /* Update the recorded pc in the cpu state struct.
62 Only necessary for WITH_SCACHE case, but to avoid the
63 conditional compilation .... */
64 SET_H_PC (pc);
65 /* Virtual insns have zero size. Overwrite vpc with address of next insn
66 using the default-insn-bitsize spec. When executing insns in parallel
67 we may want to queue the fault and continue execution. */
68 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
69 vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
72 return vpc;
73 #undef FLD
76 /* x-after: --after-- */
78 static SEM_PC
79 SEM_FN_NAME (iq2000bf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
81 #define FLD(f) abuf->fields.fmt_empty.f
82 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
83 int UNUSED written = 0;
84 IADDR UNUSED pc = abuf->addr;
85 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
88 #if WITH_SCACHE_PBB_IQ2000BF
89 iq2000bf_pbb_after (current_cpu, sem_arg);
90 #endif
93 return vpc;
94 #undef FLD
97 /* x-before: --before-- */
99 static SEM_PC
100 SEM_FN_NAME (iq2000bf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
102 #define FLD(f) abuf->fields.fmt_empty.f
103 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
104 int UNUSED written = 0;
105 IADDR UNUSED pc = abuf->addr;
106 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
109 #if WITH_SCACHE_PBB_IQ2000BF
110 iq2000bf_pbb_before (current_cpu, sem_arg);
111 #endif
114 return vpc;
115 #undef FLD
118 /* x-cti-chain: --cti-chain-- */
120 static SEM_PC
121 SEM_FN_NAME (iq2000bf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
123 #define FLD(f) abuf->fields.fmt_empty.f
124 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
125 int UNUSED written = 0;
126 IADDR UNUSED pc = abuf->addr;
127 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
130 #if WITH_SCACHE_PBB_IQ2000BF
131 #ifdef DEFINE_SWITCH
132 vpc = iq2000bf_pbb_cti_chain (current_cpu, sem_arg,
133 pbb_br_type, pbb_br_npc);
134 BREAK (sem);
135 #else
136 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
137 vpc = iq2000bf_pbb_cti_chain (current_cpu, sem_arg,
138 CPU_PBB_BR_TYPE (current_cpu),
139 CPU_PBB_BR_NPC (current_cpu));
140 #endif
141 #endif
144 return vpc;
145 #undef FLD
148 /* x-chain: --chain-- */
150 static SEM_PC
151 SEM_FN_NAME (iq2000bf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
153 #define FLD(f) abuf->fields.fmt_empty.f
154 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
155 int UNUSED written = 0;
156 IADDR UNUSED pc = abuf->addr;
157 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
160 #if WITH_SCACHE_PBB_IQ2000BF
161 vpc = iq2000bf_pbb_chain (current_cpu, sem_arg);
162 #ifdef DEFINE_SWITCH
163 BREAK (sem);
164 #endif
165 #endif
168 return vpc;
169 #undef FLD
172 /* x-begin: --begin-- */
174 static SEM_PC
175 SEM_FN_NAME (iq2000bf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
177 #define FLD(f) abuf->fields.fmt_empty.f
178 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
179 int UNUSED written = 0;
180 IADDR UNUSED pc = abuf->addr;
181 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
184 #if WITH_SCACHE_PBB_IQ2000BF
185 #if defined DEFINE_SWITCH || defined FAST_P
186 /* In the switch case FAST_P is a constant, allowing several optimizations
187 in any called inline functions. */
188 vpc = iq2000bf_pbb_begin (current_cpu, FAST_P);
189 #else
190 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
191 vpc = iq2000bf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
192 #else
193 vpc = iq2000bf_pbb_begin (current_cpu, 0);
194 #endif
195 #endif
196 #endif
199 return vpc;
200 #undef FLD
203 /* add: add $rd,$rs,$rt */
205 static SEM_PC
206 SEM_FN_NAME (iq2000bf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
208 #define FLD(f) abuf->fields.sfmt_mrgb.f
209 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
210 int UNUSED written = 0;
211 IADDR UNUSED pc = abuf->addr;
212 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
215 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
216 SET_H_GR (FLD (f_rd), opval);
217 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
220 return vpc;
221 #undef FLD
224 /* addi: addi $rt,$rs,$lo16 */
226 static SEM_PC
227 SEM_FN_NAME (iq2000bf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
229 #define FLD(f) abuf->fields.sfmt_addi.f
230 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
231 int UNUSED written = 0;
232 IADDR UNUSED pc = abuf->addr;
233 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
236 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
237 SET_H_GR (FLD (f_rt), opval);
238 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
241 return vpc;
242 #undef FLD
245 /* addiu: addiu $rt,$rs,$lo16 */
247 static SEM_PC
248 SEM_FN_NAME (iq2000bf,addiu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
250 #define FLD(f) abuf->fields.sfmt_addi.f
251 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
252 int UNUSED written = 0;
253 IADDR UNUSED pc = abuf->addr;
254 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
257 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
258 SET_H_GR (FLD (f_rt), opval);
259 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
262 return vpc;
263 #undef FLD
266 /* addu: addu $rd,$rs,$rt */
268 static SEM_PC
269 SEM_FN_NAME (iq2000bf,addu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
271 #define FLD(f) abuf->fields.sfmt_mrgb.f
272 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
273 int UNUSED written = 0;
274 IADDR UNUSED pc = abuf->addr;
275 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
278 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
279 SET_H_GR (FLD (f_rd), opval);
280 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
283 return vpc;
284 #undef FLD
287 /* ado16: ado16 $rd,$rs,$rt */
289 static SEM_PC
290 SEM_FN_NAME (iq2000bf,ado16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
292 #define FLD(f) abuf->fields.sfmt_mrgb.f
293 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
294 int UNUSED written = 0;
295 IADDR UNUSED pc = abuf->addr;
296 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
299 HI tmp_high;
300 HI tmp_low;
301 tmp_low = ADDHI (ANDHI (GET_H_GR (FLD (f_rs)), 65535), ANDHI (GET_H_GR (FLD (f_rt)), 65535));
302 tmp_high = ADDHI (SRLSI (GET_H_GR (FLD (f_rs)), 16), SRLSI (GET_H_GR (FLD (f_rt)), 16));
304 SI opval = ORSI (SLLSI (tmp_high, 16), tmp_low);
305 SET_H_GR (FLD (f_rd), opval);
306 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
310 return vpc;
311 #undef FLD
314 /* and: and $rd,$rs,$rt */
316 static SEM_PC
317 SEM_FN_NAME (iq2000bf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
319 #define FLD(f) abuf->fields.sfmt_mrgb.f
320 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
321 int UNUSED written = 0;
322 IADDR UNUSED pc = abuf->addr;
323 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
326 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
327 SET_H_GR (FLD (f_rd), opval);
328 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
331 return vpc;
332 #undef FLD
335 /* andi: andi $rt,$rs,$lo16 */
337 static SEM_PC
338 SEM_FN_NAME (iq2000bf,andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
340 #define FLD(f) abuf->fields.sfmt_addi.f
341 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
342 int UNUSED written = 0;
343 IADDR UNUSED pc = abuf->addr;
344 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
347 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
348 SET_H_GR (FLD (f_rt), opval);
349 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
352 return vpc;
353 #undef FLD
356 /* andoi: andoi $rt,$rs,$lo16 */
358 static SEM_PC
359 SEM_FN_NAME (iq2000bf,andoi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
361 #define FLD(f) abuf->fields.sfmt_addi.f
362 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
363 int UNUSED written = 0;
364 IADDR UNUSED pc = abuf->addr;
365 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
368 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ORSI (0xffff0000, EXTHISI (TRUNCSIHI (FLD (f_imm)))));
369 SET_H_GR (FLD (f_rt), opval);
370 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
373 return vpc;
374 #undef FLD
377 /* nor: nor $rd,$rs,$rt */
379 static SEM_PC
380 SEM_FN_NAME (iq2000bf,nor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
382 #define FLD(f) abuf->fields.sfmt_mrgb.f
383 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
384 int UNUSED written = 0;
385 IADDR UNUSED pc = abuf->addr;
386 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
389 SI opval = INVSI (ORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt))));
390 SET_H_GR (FLD (f_rd), opval);
391 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
394 return vpc;
395 #undef FLD
398 /* or: or $rd,$rs,$rt */
400 static SEM_PC
401 SEM_FN_NAME (iq2000bf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
403 #define FLD(f) abuf->fields.sfmt_mrgb.f
404 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
405 int UNUSED written = 0;
406 IADDR UNUSED pc = abuf->addr;
407 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
410 SI opval = ORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
411 SET_H_GR (FLD (f_rd), opval);
412 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
415 return vpc;
416 #undef FLD
419 /* ori: ori $rt,$rs,$lo16 */
421 static SEM_PC
422 SEM_FN_NAME (iq2000bf,ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
424 #define FLD(f) abuf->fields.sfmt_addi.f
425 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
426 int UNUSED written = 0;
427 IADDR UNUSED pc = abuf->addr;
428 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
431 SI opval = ORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
432 SET_H_GR (FLD (f_rt), opval);
433 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
436 return vpc;
437 #undef FLD
440 /* ram: ram $rd,$rt,$shamt,$maskl,$maskr */
442 static SEM_PC
443 SEM_FN_NAME (iq2000bf,ram) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
445 #define FLD(f) abuf->fields.sfmt_ram.f
446 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
447 int UNUSED written = 0;
448 IADDR UNUSED pc = abuf->addr;
449 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
453 SI opval = RORSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
454 SET_H_GR (FLD (f_rd), opval);
455 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
458 SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SRLSI (0xffffffff, FLD (f_maskl)));
459 SET_H_GR (FLD (f_rd), opval);
460 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
463 SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SLLSI (0xffffffff, FLD (f_rs)));
464 SET_H_GR (FLD (f_rd), opval);
465 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
469 return vpc;
470 #undef FLD
473 /* sll: sll $rd,$rt,$shamt */
475 static SEM_PC
476 SEM_FN_NAME (iq2000bf,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
478 #define FLD(f) abuf->fields.sfmt_ram.f
479 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
480 int UNUSED written = 0;
481 IADDR UNUSED pc = abuf->addr;
482 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
485 SI opval = SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
486 SET_H_GR (FLD (f_rd), opval);
487 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
490 return vpc;
491 #undef FLD
494 /* sllv: sllv $rd,$rt,$rs */
496 static SEM_PC
497 SEM_FN_NAME (iq2000bf,sllv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
499 #define FLD(f) abuf->fields.sfmt_mrgb.f
500 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
501 int UNUSED written = 0;
502 IADDR UNUSED pc = abuf->addr;
503 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
506 SI opval = SLLSI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
507 SET_H_GR (FLD (f_rd), opval);
508 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
511 return vpc;
512 #undef FLD
515 /* slmv: slmv $rd,$rt,$rs,$shamt */
517 static SEM_PC
518 SEM_FN_NAME (iq2000bf,slmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
520 #define FLD(f) abuf->fields.sfmt_ram.f
521 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
522 int UNUSED written = 0;
523 IADDR UNUSED pc = abuf->addr;
524 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
527 SI opval = ANDSI (SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt)), SRLSI (0xffffffff, GET_H_GR (FLD (f_rs))));
528 SET_H_GR (FLD (f_rd), opval);
529 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
532 return vpc;
533 #undef FLD
536 /* slt: slt $rd,$rs,$rt */
538 static SEM_PC
539 SEM_FN_NAME (iq2000bf,slt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
541 #define FLD(f) abuf->fields.sfmt_mrgb.f
542 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
543 int UNUSED written = 0;
544 IADDR UNUSED pc = abuf->addr;
545 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
547 if (LTSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
549 SI opval = 1;
550 SET_H_GR (FLD (f_rd), opval);
551 written |= (1 << 2);
552 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
554 } else {
556 SI opval = 0;
557 SET_H_GR (FLD (f_rd), opval);
558 written |= (1 << 2);
559 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
563 abuf->written = written;
564 return vpc;
565 #undef FLD
568 /* slti: slti $rt,$rs,$imm */
570 static SEM_PC
571 SEM_FN_NAME (iq2000bf,slti) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
573 #define FLD(f) abuf->fields.sfmt_addi.f
574 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
575 int UNUSED written = 0;
576 IADDR UNUSED pc = abuf->addr;
577 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
579 if (LTSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
581 SI opval = 1;
582 SET_H_GR (FLD (f_rt), opval);
583 written |= (1 << 2);
584 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
586 } else {
588 SI opval = 0;
589 SET_H_GR (FLD (f_rt), opval);
590 written |= (1 << 2);
591 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
595 abuf->written = written;
596 return vpc;
597 #undef FLD
600 /* sltiu: sltiu $rt,$rs,$imm */
602 static SEM_PC
603 SEM_FN_NAME (iq2000bf,sltiu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
605 #define FLD(f) abuf->fields.sfmt_addi.f
606 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
607 int UNUSED written = 0;
608 IADDR UNUSED pc = abuf->addr;
609 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
611 if (LTUSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
613 SI opval = 1;
614 SET_H_GR (FLD (f_rt), opval);
615 written |= (1 << 2);
616 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
618 } else {
620 SI opval = 0;
621 SET_H_GR (FLD (f_rt), opval);
622 written |= (1 << 2);
623 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
627 abuf->written = written;
628 return vpc;
629 #undef FLD
632 /* sltu: sltu $rd,$rs,$rt */
634 static SEM_PC
635 SEM_FN_NAME (iq2000bf,sltu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
637 #define FLD(f) abuf->fields.sfmt_mrgb.f
638 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
639 int UNUSED written = 0;
640 IADDR UNUSED pc = abuf->addr;
641 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
643 if (LTUSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
645 SI opval = 1;
646 SET_H_GR (FLD (f_rd), opval);
647 written |= (1 << 2);
648 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
650 } else {
652 SI opval = 0;
653 SET_H_GR (FLD (f_rd), opval);
654 written |= (1 << 2);
655 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
659 abuf->written = written;
660 return vpc;
661 #undef FLD
664 /* sra: sra $rd,$rt,$shamt */
666 static SEM_PC
667 SEM_FN_NAME (iq2000bf,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
669 #define FLD(f) abuf->fields.sfmt_ram.f
670 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
671 int UNUSED written = 0;
672 IADDR UNUSED pc = abuf->addr;
673 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
676 SI opval = SRASI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
677 SET_H_GR (FLD (f_rd), opval);
678 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
681 return vpc;
682 #undef FLD
685 /* srav: srav $rd,$rt,$rs */
687 static SEM_PC
688 SEM_FN_NAME (iq2000bf,srav) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
690 #define FLD(f) abuf->fields.sfmt_mrgb.f
691 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
692 int UNUSED written = 0;
693 IADDR UNUSED pc = abuf->addr;
694 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
697 SI opval = SRASI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
698 SET_H_GR (FLD (f_rd), opval);
699 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
702 return vpc;
703 #undef FLD
706 /* srl: srl $rd,$rt,$shamt */
708 static SEM_PC
709 SEM_FN_NAME (iq2000bf,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
711 #define FLD(f) abuf->fields.sfmt_ram.f
712 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
713 int UNUSED written = 0;
714 IADDR UNUSED pc = abuf->addr;
715 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
718 SI opval = SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
719 SET_H_GR (FLD (f_rd), opval);
720 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
723 return vpc;
724 #undef FLD
727 /* srlv: srlv $rd,$rt,$rs */
729 static SEM_PC
730 SEM_FN_NAME (iq2000bf,srlv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
732 #define FLD(f) abuf->fields.sfmt_mrgb.f
733 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
734 int UNUSED written = 0;
735 IADDR UNUSED pc = abuf->addr;
736 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
739 SI opval = SRLSI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
740 SET_H_GR (FLD (f_rd), opval);
741 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
744 return vpc;
745 #undef FLD
748 /* srmv: srmv $rd,$rt,$rs,$shamt */
750 static SEM_PC
751 SEM_FN_NAME (iq2000bf,srmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
753 #define FLD(f) abuf->fields.sfmt_ram.f
754 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
755 int UNUSED written = 0;
756 IADDR UNUSED pc = abuf->addr;
757 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
760 SI opval = ANDSI (SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt)), SLLSI (0xffffffff, GET_H_GR (FLD (f_rs))));
761 SET_H_GR (FLD (f_rd), opval);
762 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
765 return vpc;
766 #undef FLD
769 /* sub: sub $rd,$rs,$rt */
771 static SEM_PC
772 SEM_FN_NAME (iq2000bf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
774 #define FLD(f) abuf->fields.sfmt_mrgb.f
775 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
776 int UNUSED written = 0;
777 IADDR UNUSED pc = abuf->addr;
778 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
781 SI opval = SUBSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
782 SET_H_GR (FLD (f_rd), opval);
783 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
786 return vpc;
787 #undef FLD
790 /* subu: subu $rd,$rs,$rt */
792 static SEM_PC
793 SEM_FN_NAME (iq2000bf,subu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
795 #define FLD(f) abuf->fields.sfmt_mrgb.f
796 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
797 int UNUSED written = 0;
798 IADDR UNUSED pc = abuf->addr;
799 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
802 SI opval = SUBSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
803 SET_H_GR (FLD (f_rd), opval);
804 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
807 return vpc;
808 #undef FLD
811 /* xor: xor $rd,$rs,$rt */
813 static SEM_PC
814 SEM_FN_NAME (iq2000bf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
816 #define FLD(f) abuf->fields.sfmt_mrgb.f
817 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
818 int UNUSED written = 0;
819 IADDR UNUSED pc = abuf->addr;
820 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
823 SI opval = XORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
824 SET_H_GR (FLD (f_rd), opval);
825 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
828 return vpc;
829 #undef FLD
832 /* xori: xori $rt,$rs,$lo16 */
834 static SEM_PC
835 SEM_FN_NAME (iq2000bf,xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
837 #define FLD(f) abuf->fields.sfmt_addi.f
838 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
839 int UNUSED written = 0;
840 IADDR UNUSED pc = abuf->addr;
841 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
844 SI opval = XORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
845 SET_H_GR (FLD (f_rt), opval);
846 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
849 return vpc;
850 #undef FLD
853 /* bbi: bbi $rs($bitnum),$offset */
855 static SEM_PC
856 SEM_FN_NAME (iq2000bf,bbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
858 #define FLD(f) abuf->fields.sfmt_bbi.f
859 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
860 int UNUSED written = 0;
861 IADDR UNUSED pc = abuf->addr;
862 SEM_BRANCH_INIT
863 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
865 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt)))) {
868 USI opval = FLD (i_offset);
869 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
870 written |= (1 << 3);
871 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
876 abuf->written = written;
877 SEM_BRANCH_FINI (vpc);
878 return vpc;
879 #undef FLD
882 /* bbin: bbin $rs($bitnum),$offset */
884 static SEM_PC
885 SEM_FN_NAME (iq2000bf,bbin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
887 #define FLD(f) abuf->fields.sfmt_bbi.f
888 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
889 int UNUSED written = 0;
890 IADDR UNUSED pc = abuf->addr;
891 SEM_BRANCH_INIT
892 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
894 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt))))) {
897 USI opval = FLD (i_offset);
898 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
899 written |= (1 << 3);
900 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
905 abuf->written = written;
906 SEM_BRANCH_FINI (vpc);
907 return vpc;
908 #undef FLD
911 /* bbv: bbv $rs,$rt,$offset */
913 static SEM_PC
914 SEM_FN_NAME (iq2000bf,bbv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
916 #define FLD(f) abuf->fields.sfmt_bbi.f
917 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
918 int UNUSED written = 0;
919 IADDR UNUSED pc = abuf->addr;
920 SEM_BRANCH_INIT
921 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
923 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31)))) {
926 USI opval = FLD (i_offset);
927 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
928 written |= (1 << 3);
929 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
934 abuf->written = written;
935 SEM_BRANCH_FINI (vpc);
936 return vpc;
937 #undef FLD
940 /* bbvn: bbvn $rs,$rt,$offset */
942 static SEM_PC
943 SEM_FN_NAME (iq2000bf,bbvn) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
945 #define FLD(f) abuf->fields.sfmt_bbi.f
946 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
947 int UNUSED written = 0;
948 IADDR UNUSED pc = abuf->addr;
949 SEM_BRANCH_INIT
950 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
952 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31))))) {
955 USI opval = FLD (i_offset);
956 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
957 written |= (1 << 3);
958 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
963 abuf->written = written;
964 SEM_BRANCH_FINI (vpc);
965 return vpc;
966 #undef FLD
969 /* beq: beq $rs,$rt,$offset */
971 static SEM_PC
972 SEM_FN_NAME (iq2000bf,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
974 #define FLD(f) abuf->fields.sfmt_bbi.f
975 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
976 int UNUSED written = 0;
977 IADDR UNUSED pc = abuf->addr;
978 SEM_BRANCH_INIT
979 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
981 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
984 USI opval = FLD (i_offset);
985 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
986 written |= (1 << 3);
987 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
992 abuf->written = written;
993 SEM_BRANCH_FINI (vpc);
994 return vpc;
995 #undef FLD
998 /* beql: beql $rs,$rt,$offset */
1000 static SEM_PC
1001 SEM_FN_NAME (iq2000bf,beql) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1003 #define FLD(f) abuf->fields.sfmt_bbi.f
1004 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1005 int UNUSED written = 0;
1006 IADDR UNUSED pc = abuf->addr;
1007 SEM_BRANCH_INIT
1008 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1010 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1013 USI opval = FLD (i_offset);
1014 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1015 written |= (1 << 3);
1016 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1019 } else {
1020 if (1)
1021 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1024 abuf->written = written;
1025 SEM_BRANCH_FINI (vpc);
1026 return vpc;
1027 #undef FLD
1030 /* bgez: bgez $rs,$offset */
1032 static SEM_PC
1033 SEM_FN_NAME (iq2000bf,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1035 #define FLD(f) abuf->fields.sfmt_bbi.f
1036 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1037 int UNUSED written = 0;
1038 IADDR UNUSED pc = abuf->addr;
1039 SEM_BRANCH_INIT
1040 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1042 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1045 USI opval = FLD (i_offset);
1046 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1047 written |= (1 << 2);
1048 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1053 abuf->written = written;
1054 SEM_BRANCH_FINI (vpc);
1055 return vpc;
1056 #undef FLD
1059 /* bgezal: bgezal $rs,$offset */
1061 static SEM_PC
1062 SEM_FN_NAME (iq2000bf,bgezal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1064 #define FLD(f) abuf->fields.sfmt_bbi.f
1065 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1066 int UNUSED written = 0;
1067 IADDR UNUSED pc = abuf->addr;
1068 SEM_BRANCH_INIT
1069 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1071 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1074 SI opval = ADDSI (pc, 8);
1075 SET_H_GR (((UINT) 31), opval);
1076 written |= (1 << 3);
1077 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1081 USI opval = FLD (i_offset);
1082 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1083 written |= (1 << 4);
1084 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1090 abuf->written = written;
1091 SEM_BRANCH_FINI (vpc);
1092 return vpc;
1093 #undef FLD
1096 /* bgezall: bgezall $rs,$offset */
1098 static SEM_PC
1099 SEM_FN_NAME (iq2000bf,bgezall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1101 #define FLD(f) abuf->fields.sfmt_bbi.f
1102 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1103 int UNUSED written = 0;
1104 IADDR UNUSED pc = abuf->addr;
1105 SEM_BRANCH_INIT
1106 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1108 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1111 SI opval = ADDSI (pc, 8);
1112 SET_H_GR (((UINT) 31), opval);
1113 written |= (1 << 3);
1114 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1118 USI opval = FLD (i_offset);
1119 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1120 written |= (1 << 4);
1121 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1125 } else {
1126 if (1)
1127 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1130 abuf->written = written;
1131 SEM_BRANCH_FINI (vpc);
1132 return vpc;
1133 #undef FLD
1136 /* bgezl: bgezl $rs,$offset */
1138 static SEM_PC
1139 SEM_FN_NAME (iq2000bf,bgezl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1141 #define FLD(f) abuf->fields.sfmt_bbi.f
1142 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1143 int UNUSED written = 0;
1144 IADDR UNUSED pc = abuf->addr;
1145 SEM_BRANCH_INIT
1146 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1148 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1151 USI opval = FLD (i_offset);
1152 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1153 written |= (1 << 2);
1154 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1157 } else {
1158 if (1)
1159 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1162 abuf->written = written;
1163 SEM_BRANCH_FINI (vpc);
1164 return vpc;
1165 #undef FLD
1168 /* bltz: bltz $rs,$offset */
1170 static SEM_PC
1171 SEM_FN_NAME (iq2000bf,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1173 #define FLD(f) abuf->fields.sfmt_bbi.f
1174 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1175 int UNUSED written = 0;
1176 IADDR UNUSED pc = abuf->addr;
1177 SEM_BRANCH_INIT
1178 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1180 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1183 USI opval = FLD (i_offset);
1184 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1185 written |= (1 << 2);
1186 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1191 abuf->written = written;
1192 SEM_BRANCH_FINI (vpc);
1193 return vpc;
1194 #undef FLD
1197 /* bltzl: bltzl $rs,$offset */
1199 static SEM_PC
1200 SEM_FN_NAME (iq2000bf,bltzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1202 #define FLD(f) abuf->fields.sfmt_bbi.f
1203 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1204 int UNUSED written = 0;
1205 IADDR UNUSED pc = abuf->addr;
1206 SEM_BRANCH_INIT
1207 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1209 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1212 USI opval = FLD (i_offset);
1213 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1214 written |= (1 << 2);
1215 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1218 } else {
1219 if (1)
1220 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1223 abuf->written = written;
1224 SEM_BRANCH_FINI (vpc);
1225 return vpc;
1226 #undef FLD
1229 /* bltzal: bltzal $rs,$offset */
1231 static SEM_PC
1232 SEM_FN_NAME (iq2000bf,bltzal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1234 #define FLD(f) abuf->fields.sfmt_bbi.f
1235 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1236 int UNUSED written = 0;
1237 IADDR UNUSED pc = abuf->addr;
1238 SEM_BRANCH_INIT
1239 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1241 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1244 SI opval = ADDSI (pc, 8);
1245 SET_H_GR (((UINT) 31), opval);
1246 written |= (1 << 3);
1247 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1251 USI opval = FLD (i_offset);
1252 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1253 written |= (1 << 4);
1254 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1260 abuf->written = written;
1261 SEM_BRANCH_FINI (vpc);
1262 return vpc;
1263 #undef FLD
1266 /* bltzall: bltzall $rs,$offset */
1268 static SEM_PC
1269 SEM_FN_NAME (iq2000bf,bltzall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1271 #define FLD(f) abuf->fields.sfmt_bbi.f
1272 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1273 int UNUSED written = 0;
1274 IADDR UNUSED pc = abuf->addr;
1275 SEM_BRANCH_INIT
1276 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1278 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1281 SI opval = ADDSI (pc, 8);
1282 SET_H_GR (((UINT) 31), opval);
1283 written |= (1 << 3);
1284 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1288 USI opval = FLD (i_offset);
1289 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1290 written |= (1 << 4);
1291 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1295 } else {
1296 if (1)
1297 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1300 abuf->written = written;
1301 SEM_BRANCH_FINI (vpc);
1302 return vpc;
1303 #undef FLD
1306 /* bmb0: bmb0 $rs,$rt,$offset */
1308 static SEM_PC
1309 SEM_FN_NAME (iq2000bf,bmb0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1311 #define FLD(f) abuf->fields.sfmt_bbi.f
1312 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1313 int UNUSED written = 0;
1314 IADDR UNUSED pc = abuf->addr;
1315 SEM_BRANCH_INIT
1316 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1318 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
1321 USI opval = FLD (i_offset);
1322 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1323 written |= (1 << 3);
1324 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1329 abuf->written = written;
1330 SEM_BRANCH_FINI (vpc);
1331 return vpc;
1332 #undef FLD
1335 /* bmb1: bmb1 $rs,$rt,$offset */
1337 static SEM_PC
1338 SEM_FN_NAME (iq2000bf,bmb1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1340 #define FLD(f) abuf->fields.sfmt_bbi.f
1341 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1342 int UNUSED written = 0;
1343 IADDR UNUSED pc = abuf->addr;
1344 SEM_BRANCH_INIT
1345 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1347 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
1350 USI opval = FLD (i_offset);
1351 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1352 written |= (1 << 3);
1353 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1358 abuf->written = written;
1359 SEM_BRANCH_FINI (vpc);
1360 return vpc;
1361 #undef FLD
1364 /* bmb2: bmb2 $rs,$rt,$offset */
1366 static SEM_PC
1367 SEM_FN_NAME (iq2000bf,bmb2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1369 #define FLD(f) abuf->fields.sfmt_bbi.f
1370 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1371 int UNUSED written = 0;
1372 IADDR UNUSED pc = abuf->addr;
1373 SEM_BRANCH_INIT
1374 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1376 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
1379 USI opval = FLD (i_offset);
1380 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1381 written |= (1 << 3);
1382 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1387 abuf->written = written;
1388 SEM_BRANCH_FINI (vpc);
1389 return vpc;
1390 #undef FLD
1393 /* bmb3: bmb3 $rs,$rt,$offset */
1395 static SEM_PC
1396 SEM_FN_NAME (iq2000bf,bmb3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1398 #define FLD(f) abuf->fields.sfmt_bbi.f
1399 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1400 int UNUSED written = 0;
1401 IADDR UNUSED pc = abuf->addr;
1402 SEM_BRANCH_INIT
1403 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1405 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
1408 USI opval = FLD (i_offset);
1409 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1410 written |= (1 << 3);
1411 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1416 abuf->written = written;
1417 SEM_BRANCH_FINI (vpc);
1418 return vpc;
1419 #undef FLD
1422 /* bne: bne $rs,$rt,$offset */
1424 static SEM_PC
1425 SEM_FN_NAME (iq2000bf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1427 #define FLD(f) abuf->fields.sfmt_bbi.f
1428 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1429 int UNUSED written = 0;
1430 IADDR UNUSED pc = abuf->addr;
1431 SEM_BRANCH_INIT
1432 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1434 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1437 USI opval = FLD (i_offset);
1438 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1439 written |= (1 << 3);
1440 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1445 abuf->written = written;
1446 SEM_BRANCH_FINI (vpc);
1447 return vpc;
1448 #undef FLD
1451 /* bnel: bnel $rs,$rt,$offset */
1453 static SEM_PC
1454 SEM_FN_NAME (iq2000bf,bnel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1456 #define FLD(f) abuf->fields.sfmt_bbi.f
1457 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1458 int UNUSED written = 0;
1459 IADDR UNUSED pc = abuf->addr;
1460 SEM_BRANCH_INIT
1461 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1463 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1466 USI opval = FLD (i_offset);
1467 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1468 written |= (1 << 3);
1469 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1472 } else {
1473 if (1)
1474 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1477 abuf->written = written;
1478 SEM_BRANCH_FINI (vpc);
1479 return vpc;
1480 #undef FLD
1483 /* jalr: jalr $rd,$rs */
1485 static SEM_PC
1486 SEM_FN_NAME (iq2000bf,jalr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1488 #define FLD(f) abuf->fields.sfmt_mrgb.f
1489 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1490 int UNUSED written = 0;
1491 IADDR UNUSED pc = abuf->addr;
1492 SEM_BRANCH_INIT
1493 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1498 SI opval = ADDSI (pc, 8);
1499 SET_H_GR (FLD (f_rd), opval);
1500 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1503 USI opval = GET_H_GR (FLD (f_rs));
1504 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1505 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1510 SEM_BRANCH_FINI (vpc);
1511 return vpc;
1512 #undef FLD
1515 /* jr: jr $rs */
1517 static SEM_PC
1518 SEM_FN_NAME (iq2000bf,jr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1520 #define FLD(f) abuf->fields.sfmt_bbi.f
1521 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1522 int UNUSED written = 0;
1523 IADDR UNUSED pc = abuf->addr;
1524 SEM_BRANCH_INIT
1525 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1529 USI opval = GET_H_GR (FLD (f_rs));
1530 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1531 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1535 SEM_BRANCH_FINI (vpc);
1536 return vpc;
1537 #undef FLD
1540 /* lb: lb $rt,$lo16($base) */
1542 static SEM_PC
1543 SEM_FN_NAME (iq2000bf,lb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1545 #define FLD(f) abuf->fields.sfmt_addi.f
1546 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1547 int UNUSED written = 0;
1548 IADDR UNUSED pc = abuf->addr;
1549 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1552 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1553 SET_H_GR (FLD (f_rt), opval);
1554 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1557 return vpc;
1558 #undef FLD
1561 /* lbu: lbu $rt,$lo16($base) */
1563 static SEM_PC
1564 SEM_FN_NAME (iq2000bf,lbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1566 #define FLD(f) abuf->fields.sfmt_addi.f
1567 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1568 int UNUSED written = 0;
1569 IADDR UNUSED pc = abuf->addr;
1570 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1573 SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1574 SET_H_GR (FLD (f_rt), opval);
1575 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1578 return vpc;
1579 #undef FLD
1582 /* lh: lh $rt,$lo16($base) */
1584 static SEM_PC
1585 SEM_FN_NAME (iq2000bf,lh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1587 #define FLD(f) abuf->fields.sfmt_addi.f
1588 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1589 int UNUSED written = 0;
1590 IADDR UNUSED pc = abuf->addr;
1591 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1594 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1595 SET_H_GR (FLD (f_rt), opval);
1596 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1599 return vpc;
1600 #undef FLD
1603 /* lhu: lhu $rt,$lo16($base) */
1605 static SEM_PC
1606 SEM_FN_NAME (iq2000bf,lhu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1608 #define FLD(f) abuf->fields.sfmt_addi.f
1609 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1610 int UNUSED written = 0;
1611 IADDR UNUSED pc = abuf->addr;
1612 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1615 SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1616 SET_H_GR (FLD (f_rt), opval);
1617 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1620 return vpc;
1621 #undef FLD
1624 /* lui: lui $rt,$hi16 */
1626 static SEM_PC
1627 SEM_FN_NAME (iq2000bf,lui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1629 #define FLD(f) abuf->fields.sfmt_addi.f
1630 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1631 int UNUSED written = 0;
1632 IADDR UNUSED pc = abuf->addr;
1633 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1636 SI opval = SLLSI (FLD (f_imm), 16);
1637 SET_H_GR (FLD (f_rt), opval);
1638 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1641 return vpc;
1642 #undef FLD
1645 /* lw: lw $rt,$lo16($base) */
1647 static SEM_PC
1648 SEM_FN_NAME (iq2000bf,lw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1650 #define FLD(f) abuf->fields.sfmt_addi.f
1651 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1652 int UNUSED written = 0;
1653 IADDR UNUSED pc = abuf->addr;
1654 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1657 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))));
1658 SET_H_GR (FLD (f_rt), opval);
1659 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1662 return vpc;
1663 #undef FLD
1666 /* sb: sb $rt,$lo16($base) */
1668 static SEM_PC
1669 SEM_FN_NAME (iq2000bf,sb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1671 #define FLD(f) abuf->fields.sfmt_addi.f
1672 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1673 int UNUSED written = 0;
1674 IADDR UNUSED pc = abuf->addr;
1675 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1678 QI opval = ANDQI (GET_H_GR (FLD (f_rt)), 255);
1679 SETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1680 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1683 return vpc;
1684 #undef FLD
1687 /* sh: sh $rt,$lo16($base) */
1689 static SEM_PC
1690 SEM_FN_NAME (iq2000bf,sh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1692 #define FLD(f) abuf->fields.sfmt_addi.f
1693 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1694 int UNUSED written = 0;
1695 IADDR UNUSED pc = abuf->addr;
1696 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1699 HI opval = ANDHI (GET_H_GR (FLD (f_rt)), 65535);
1700 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1701 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1704 return vpc;
1705 #undef FLD
1708 /* sw: sw $rt,$lo16($base) */
1710 static SEM_PC
1711 SEM_FN_NAME (iq2000bf,sw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1713 #define FLD(f) abuf->fields.sfmt_addi.f
1714 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1715 int UNUSED written = 0;
1716 IADDR UNUSED pc = abuf->addr;
1717 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1720 SI opval = GET_H_GR (FLD (f_rt));
1721 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1722 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1725 return vpc;
1726 #undef FLD
1729 /* break: break */
1731 static SEM_PC
1732 SEM_FN_NAME (iq2000bf,break) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1734 #define FLD(f) abuf->fields.fmt_empty.f
1735 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1736 int UNUSED written = 0;
1737 IADDR UNUSED pc = abuf->addr;
1738 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1740 do_break (current_cpu, pc);
1742 return vpc;
1743 #undef FLD
1746 /* syscall: syscall */
1748 static SEM_PC
1749 SEM_FN_NAME (iq2000bf,syscall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1751 #define FLD(f) abuf->fields.fmt_empty.f
1752 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1753 int UNUSED written = 0;
1754 IADDR UNUSED pc = abuf->addr;
1755 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1757 do_syscall (current_cpu);
1759 return vpc;
1760 #undef FLD
1763 /* andoui: andoui $rt,$rs,$hi16 */
1765 static SEM_PC
1766 SEM_FN_NAME (iq2000bf,andoui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1768 #define FLD(f) abuf->fields.sfmt_addi.f
1769 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1770 int UNUSED written = 0;
1771 IADDR UNUSED pc = abuf->addr;
1772 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1775 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ORSI (SLLSI (FLD (f_imm), 16), 65535));
1776 SET_H_GR (FLD (f_rt), opval);
1777 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1780 return vpc;
1781 #undef FLD
1784 /* orui: orui $rt,$rs,$hi16 */
1786 static SEM_PC
1787 SEM_FN_NAME (iq2000bf,orui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1789 #define FLD(f) abuf->fields.sfmt_addi.f
1790 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1791 int UNUSED written = 0;
1792 IADDR UNUSED pc = abuf->addr;
1793 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1796 SI opval = ORSI (GET_H_GR (FLD (f_rs)), SLLSI (FLD (f_imm), 16));
1797 SET_H_GR (FLD (f_rt), opval);
1798 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1801 return vpc;
1802 #undef FLD
1805 /* bgtz: bgtz $rs,$offset */
1807 static SEM_PC
1808 SEM_FN_NAME (iq2000bf,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1810 #define FLD(f) abuf->fields.sfmt_bbi.f
1811 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1812 int UNUSED written = 0;
1813 IADDR UNUSED pc = abuf->addr;
1814 SEM_BRANCH_INIT
1815 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1817 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1820 USI opval = FLD (i_offset);
1821 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1822 written |= (1 << 2);
1823 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1828 abuf->written = written;
1829 SEM_BRANCH_FINI (vpc);
1830 return vpc;
1831 #undef FLD
1834 /* bgtzl: bgtzl $rs,$offset */
1836 static SEM_PC
1837 SEM_FN_NAME (iq2000bf,bgtzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1839 #define FLD(f) abuf->fields.sfmt_bbi.f
1840 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1841 int UNUSED written = 0;
1842 IADDR UNUSED pc = abuf->addr;
1843 SEM_BRANCH_INIT
1844 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1846 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1849 USI opval = FLD (i_offset);
1850 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1851 written |= (1 << 2);
1852 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1855 } else {
1856 if (1)
1857 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1860 abuf->written = written;
1861 SEM_BRANCH_FINI (vpc);
1862 return vpc;
1863 #undef FLD
1866 /* blez: blez $rs,$offset */
1868 static SEM_PC
1869 SEM_FN_NAME (iq2000bf,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1871 #define FLD(f) abuf->fields.sfmt_bbi.f
1872 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1873 int UNUSED written = 0;
1874 IADDR UNUSED pc = abuf->addr;
1875 SEM_BRANCH_INIT
1876 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1878 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1881 USI opval = FLD (i_offset);
1882 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1883 written |= (1 << 2);
1884 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1889 abuf->written = written;
1890 SEM_BRANCH_FINI (vpc);
1891 return vpc;
1892 #undef FLD
1895 /* blezl: blezl $rs,$offset */
1897 static SEM_PC
1898 SEM_FN_NAME (iq2000bf,blezl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1900 #define FLD(f) abuf->fields.sfmt_bbi.f
1901 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1902 int UNUSED written = 0;
1903 IADDR UNUSED pc = abuf->addr;
1904 SEM_BRANCH_INIT
1905 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1907 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1910 USI opval = FLD (i_offset);
1911 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1912 written |= (1 << 2);
1913 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1916 } else {
1917 if (1)
1918 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1921 abuf->written = written;
1922 SEM_BRANCH_FINI (vpc);
1923 return vpc;
1924 #undef FLD
1927 /* mrgb: mrgb $rd,$rs,$rt,$mask */
1929 static SEM_PC
1930 SEM_FN_NAME (iq2000bf,mrgb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1932 #define FLD(f) abuf->fields.sfmt_mrgb.f
1933 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1934 int UNUSED written = 0;
1935 IADDR UNUSED pc = abuf->addr;
1936 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1939 SI tmp_temp;
1940 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 0)))) {
1941 tmp_temp = ANDSI (GET_H_GR (FLD (f_rs)), 255);
1942 } else {
1943 tmp_temp = ANDSI (GET_H_GR (FLD (f_rt)), 255);
1945 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 1)))) {
1946 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 65280));
1947 } else {
1948 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 65280));
1950 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 2)))) {
1951 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 16711680));
1952 } else {
1953 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 16711680));
1955 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 3)))) {
1956 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000));
1957 } else {
1958 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000));
1961 SI opval = tmp_temp;
1962 SET_H_GR (FLD (f_rd), opval);
1963 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1967 return vpc;
1968 #undef FLD
1971 /* bctxt: bctxt $rs,$offset */
1973 static SEM_PC
1974 SEM_FN_NAME (iq2000bf,bctxt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1976 #define FLD(f) abuf->fields.fmt_empty.f
1977 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1978 int UNUSED written = 0;
1979 IADDR UNUSED pc = abuf->addr;
1980 SEM_BRANCH_INIT
1981 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1983 ((void) 0); /*nop*/
1985 SEM_BRANCH_FINI (vpc);
1986 return vpc;
1987 #undef FLD
1990 /* bc0f: bc0f $offset */
1992 static SEM_PC
1993 SEM_FN_NAME (iq2000bf,bc0f) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1995 #define FLD(f) abuf->fields.fmt_empty.f
1996 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1997 int UNUSED written = 0;
1998 IADDR UNUSED pc = abuf->addr;
1999 SEM_BRANCH_INIT
2000 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2002 ((void) 0); /*nop*/
2004 SEM_BRANCH_FINI (vpc);
2005 return vpc;
2006 #undef FLD
2009 /* bc0fl: bc0fl $offset */
2011 static SEM_PC
2012 SEM_FN_NAME (iq2000bf,bc0fl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2014 #define FLD(f) abuf->fields.fmt_empty.f
2015 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2016 int UNUSED written = 0;
2017 IADDR UNUSED pc = abuf->addr;
2018 SEM_BRANCH_INIT
2019 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2021 ((void) 0); /*nop*/
2023 SEM_BRANCH_FINI (vpc);
2024 return vpc;
2025 #undef FLD
2028 /* bc3f: bc3f $offset */
2030 static SEM_PC
2031 SEM_FN_NAME (iq2000bf,bc3f) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2033 #define FLD(f) abuf->fields.fmt_empty.f
2034 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2035 int UNUSED written = 0;
2036 IADDR UNUSED pc = abuf->addr;
2037 SEM_BRANCH_INIT
2038 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2040 ((void) 0); /*nop*/
2042 SEM_BRANCH_FINI (vpc);
2043 return vpc;
2044 #undef FLD
2047 /* bc3fl: bc3fl $offset */
2049 static SEM_PC
2050 SEM_FN_NAME (iq2000bf,bc3fl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2052 #define FLD(f) abuf->fields.fmt_empty.f
2053 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2054 int UNUSED written = 0;
2055 IADDR UNUSED pc = abuf->addr;
2056 SEM_BRANCH_INIT
2057 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2059 ((void) 0); /*nop*/
2061 SEM_BRANCH_FINI (vpc);
2062 return vpc;
2063 #undef FLD
2066 /* bc0t: bc0t $offset */
2068 static SEM_PC
2069 SEM_FN_NAME (iq2000bf,bc0t) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2071 #define FLD(f) abuf->fields.fmt_empty.f
2072 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2073 int UNUSED written = 0;
2074 IADDR UNUSED pc = abuf->addr;
2075 SEM_BRANCH_INIT
2076 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2078 ((void) 0); /*nop*/
2080 SEM_BRANCH_FINI (vpc);
2081 return vpc;
2082 #undef FLD
2085 /* bc0tl: bc0tl $offset */
2087 static SEM_PC
2088 SEM_FN_NAME (iq2000bf,bc0tl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2090 #define FLD(f) abuf->fields.fmt_empty.f
2091 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2092 int UNUSED written = 0;
2093 IADDR UNUSED pc = abuf->addr;
2094 SEM_BRANCH_INIT
2095 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2097 ((void) 0); /*nop*/
2099 SEM_BRANCH_FINI (vpc);
2100 return vpc;
2101 #undef FLD
2104 /* bc3t: bc3t $offset */
2106 static SEM_PC
2107 SEM_FN_NAME (iq2000bf,bc3t) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2109 #define FLD(f) abuf->fields.fmt_empty.f
2110 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2111 int UNUSED written = 0;
2112 IADDR UNUSED pc = abuf->addr;
2113 SEM_BRANCH_INIT
2114 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2116 ((void) 0); /*nop*/
2118 SEM_BRANCH_FINI (vpc);
2119 return vpc;
2120 #undef FLD
2123 /* bc3tl: bc3tl $offset */
2125 static SEM_PC
2126 SEM_FN_NAME (iq2000bf,bc3tl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2128 #define FLD(f) abuf->fields.fmt_empty.f
2129 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2130 int UNUSED written = 0;
2131 IADDR UNUSED pc = abuf->addr;
2132 SEM_BRANCH_INIT
2133 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2135 ((void) 0); /*nop*/
2137 SEM_BRANCH_FINI (vpc);
2138 return vpc;
2139 #undef FLD
2142 /* cfc0: cfc0 $rt,$rd */
2144 static SEM_PC
2145 SEM_FN_NAME (iq2000bf,cfc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2147 #define FLD(f) abuf->fields.fmt_empty.f
2148 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2149 int UNUSED written = 0;
2150 IADDR UNUSED pc = abuf->addr;
2151 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2153 ((void) 0); /*nop*/
2155 return vpc;
2156 #undef FLD
2159 /* cfc1: cfc1 $rt,$rd */
2161 static SEM_PC
2162 SEM_FN_NAME (iq2000bf,cfc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2164 #define FLD(f) abuf->fields.fmt_empty.f
2165 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2166 int UNUSED written = 0;
2167 IADDR UNUSED pc = abuf->addr;
2168 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2170 ((void) 0); /*nop*/
2172 return vpc;
2173 #undef FLD
2176 /* cfc2: cfc2 $rt,$rd */
2178 static SEM_PC
2179 SEM_FN_NAME (iq2000bf,cfc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2181 #define FLD(f) abuf->fields.fmt_empty.f
2182 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2183 int UNUSED written = 0;
2184 IADDR UNUSED pc = abuf->addr;
2185 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2187 ((void) 0); /*nop*/
2189 return vpc;
2190 #undef FLD
2193 /* cfc3: cfc3 $rt,$rd */
2195 static SEM_PC
2196 SEM_FN_NAME (iq2000bf,cfc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2198 #define FLD(f) abuf->fields.fmt_empty.f
2199 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2200 int UNUSED written = 0;
2201 IADDR UNUSED pc = abuf->addr;
2202 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2204 ((void) 0); /*nop*/
2206 return vpc;
2207 #undef FLD
2210 /* chkhdr: chkhdr $rd,$rt */
2212 static SEM_PC
2213 SEM_FN_NAME (iq2000bf,chkhdr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2215 #define FLD(f) abuf->fields.fmt_empty.f
2216 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2217 int UNUSED written = 0;
2218 IADDR UNUSED pc = abuf->addr;
2219 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2221 ((void) 0); /*nop*/
2223 return vpc;
2224 #undef FLD
2227 /* ctc0: ctc0 $rt,$rd */
2229 static SEM_PC
2230 SEM_FN_NAME (iq2000bf,ctc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2232 #define FLD(f) abuf->fields.fmt_empty.f
2233 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2234 int UNUSED written = 0;
2235 IADDR UNUSED pc = abuf->addr;
2236 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2238 ((void) 0); /*nop*/
2240 return vpc;
2241 #undef FLD
2244 /* ctc1: ctc1 $rt,$rd */
2246 static SEM_PC
2247 SEM_FN_NAME (iq2000bf,ctc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2249 #define FLD(f) abuf->fields.fmt_empty.f
2250 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2251 int UNUSED written = 0;
2252 IADDR UNUSED pc = abuf->addr;
2253 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2255 ((void) 0); /*nop*/
2257 return vpc;
2258 #undef FLD
2261 /* ctc2: ctc2 $rt,$rd */
2263 static SEM_PC
2264 SEM_FN_NAME (iq2000bf,ctc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2266 #define FLD(f) abuf->fields.fmt_empty.f
2267 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2268 int UNUSED written = 0;
2269 IADDR UNUSED pc = abuf->addr;
2270 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2272 ((void) 0); /*nop*/
2274 return vpc;
2275 #undef FLD
2278 /* ctc3: ctc3 $rt,$rd */
2280 static SEM_PC
2281 SEM_FN_NAME (iq2000bf,ctc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2283 #define FLD(f) abuf->fields.fmt_empty.f
2284 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2285 int UNUSED written = 0;
2286 IADDR UNUSED pc = abuf->addr;
2287 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2289 ((void) 0); /*nop*/
2291 return vpc;
2292 #undef FLD
2295 /* jcr: jcr $rs */
2297 static SEM_PC
2298 SEM_FN_NAME (iq2000bf,jcr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2300 #define FLD(f) abuf->fields.fmt_empty.f
2301 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2302 int UNUSED written = 0;
2303 IADDR UNUSED pc = abuf->addr;
2304 SEM_BRANCH_INIT
2305 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2307 ((void) 0); /*nop*/
2309 SEM_BRANCH_FINI (vpc);
2310 return vpc;
2311 #undef FLD
2314 /* luc32: luc32 $rt,$rd */
2316 static SEM_PC
2317 SEM_FN_NAME (iq2000bf,luc32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2319 #define FLD(f) abuf->fields.fmt_empty.f
2320 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2321 int UNUSED written = 0;
2322 IADDR UNUSED pc = abuf->addr;
2323 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2325 ((void) 0); /*nop*/
2327 return vpc;
2328 #undef FLD
2331 /* luc32l: luc32l $rt,$rd */
2333 static SEM_PC
2334 SEM_FN_NAME (iq2000bf,luc32l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2336 #define FLD(f) abuf->fields.fmt_empty.f
2337 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2338 int UNUSED written = 0;
2339 IADDR UNUSED pc = abuf->addr;
2340 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2342 ((void) 0); /*nop*/
2344 return vpc;
2345 #undef FLD
2348 /* luc64: luc64 $rt,$rd */
2350 static SEM_PC
2351 SEM_FN_NAME (iq2000bf,luc64) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2353 #define FLD(f) abuf->fields.fmt_empty.f
2354 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2355 int UNUSED written = 0;
2356 IADDR UNUSED pc = abuf->addr;
2357 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2359 ((void) 0); /*nop*/
2361 return vpc;
2362 #undef FLD
2365 /* luc64l: luc64l $rt,$rd */
2367 static SEM_PC
2368 SEM_FN_NAME (iq2000bf,luc64l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2370 #define FLD(f) abuf->fields.fmt_empty.f
2371 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2372 int UNUSED written = 0;
2373 IADDR UNUSED pc = abuf->addr;
2374 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2376 ((void) 0); /*nop*/
2378 return vpc;
2379 #undef FLD
2382 /* luk: luk $rt,$rd */
2384 static SEM_PC
2385 SEM_FN_NAME (iq2000bf,luk) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2387 #define FLD(f) abuf->fields.fmt_empty.f
2388 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2389 int UNUSED written = 0;
2390 IADDR UNUSED pc = abuf->addr;
2391 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2393 ((void) 0); /*nop*/
2395 return vpc;
2396 #undef FLD
2399 /* lulck: lulck $rt */
2401 static SEM_PC
2402 SEM_FN_NAME (iq2000bf,lulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2404 #define FLD(f) abuf->fields.fmt_empty.f
2405 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2406 int UNUSED written = 0;
2407 IADDR UNUSED pc = abuf->addr;
2408 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2410 ((void) 0); /*nop*/
2412 return vpc;
2413 #undef FLD
2416 /* lum32: lum32 $rt,$rd */
2418 static SEM_PC
2419 SEM_FN_NAME (iq2000bf,lum32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2421 #define FLD(f) abuf->fields.fmt_empty.f
2422 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2423 int UNUSED written = 0;
2424 IADDR UNUSED pc = abuf->addr;
2425 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2427 ((void) 0); /*nop*/
2429 return vpc;
2430 #undef FLD
2433 /* lum32l: lum32l $rt,$rd */
2435 static SEM_PC
2436 SEM_FN_NAME (iq2000bf,lum32l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2438 #define FLD(f) abuf->fields.fmt_empty.f
2439 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2440 int UNUSED written = 0;
2441 IADDR UNUSED pc = abuf->addr;
2442 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2444 ((void) 0); /*nop*/
2446 return vpc;
2447 #undef FLD
2450 /* lum64: lum64 $rt,$rd */
2452 static SEM_PC
2453 SEM_FN_NAME (iq2000bf,lum64) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2455 #define FLD(f) abuf->fields.fmt_empty.f
2456 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2457 int UNUSED written = 0;
2458 IADDR UNUSED pc = abuf->addr;
2459 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2461 ((void) 0); /*nop*/
2463 return vpc;
2464 #undef FLD
2467 /* lum64l: lum64l $rt,$rd */
2469 static SEM_PC
2470 SEM_FN_NAME (iq2000bf,lum64l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2472 #define FLD(f) abuf->fields.fmt_empty.f
2473 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2474 int UNUSED written = 0;
2475 IADDR UNUSED pc = abuf->addr;
2476 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2478 ((void) 0); /*nop*/
2480 return vpc;
2481 #undef FLD
2484 /* lur: lur $rt,$rd */
2486 static SEM_PC
2487 SEM_FN_NAME (iq2000bf,lur) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2489 #define FLD(f) abuf->fields.fmt_empty.f
2490 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2491 int UNUSED written = 0;
2492 IADDR UNUSED pc = abuf->addr;
2493 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2495 ((void) 0); /*nop*/
2497 return vpc;
2498 #undef FLD
2501 /* lurl: lurl $rt,$rd */
2503 static SEM_PC
2504 SEM_FN_NAME (iq2000bf,lurl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2506 #define FLD(f) abuf->fields.fmt_empty.f
2507 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2508 int UNUSED written = 0;
2509 IADDR UNUSED pc = abuf->addr;
2510 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2512 ((void) 0); /*nop*/
2514 return vpc;
2515 #undef FLD
2518 /* luulck: luulck $rt */
2520 static SEM_PC
2521 SEM_FN_NAME (iq2000bf,luulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2523 #define FLD(f) abuf->fields.fmt_empty.f
2524 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2525 int UNUSED written = 0;
2526 IADDR UNUSED pc = abuf->addr;
2527 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2529 ((void) 0); /*nop*/
2531 return vpc;
2532 #undef FLD
2535 /* mfc0: mfc0 $rt,$rd */
2537 static SEM_PC
2538 SEM_FN_NAME (iq2000bf,mfc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2540 #define FLD(f) abuf->fields.fmt_empty.f
2541 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2542 int UNUSED written = 0;
2543 IADDR UNUSED pc = abuf->addr;
2544 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2546 ((void) 0); /*nop*/
2548 return vpc;
2549 #undef FLD
2552 /* mfc1: mfc1 $rt,$rd */
2554 static SEM_PC
2555 SEM_FN_NAME (iq2000bf,mfc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2557 #define FLD(f) abuf->fields.fmt_empty.f
2558 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2559 int UNUSED written = 0;
2560 IADDR UNUSED pc = abuf->addr;
2561 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2563 ((void) 0); /*nop*/
2565 return vpc;
2566 #undef FLD
2569 /* mfc2: mfc2 $rt,$rd */
2571 static SEM_PC
2572 SEM_FN_NAME (iq2000bf,mfc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2574 #define FLD(f) abuf->fields.fmt_empty.f
2575 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2576 int UNUSED written = 0;
2577 IADDR UNUSED pc = abuf->addr;
2578 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2580 ((void) 0); /*nop*/
2582 return vpc;
2583 #undef FLD
2586 /* mfc3: mfc3 $rt,$rd */
2588 static SEM_PC
2589 SEM_FN_NAME (iq2000bf,mfc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2591 #define FLD(f) abuf->fields.fmt_empty.f
2592 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2593 int UNUSED written = 0;
2594 IADDR UNUSED pc = abuf->addr;
2595 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2597 ((void) 0); /*nop*/
2599 return vpc;
2600 #undef FLD
2603 /* mtc0: mtc0 $rt,$rd */
2605 static SEM_PC
2606 SEM_FN_NAME (iq2000bf,mtc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2608 #define FLD(f) abuf->fields.fmt_empty.f
2609 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2610 int UNUSED written = 0;
2611 IADDR UNUSED pc = abuf->addr;
2612 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2614 ((void) 0); /*nop*/
2616 return vpc;
2617 #undef FLD
2620 /* mtc1: mtc1 $rt,$rd */
2622 static SEM_PC
2623 SEM_FN_NAME (iq2000bf,mtc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2625 #define FLD(f) abuf->fields.fmt_empty.f
2626 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2627 int UNUSED written = 0;
2628 IADDR UNUSED pc = abuf->addr;
2629 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2631 ((void) 0); /*nop*/
2633 return vpc;
2634 #undef FLD
2637 /* mtc2: mtc2 $rt,$rd */
2639 static SEM_PC
2640 SEM_FN_NAME (iq2000bf,mtc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2642 #define FLD(f) abuf->fields.fmt_empty.f
2643 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2644 int UNUSED written = 0;
2645 IADDR UNUSED pc = abuf->addr;
2646 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2648 ((void) 0); /*nop*/
2650 return vpc;
2651 #undef FLD
2654 /* mtc3: mtc3 $rt,$rd */
2656 static SEM_PC
2657 SEM_FN_NAME (iq2000bf,mtc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2659 #define FLD(f) abuf->fields.fmt_empty.f
2660 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2661 int UNUSED written = 0;
2662 IADDR UNUSED pc = abuf->addr;
2663 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2665 ((void) 0); /*nop*/
2667 return vpc;
2668 #undef FLD
2671 /* pkrl: pkrl $rd,$rt */
2673 static SEM_PC
2674 SEM_FN_NAME (iq2000bf,pkrl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2676 #define FLD(f) abuf->fields.fmt_empty.f
2677 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2678 int UNUSED written = 0;
2679 IADDR UNUSED pc = abuf->addr;
2680 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2682 ((void) 0); /*nop*/
2684 return vpc;
2685 #undef FLD
2688 /* pkrlr1: pkrlr1 $rt,$index,$count */
2690 static SEM_PC
2691 SEM_FN_NAME (iq2000bf,pkrlr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2693 #define FLD(f) abuf->fields.fmt_empty.f
2694 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2695 int UNUSED written = 0;
2696 IADDR UNUSED pc = abuf->addr;
2697 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2699 ((void) 0); /*nop*/
2701 return vpc;
2702 #undef FLD
2705 /* pkrlr30: pkrlr30 $rt,$index,$count */
2707 static SEM_PC
2708 SEM_FN_NAME (iq2000bf,pkrlr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2710 #define FLD(f) abuf->fields.fmt_empty.f
2711 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2712 int UNUSED written = 0;
2713 IADDR UNUSED pc = abuf->addr;
2714 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2716 ((void) 0); /*nop*/
2718 return vpc;
2719 #undef FLD
2722 /* rb: rb $rd,$rt */
2724 static SEM_PC
2725 SEM_FN_NAME (iq2000bf,rb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2727 #define FLD(f) abuf->fields.fmt_empty.f
2728 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2729 int UNUSED written = 0;
2730 IADDR UNUSED pc = abuf->addr;
2731 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2733 ((void) 0); /*nop*/
2735 return vpc;
2736 #undef FLD
2739 /* rbr1: rbr1 $rt,$index,$count */
2741 static SEM_PC
2742 SEM_FN_NAME (iq2000bf,rbr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2744 #define FLD(f) abuf->fields.fmt_empty.f
2745 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2746 int UNUSED written = 0;
2747 IADDR UNUSED pc = abuf->addr;
2748 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2750 ((void) 0); /*nop*/
2752 return vpc;
2753 #undef FLD
2756 /* rbr30: rbr30 $rt,$index,$count */
2758 static SEM_PC
2759 SEM_FN_NAME (iq2000bf,rbr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2761 #define FLD(f) abuf->fields.fmt_empty.f
2762 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2763 int UNUSED written = 0;
2764 IADDR UNUSED pc = abuf->addr;
2765 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2767 ((void) 0); /*nop*/
2769 return vpc;
2770 #undef FLD
2773 /* rfe: rfe */
2775 static SEM_PC
2776 SEM_FN_NAME (iq2000bf,rfe) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2778 #define FLD(f) abuf->fields.fmt_empty.f
2779 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2780 int UNUSED written = 0;
2781 IADDR UNUSED pc = abuf->addr;
2782 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2784 ((void) 0); /*nop*/
2786 return vpc;
2787 #undef FLD
2790 /* rx: rx $rd,$rt */
2792 static SEM_PC
2793 SEM_FN_NAME (iq2000bf,rx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2795 #define FLD(f) abuf->fields.fmt_empty.f
2796 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2797 int UNUSED written = 0;
2798 IADDR UNUSED pc = abuf->addr;
2799 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2801 ((void) 0); /*nop*/
2803 return vpc;
2804 #undef FLD
2807 /* rxr1: rxr1 $rt,$index,$count */
2809 static SEM_PC
2810 SEM_FN_NAME (iq2000bf,rxr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2812 #define FLD(f) abuf->fields.fmt_empty.f
2813 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2814 int UNUSED written = 0;
2815 IADDR UNUSED pc = abuf->addr;
2816 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2818 ((void) 0); /*nop*/
2820 return vpc;
2821 #undef FLD
2824 /* rxr30: rxr30 $rt,$index,$count */
2826 static SEM_PC
2827 SEM_FN_NAME (iq2000bf,rxr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2829 #define FLD(f) abuf->fields.fmt_empty.f
2830 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2831 int UNUSED written = 0;
2832 IADDR UNUSED pc = abuf->addr;
2833 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2835 ((void) 0); /*nop*/
2837 return vpc;
2838 #undef FLD
2841 /* sleep: sleep */
2843 static SEM_PC
2844 SEM_FN_NAME (iq2000bf,sleep) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2846 #define FLD(f) abuf->fields.fmt_empty.f
2847 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2848 int UNUSED written = 0;
2849 IADDR UNUSED pc = abuf->addr;
2850 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2852 ((void) 0); /*nop*/
2854 return vpc;
2855 #undef FLD
2858 /* srrd: srrd $rt */
2860 static SEM_PC
2861 SEM_FN_NAME (iq2000bf,srrd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2863 #define FLD(f) abuf->fields.fmt_empty.f
2864 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2865 int UNUSED written = 0;
2866 IADDR UNUSED pc = abuf->addr;
2867 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2869 ((void) 0); /*nop*/
2871 return vpc;
2872 #undef FLD
2875 /* srrdl: srrdl $rt */
2877 static SEM_PC
2878 SEM_FN_NAME (iq2000bf,srrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2880 #define FLD(f) abuf->fields.fmt_empty.f
2881 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2882 int UNUSED written = 0;
2883 IADDR UNUSED pc = abuf->addr;
2884 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2886 ((void) 0); /*nop*/
2888 return vpc;
2889 #undef FLD
2892 /* srulck: srulck $rt */
2894 static SEM_PC
2895 SEM_FN_NAME (iq2000bf,srulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2897 #define FLD(f) abuf->fields.fmt_empty.f
2898 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2899 int UNUSED written = 0;
2900 IADDR UNUSED pc = abuf->addr;
2901 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2903 ((void) 0); /*nop*/
2905 return vpc;
2906 #undef FLD
2909 /* srwr: srwr $rt,$rd */
2911 static SEM_PC
2912 SEM_FN_NAME (iq2000bf,srwr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2914 #define FLD(f) abuf->fields.fmt_empty.f
2915 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2916 int UNUSED written = 0;
2917 IADDR UNUSED pc = abuf->addr;
2918 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2920 ((void) 0); /*nop*/
2922 return vpc;
2923 #undef FLD
2926 /* srwru: srwru $rt,$rd */
2928 static SEM_PC
2929 SEM_FN_NAME (iq2000bf,srwru) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2931 #define FLD(f) abuf->fields.fmt_empty.f
2932 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2933 int UNUSED written = 0;
2934 IADDR UNUSED pc = abuf->addr;
2935 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2937 ((void) 0); /*nop*/
2939 return vpc;
2940 #undef FLD
2943 /* trapqfl: trapqfl */
2945 static SEM_PC
2946 SEM_FN_NAME (iq2000bf,trapqfl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2948 #define FLD(f) abuf->fields.fmt_empty.f
2949 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2950 int UNUSED written = 0;
2951 IADDR UNUSED pc = abuf->addr;
2952 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2954 ((void) 0); /*nop*/
2956 return vpc;
2957 #undef FLD
2960 /* trapqne: trapqne */
2962 static SEM_PC
2963 SEM_FN_NAME (iq2000bf,trapqne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2965 #define FLD(f) abuf->fields.fmt_empty.f
2966 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2967 int UNUSED written = 0;
2968 IADDR UNUSED pc = abuf->addr;
2969 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2971 ((void) 0); /*nop*/
2973 return vpc;
2974 #undef FLD
2977 /* traprel: traprel $rt */
2979 static SEM_PC
2980 SEM_FN_NAME (iq2000bf,traprel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2982 #define FLD(f) abuf->fields.fmt_empty.f
2983 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2984 int UNUSED written = 0;
2985 IADDR UNUSED pc = abuf->addr;
2986 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2988 ((void) 0); /*nop*/
2990 return vpc;
2991 #undef FLD
2994 /* wb: wb $rd,$rt */
2996 static SEM_PC
2997 SEM_FN_NAME (iq2000bf,wb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2999 #define FLD(f) abuf->fields.fmt_empty.f
3000 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3001 int UNUSED written = 0;
3002 IADDR UNUSED pc = abuf->addr;
3003 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3005 ((void) 0); /*nop*/
3007 return vpc;
3008 #undef FLD
3011 /* wbu: wbu $rd,$rt */
3013 static SEM_PC
3014 SEM_FN_NAME (iq2000bf,wbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3016 #define FLD(f) abuf->fields.fmt_empty.f
3017 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3018 int UNUSED written = 0;
3019 IADDR UNUSED pc = abuf->addr;
3020 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3022 ((void) 0); /*nop*/
3024 return vpc;
3025 #undef FLD
3028 /* wbr1: wbr1 $rt,$index,$count */
3030 static SEM_PC
3031 SEM_FN_NAME (iq2000bf,wbr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3033 #define FLD(f) abuf->fields.fmt_empty.f
3034 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3035 int UNUSED written = 0;
3036 IADDR UNUSED pc = abuf->addr;
3037 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3039 ((void) 0); /*nop*/
3041 return vpc;
3042 #undef FLD
3045 /* wbr1u: wbr1u $rt,$index,$count */
3047 static SEM_PC
3048 SEM_FN_NAME (iq2000bf,wbr1u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3050 #define FLD(f) abuf->fields.fmt_empty.f
3051 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3052 int UNUSED written = 0;
3053 IADDR UNUSED pc = abuf->addr;
3054 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3056 ((void) 0); /*nop*/
3058 return vpc;
3059 #undef FLD
3062 /* wbr30: wbr30 $rt,$index,$count */
3064 static SEM_PC
3065 SEM_FN_NAME (iq2000bf,wbr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3067 #define FLD(f) abuf->fields.fmt_empty.f
3068 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3069 int UNUSED written = 0;
3070 IADDR UNUSED pc = abuf->addr;
3071 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3073 ((void) 0); /*nop*/
3075 return vpc;
3076 #undef FLD
3079 /* wbr30u: wbr30u $rt,$index,$count */
3081 static SEM_PC
3082 SEM_FN_NAME (iq2000bf,wbr30u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3084 #define FLD(f) abuf->fields.fmt_empty.f
3085 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3086 int UNUSED written = 0;
3087 IADDR UNUSED pc = abuf->addr;
3088 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3090 ((void) 0); /*nop*/
3092 return vpc;
3093 #undef FLD
3096 /* wx: wx $rd,$rt */
3098 static SEM_PC
3099 SEM_FN_NAME (iq2000bf,wx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3101 #define FLD(f) abuf->fields.fmt_empty.f
3102 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3103 int UNUSED written = 0;
3104 IADDR UNUSED pc = abuf->addr;
3105 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3107 ((void) 0); /*nop*/
3109 return vpc;
3110 #undef FLD
3113 /* wxu: wxu $rd,$rt */
3115 static SEM_PC
3116 SEM_FN_NAME (iq2000bf,wxu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3118 #define FLD(f) abuf->fields.fmt_empty.f
3119 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3120 int UNUSED written = 0;
3121 IADDR UNUSED pc = abuf->addr;
3122 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3124 ((void) 0); /*nop*/
3126 return vpc;
3127 #undef FLD
3130 /* wxr1: wxr1 $rt,$index,$count */
3132 static SEM_PC
3133 SEM_FN_NAME (iq2000bf,wxr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3135 #define FLD(f) abuf->fields.fmt_empty.f
3136 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3137 int UNUSED written = 0;
3138 IADDR UNUSED pc = abuf->addr;
3139 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3141 ((void) 0); /*nop*/
3143 return vpc;
3144 #undef FLD
3147 /* wxr1u: wxr1u $rt,$index,$count */
3149 static SEM_PC
3150 SEM_FN_NAME (iq2000bf,wxr1u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3152 #define FLD(f) abuf->fields.fmt_empty.f
3153 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3154 int UNUSED written = 0;
3155 IADDR UNUSED pc = abuf->addr;
3156 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3158 ((void) 0); /*nop*/
3160 return vpc;
3161 #undef FLD
3164 /* wxr30: wxr30 $rt,$index,$count */
3166 static SEM_PC
3167 SEM_FN_NAME (iq2000bf,wxr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3169 #define FLD(f) abuf->fields.fmt_empty.f
3170 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3171 int UNUSED written = 0;
3172 IADDR UNUSED pc = abuf->addr;
3173 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3175 ((void) 0); /*nop*/
3177 return vpc;
3178 #undef FLD
3181 /* wxr30u: wxr30u $rt,$index,$count */
3183 static SEM_PC
3184 SEM_FN_NAME (iq2000bf,wxr30u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3186 #define FLD(f) abuf->fields.fmt_empty.f
3187 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3188 int UNUSED written = 0;
3189 IADDR UNUSED pc = abuf->addr;
3190 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3192 ((void) 0); /*nop*/
3194 return vpc;
3195 #undef FLD
3198 /* ldw: ldw $rt,$lo16($base) */
3200 static SEM_PC
3201 SEM_FN_NAME (iq2000bf,ldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3203 #define FLD(f) abuf->fields.sfmt_addi.f
3204 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3205 int UNUSED written = 0;
3206 IADDR UNUSED pc = abuf->addr;
3207 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3210 SI tmp_addr;
3211 tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3213 SI opval = GETMEMSI (current_cpu, pc, tmp_addr);
3214 SET_H_GR (ADDSI (FLD (f_rt), 1), opval);
3215 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3218 SI opval = GETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4));
3219 SET_H_GR (FLD (f_rt), opval);
3220 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3224 return vpc;
3225 #undef FLD
3228 /* sdw: sdw $rt,$lo16($base) */
3230 static SEM_PC
3231 SEM_FN_NAME (iq2000bf,sdw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3233 #define FLD(f) abuf->fields.sfmt_addi.f
3234 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3235 int UNUSED written = 0;
3236 IADDR UNUSED pc = abuf->addr;
3237 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3240 SI tmp_addr;
3241 tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3243 SI opval = GET_H_GR (FLD (f_rt));
3244 SETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4), opval);
3245 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3248 SI opval = GET_H_GR (ADDSI (FLD (f_rt), 1));
3249 SETMEMSI (current_cpu, pc, tmp_addr, opval);
3250 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3254 return vpc;
3255 #undef FLD
3258 /* j: j $jmptarg */
3260 static SEM_PC
3261 SEM_FN_NAME (iq2000bf,j) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3263 #define FLD(f) abuf->fields.sfmt_j.f
3264 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3265 int UNUSED written = 0;
3266 IADDR UNUSED pc = abuf->addr;
3267 SEM_BRANCH_INIT
3268 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3272 USI opval = FLD (i_jmptarg);
3273 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3274 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3278 SEM_BRANCH_FINI (vpc);
3279 return vpc;
3280 #undef FLD
3283 /* jal: jal $jmptarg */
3285 static SEM_PC
3286 SEM_FN_NAME (iq2000bf,jal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3288 #define FLD(f) abuf->fields.sfmt_j.f
3289 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3290 int UNUSED written = 0;
3291 IADDR UNUSED pc = abuf->addr;
3292 SEM_BRANCH_INIT
3293 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3298 SI opval = ADDSI (pc, 8);
3299 SET_H_GR (((UINT) 31), opval);
3300 TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3303 USI opval = FLD (i_jmptarg);
3304 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3305 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3310 SEM_BRANCH_FINI (vpc);
3311 return vpc;
3312 #undef FLD
3315 /* bmb: bmb $rs,$rt,$offset */
3317 static SEM_PC
3318 SEM_FN_NAME (iq2000bf,bmb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3320 #define FLD(f) abuf->fields.sfmt_bbi.f
3321 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3322 int UNUSED written = 0;
3323 IADDR UNUSED pc = abuf->addr;
3324 SEM_BRANCH_INIT
3325 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3328 BI tmp_branch_;
3329 tmp_branch_ = 0;
3330 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
3331 tmp_branch_ = 1;
3333 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
3334 tmp_branch_ = 1;
3336 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
3337 tmp_branch_ = 1;
3339 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
3340 tmp_branch_ = 1;
3342 if (tmp_branch_) {
3345 USI opval = FLD (i_offset);
3346 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3347 written |= (1 << 3);
3348 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3354 abuf->written = written;
3355 SEM_BRANCH_FINI (vpc);
3356 return vpc;
3357 #undef FLD
3360 /* Table of all semantic fns. */
3362 static const struct sem_fn_desc sem_fns[] = {
3363 { IQ2000BF_INSN_X_INVALID, SEM_FN_NAME (iq2000bf,x_invalid) },
3364 { IQ2000BF_INSN_X_AFTER, SEM_FN_NAME (iq2000bf,x_after) },
3365 { IQ2000BF_INSN_X_BEFORE, SEM_FN_NAME (iq2000bf,x_before) },
3366 { IQ2000BF_INSN_X_CTI_CHAIN, SEM_FN_NAME (iq2000bf,x_cti_chain) },
3367 { IQ2000BF_INSN_X_CHAIN, SEM_FN_NAME (iq2000bf,x_chain) },
3368 { IQ2000BF_INSN_X_BEGIN, SEM_FN_NAME (iq2000bf,x_begin) },
3369 { IQ2000BF_INSN_ADD, SEM_FN_NAME (iq2000bf,add) },
3370 { IQ2000BF_INSN_ADDI, SEM_FN_NAME (iq2000bf,addi) },
3371 { IQ2000BF_INSN_ADDIU, SEM_FN_NAME (iq2000bf,addiu) },
3372 { IQ2000BF_INSN_ADDU, SEM_FN_NAME (iq2000bf,addu) },
3373 { IQ2000BF_INSN_ADO16, SEM_FN_NAME (iq2000bf,ado16) },
3374 { IQ2000BF_INSN_AND, SEM_FN_NAME (iq2000bf,and) },
3375 { IQ2000BF_INSN_ANDI, SEM_FN_NAME (iq2000bf,andi) },
3376 { IQ2000BF_INSN_ANDOI, SEM_FN_NAME (iq2000bf,andoi) },
3377 { IQ2000BF_INSN_NOR, SEM_FN_NAME (iq2000bf,nor) },
3378 { IQ2000BF_INSN_OR, SEM_FN_NAME (iq2000bf,or) },
3379 { IQ2000BF_INSN_ORI, SEM_FN_NAME (iq2000bf,ori) },
3380 { IQ2000BF_INSN_RAM, SEM_FN_NAME (iq2000bf,ram) },
3381 { IQ2000BF_INSN_SLL, SEM_FN_NAME (iq2000bf,sll) },
3382 { IQ2000BF_INSN_SLLV, SEM_FN_NAME (iq2000bf,sllv) },
3383 { IQ2000BF_INSN_SLMV, SEM_FN_NAME (iq2000bf,slmv) },
3384 { IQ2000BF_INSN_SLT, SEM_FN_NAME (iq2000bf,slt) },
3385 { IQ2000BF_INSN_SLTI, SEM_FN_NAME (iq2000bf,slti) },
3386 { IQ2000BF_INSN_SLTIU, SEM_FN_NAME (iq2000bf,sltiu) },
3387 { IQ2000BF_INSN_SLTU, SEM_FN_NAME (iq2000bf,sltu) },
3388 { IQ2000BF_INSN_SRA, SEM_FN_NAME (iq2000bf,sra) },
3389 { IQ2000BF_INSN_SRAV, SEM_FN_NAME (iq2000bf,srav) },
3390 { IQ2000BF_INSN_SRL, SEM_FN_NAME (iq2000bf,srl) },
3391 { IQ2000BF_INSN_SRLV, SEM_FN_NAME (iq2000bf,srlv) },
3392 { IQ2000BF_INSN_SRMV, SEM_FN_NAME (iq2000bf,srmv) },
3393 { IQ2000BF_INSN_SUB, SEM_FN_NAME (iq2000bf,sub) },
3394 { IQ2000BF_INSN_SUBU, SEM_FN_NAME (iq2000bf,subu) },
3395 { IQ2000BF_INSN_XOR, SEM_FN_NAME (iq2000bf,xor) },
3396 { IQ2000BF_INSN_XORI, SEM_FN_NAME (iq2000bf,xori) },
3397 { IQ2000BF_INSN_BBI, SEM_FN_NAME (iq2000bf,bbi) },
3398 { IQ2000BF_INSN_BBIN, SEM_FN_NAME (iq2000bf,bbin) },
3399 { IQ2000BF_INSN_BBV, SEM_FN_NAME (iq2000bf,bbv) },
3400 { IQ2000BF_INSN_BBVN, SEM_FN_NAME (iq2000bf,bbvn) },
3401 { IQ2000BF_INSN_BEQ, SEM_FN_NAME (iq2000bf,beq) },
3402 { IQ2000BF_INSN_BEQL, SEM_FN_NAME (iq2000bf,beql) },
3403 { IQ2000BF_INSN_BGEZ, SEM_FN_NAME (iq2000bf,bgez) },
3404 { IQ2000BF_INSN_BGEZAL, SEM_FN_NAME (iq2000bf,bgezal) },
3405 { IQ2000BF_INSN_BGEZALL, SEM_FN_NAME (iq2000bf,bgezall) },
3406 { IQ2000BF_INSN_BGEZL, SEM_FN_NAME (iq2000bf,bgezl) },
3407 { IQ2000BF_INSN_BLTZ, SEM_FN_NAME (iq2000bf,bltz) },
3408 { IQ2000BF_INSN_BLTZL, SEM_FN_NAME (iq2000bf,bltzl) },
3409 { IQ2000BF_INSN_BLTZAL, SEM_FN_NAME (iq2000bf,bltzal) },
3410 { IQ2000BF_INSN_BLTZALL, SEM_FN_NAME (iq2000bf,bltzall) },
3411 { IQ2000BF_INSN_BMB0, SEM_FN_NAME (iq2000bf,bmb0) },
3412 { IQ2000BF_INSN_BMB1, SEM_FN_NAME (iq2000bf,bmb1) },
3413 { IQ2000BF_INSN_BMB2, SEM_FN_NAME (iq2000bf,bmb2) },
3414 { IQ2000BF_INSN_BMB3, SEM_FN_NAME (iq2000bf,bmb3) },
3415 { IQ2000BF_INSN_BNE, SEM_FN_NAME (iq2000bf,bne) },
3416 { IQ2000BF_INSN_BNEL, SEM_FN_NAME (iq2000bf,bnel) },
3417 { IQ2000BF_INSN_JALR, SEM_FN_NAME (iq2000bf,jalr) },
3418 { IQ2000BF_INSN_JR, SEM_FN_NAME (iq2000bf,jr) },
3419 { IQ2000BF_INSN_LB, SEM_FN_NAME (iq2000bf,lb) },
3420 { IQ2000BF_INSN_LBU, SEM_FN_NAME (iq2000bf,lbu) },
3421 { IQ2000BF_INSN_LH, SEM_FN_NAME (iq2000bf,lh) },
3422 { IQ2000BF_INSN_LHU, SEM_FN_NAME (iq2000bf,lhu) },
3423 { IQ2000BF_INSN_LUI, SEM_FN_NAME (iq2000bf,lui) },
3424 { IQ2000BF_INSN_LW, SEM_FN_NAME (iq2000bf,lw) },
3425 { IQ2000BF_INSN_SB, SEM_FN_NAME (iq2000bf,sb) },
3426 { IQ2000BF_INSN_SH, SEM_FN_NAME (iq2000bf,sh) },
3427 { IQ2000BF_INSN_SW, SEM_FN_NAME (iq2000bf,sw) },
3428 { IQ2000BF_INSN_BREAK, SEM_FN_NAME (iq2000bf,break) },
3429 { IQ2000BF_INSN_SYSCALL, SEM_FN_NAME (iq2000bf,syscall) },
3430 { IQ2000BF_INSN_ANDOUI, SEM_FN_NAME (iq2000bf,andoui) },
3431 { IQ2000BF_INSN_ORUI, SEM_FN_NAME (iq2000bf,orui) },
3432 { IQ2000BF_INSN_BGTZ, SEM_FN_NAME (iq2000bf,bgtz) },
3433 { IQ2000BF_INSN_BGTZL, SEM_FN_NAME (iq2000bf,bgtzl) },
3434 { IQ2000BF_INSN_BLEZ, SEM_FN_NAME (iq2000bf,blez) },
3435 { IQ2000BF_INSN_BLEZL, SEM_FN_NAME (iq2000bf,blezl) },
3436 { IQ2000BF_INSN_MRGB, SEM_FN_NAME (iq2000bf,mrgb) },
3437 { IQ2000BF_INSN_BCTXT, SEM_FN_NAME (iq2000bf,bctxt) },
3438 { IQ2000BF_INSN_BC0F, SEM_FN_NAME (iq2000bf,bc0f) },
3439 { IQ2000BF_INSN_BC0FL, SEM_FN_NAME (iq2000bf,bc0fl) },
3440 { IQ2000BF_INSN_BC3F, SEM_FN_NAME (iq2000bf,bc3f) },
3441 { IQ2000BF_INSN_BC3FL, SEM_FN_NAME (iq2000bf,bc3fl) },
3442 { IQ2000BF_INSN_BC0T, SEM_FN_NAME (iq2000bf,bc0t) },
3443 { IQ2000BF_INSN_BC0TL, SEM_FN_NAME (iq2000bf,bc0tl) },
3444 { IQ2000BF_INSN_BC3T, SEM_FN_NAME (iq2000bf,bc3t) },
3445 { IQ2000BF_INSN_BC3TL, SEM_FN_NAME (iq2000bf,bc3tl) },
3446 { IQ2000BF_INSN_CFC0, SEM_FN_NAME (iq2000bf,cfc0) },
3447 { IQ2000BF_INSN_CFC1, SEM_FN_NAME (iq2000bf,cfc1) },
3448 { IQ2000BF_INSN_CFC2, SEM_FN_NAME (iq2000bf,cfc2) },
3449 { IQ2000BF_INSN_CFC3, SEM_FN_NAME (iq2000bf,cfc3) },
3450 { IQ2000BF_INSN_CHKHDR, SEM_FN_NAME (iq2000bf,chkhdr) },
3451 { IQ2000BF_INSN_CTC0, SEM_FN_NAME (iq2000bf,ctc0) },
3452 { IQ2000BF_INSN_CTC1, SEM_FN_NAME (iq2000bf,ctc1) },
3453 { IQ2000BF_INSN_CTC2, SEM_FN_NAME (iq2000bf,ctc2) },
3454 { IQ2000BF_INSN_CTC3, SEM_FN_NAME (iq2000bf,ctc3) },
3455 { IQ2000BF_INSN_JCR, SEM_FN_NAME (iq2000bf,jcr) },
3456 { IQ2000BF_INSN_LUC32, SEM_FN_NAME (iq2000bf,luc32) },
3457 { IQ2000BF_INSN_LUC32L, SEM_FN_NAME (iq2000bf,luc32l) },
3458 { IQ2000BF_INSN_LUC64, SEM_FN_NAME (iq2000bf,luc64) },
3459 { IQ2000BF_INSN_LUC64L, SEM_FN_NAME (iq2000bf,luc64l) },
3460 { IQ2000BF_INSN_LUK, SEM_FN_NAME (iq2000bf,luk) },
3461 { IQ2000BF_INSN_LULCK, SEM_FN_NAME (iq2000bf,lulck) },
3462 { IQ2000BF_INSN_LUM32, SEM_FN_NAME (iq2000bf,lum32) },
3463 { IQ2000BF_INSN_LUM32L, SEM_FN_NAME (iq2000bf,lum32l) },
3464 { IQ2000BF_INSN_LUM64, SEM_FN_NAME (iq2000bf,lum64) },
3465 { IQ2000BF_INSN_LUM64L, SEM_FN_NAME (iq2000bf,lum64l) },
3466 { IQ2000BF_INSN_LUR, SEM_FN_NAME (iq2000bf,lur) },
3467 { IQ2000BF_INSN_LURL, SEM_FN_NAME (iq2000bf,lurl) },
3468 { IQ2000BF_INSN_LUULCK, SEM_FN_NAME (iq2000bf,luulck) },
3469 { IQ2000BF_INSN_MFC0, SEM_FN_NAME (iq2000bf,mfc0) },
3470 { IQ2000BF_INSN_MFC1, SEM_FN_NAME (iq2000bf,mfc1) },
3471 { IQ2000BF_INSN_MFC2, SEM_FN_NAME (iq2000bf,mfc2) },
3472 { IQ2000BF_INSN_MFC3, SEM_FN_NAME (iq2000bf,mfc3) },
3473 { IQ2000BF_INSN_MTC0, SEM_FN_NAME (iq2000bf,mtc0) },
3474 { IQ2000BF_INSN_MTC1, SEM_FN_NAME (iq2000bf,mtc1) },
3475 { IQ2000BF_INSN_MTC2, SEM_FN_NAME (iq2000bf,mtc2) },
3476 { IQ2000BF_INSN_MTC3, SEM_FN_NAME (iq2000bf,mtc3) },
3477 { IQ2000BF_INSN_PKRL, SEM_FN_NAME (iq2000bf,pkrl) },
3478 { IQ2000BF_INSN_PKRLR1, SEM_FN_NAME (iq2000bf,pkrlr1) },
3479 { IQ2000BF_INSN_PKRLR30, SEM_FN_NAME (iq2000bf,pkrlr30) },
3480 { IQ2000BF_INSN_RB, SEM_FN_NAME (iq2000bf,rb) },
3481 { IQ2000BF_INSN_RBR1, SEM_FN_NAME (iq2000bf,rbr1) },
3482 { IQ2000BF_INSN_RBR30, SEM_FN_NAME (iq2000bf,rbr30) },
3483 { IQ2000BF_INSN_RFE, SEM_FN_NAME (iq2000bf,rfe) },
3484 { IQ2000BF_INSN_RX, SEM_FN_NAME (iq2000bf,rx) },
3485 { IQ2000BF_INSN_RXR1, SEM_FN_NAME (iq2000bf,rxr1) },
3486 { IQ2000BF_INSN_RXR30, SEM_FN_NAME (iq2000bf,rxr30) },
3487 { IQ2000BF_INSN_SLEEP, SEM_FN_NAME (iq2000bf,sleep) },
3488 { IQ2000BF_INSN_SRRD, SEM_FN_NAME (iq2000bf,srrd) },
3489 { IQ2000BF_INSN_SRRDL, SEM_FN_NAME (iq2000bf,srrdl) },
3490 { IQ2000BF_INSN_SRULCK, SEM_FN_NAME (iq2000bf,srulck) },
3491 { IQ2000BF_INSN_SRWR, SEM_FN_NAME (iq2000bf,srwr) },
3492 { IQ2000BF_INSN_SRWRU, SEM_FN_NAME (iq2000bf,srwru) },
3493 { IQ2000BF_INSN_TRAPQFL, SEM_FN_NAME (iq2000bf,trapqfl) },
3494 { IQ2000BF_INSN_TRAPQNE, SEM_FN_NAME (iq2000bf,trapqne) },
3495 { IQ2000BF_INSN_TRAPREL, SEM_FN_NAME (iq2000bf,traprel) },
3496 { IQ2000BF_INSN_WB, SEM_FN_NAME (iq2000bf,wb) },
3497 { IQ2000BF_INSN_WBU, SEM_FN_NAME (iq2000bf,wbu) },
3498 { IQ2000BF_INSN_WBR1, SEM_FN_NAME (iq2000bf,wbr1) },
3499 { IQ2000BF_INSN_WBR1U, SEM_FN_NAME (iq2000bf,wbr1u) },
3500 { IQ2000BF_INSN_WBR30, SEM_FN_NAME (iq2000bf,wbr30) },
3501 { IQ2000BF_INSN_WBR30U, SEM_FN_NAME (iq2000bf,wbr30u) },
3502 { IQ2000BF_INSN_WX, SEM_FN_NAME (iq2000bf,wx) },
3503 { IQ2000BF_INSN_WXU, SEM_FN_NAME (iq2000bf,wxu) },
3504 { IQ2000BF_INSN_WXR1, SEM_FN_NAME (iq2000bf,wxr1) },
3505 { IQ2000BF_INSN_WXR1U, SEM_FN_NAME (iq2000bf,wxr1u) },
3506 { IQ2000BF_INSN_WXR30, SEM_FN_NAME (iq2000bf,wxr30) },
3507 { IQ2000BF_INSN_WXR30U, SEM_FN_NAME (iq2000bf,wxr30u) },
3508 { IQ2000BF_INSN_LDW, SEM_FN_NAME (iq2000bf,ldw) },
3509 { IQ2000BF_INSN_SDW, SEM_FN_NAME (iq2000bf,sdw) },
3510 { IQ2000BF_INSN_J, SEM_FN_NAME (iq2000bf,j) },
3511 { IQ2000BF_INSN_JAL, SEM_FN_NAME (iq2000bf,jal) },
3512 { IQ2000BF_INSN_BMB, SEM_FN_NAME (iq2000bf,bmb) },
3513 { 0, 0 }
3516 /* Add the semantic fns to IDESC_TABLE. */
3518 void
3519 SEM_FN_NAME (iq2000bf,init_idesc_table) (SIM_CPU *current_cpu)
3521 IDESC *idesc_table = CPU_IDESC (current_cpu);
3522 const struct sem_fn_desc *sf;
3523 int mach_num = MACH_NUM (CPU_MACH (current_cpu));
3525 for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
3527 const CGEN_INSN *insn = idesc_table[sf->index].idata;
3528 int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
3529 || CGEN_INSN_MACH_HAS_P (insn, mach_num));
3530 #if FAST_P
3531 if (valid_p)
3532 idesc_table[sf->index].sem_fast = sf->fn;
3533 else
3534 idesc_table[sf->index].sem_fast = SEM_FN_NAME (iq2000bf,x_invalid);
3535 #else
3536 if (valid_p)
3537 idesc_table[sf->index].sem_full = sf->fn;
3538 else
3539 idesc_table[sf->index].sem_full = SEM_FN_NAME (iq2000bf,x_invalid);
3540 #endif