gmp-utils: New API to simply use of GMP's integer/rational/float objects
[binutils-gdb.git] / sim / iq2000 / sem.c
blob960e6a8db42b3a39d014433cd1b4239ea8c2d700
1 /* Simulator instruction semantics for iq2000bf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2020 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
9 This file 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, or (at your option)
12 any later version.
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License along
20 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 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
34 /* This is used so that we can compile two copies of the semantic code,
35 one with full feature support and one without that runs fast(er).
36 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */
37 #if FAST_P
38 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
39 #undef CGEN_TRACE_RESULT
40 #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val)
41 #else
42 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
43 #endif
45 /* x-invalid: --invalid-- */
47 static SEM_PC
48 SEM_FN_NAME (iq2000bf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
50 #define FLD(f) abuf->fields.sfmt_empty.f
51 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
52 int UNUSED written = 0;
53 IADDR UNUSED pc = abuf->addr;
54 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
57 /* Update the recorded pc in the cpu state struct.
58 Only necessary for WITH_SCACHE case, but to avoid the
59 conditional compilation .... */
60 SET_H_PC (pc);
61 /* Virtual insns have zero size. Overwrite vpc with address of next insn
62 using the default-insn-bitsize spec. When executing insns in parallel
63 we may want to queue the fault and continue execution. */
64 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
65 vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
68 return vpc;
69 #undef FLD
72 /* x-after: --after-- */
74 static SEM_PC
75 SEM_FN_NAME (iq2000bf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
77 #define FLD(f) abuf->fields.sfmt_empty.f
78 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
79 int UNUSED written = 0;
80 IADDR UNUSED pc = abuf->addr;
81 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
84 #if WITH_SCACHE_PBB_IQ2000BF
85 iq2000bf_pbb_after (current_cpu, sem_arg);
86 #endif
89 return vpc;
90 #undef FLD
93 /* x-before: --before-- */
95 static SEM_PC
96 SEM_FN_NAME (iq2000bf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
98 #define FLD(f) abuf->fields.sfmt_empty.f
99 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
100 int UNUSED written = 0;
101 IADDR UNUSED pc = abuf->addr;
102 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
105 #if WITH_SCACHE_PBB_IQ2000BF
106 iq2000bf_pbb_before (current_cpu, sem_arg);
107 #endif
110 return vpc;
111 #undef FLD
114 /* x-cti-chain: --cti-chain-- */
116 static SEM_PC
117 SEM_FN_NAME (iq2000bf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
119 #define FLD(f) abuf->fields.sfmt_empty.f
120 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
121 int UNUSED written = 0;
122 IADDR UNUSED pc = abuf->addr;
123 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
126 #if WITH_SCACHE_PBB_IQ2000BF
127 #ifdef DEFINE_SWITCH
128 vpc = iq2000bf_pbb_cti_chain (current_cpu, sem_arg,
129 pbb_br_type, pbb_br_npc);
130 BREAK (sem);
131 #else
132 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
133 vpc = iq2000bf_pbb_cti_chain (current_cpu, sem_arg,
134 CPU_PBB_BR_TYPE (current_cpu),
135 CPU_PBB_BR_NPC (current_cpu));
136 #endif
137 #endif
140 return vpc;
141 #undef FLD
144 /* x-chain: --chain-- */
146 static SEM_PC
147 SEM_FN_NAME (iq2000bf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
149 #define FLD(f) abuf->fields.sfmt_empty.f
150 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
151 int UNUSED written = 0;
152 IADDR UNUSED pc = abuf->addr;
153 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
156 #if WITH_SCACHE_PBB_IQ2000BF
157 vpc = iq2000bf_pbb_chain (current_cpu, sem_arg);
158 #ifdef DEFINE_SWITCH
159 BREAK (sem);
160 #endif
161 #endif
164 return vpc;
165 #undef FLD
168 /* x-begin: --begin-- */
170 static SEM_PC
171 SEM_FN_NAME (iq2000bf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
173 #define FLD(f) abuf->fields.sfmt_empty.f
174 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
175 int UNUSED written = 0;
176 IADDR UNUSED pc = abuf->addr;
177 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
180 #if WITH_SCACHE_PBB_IQ2000BF
181 #if defined DEFINE_SWITCH || defined FAST_P
182 /* In the switch case FAST_P is a constant, allowing several optimizations
183 in any called inline functions. */
184 vpc = iq2000bf_pbb_begin (current_cpu, FAST_P);
185 #else
186 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
187 vpc = iq2000bf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
188 #else
189 vpc = iq2000bf_pbb_begin (current_cpu, 0);
190 #endif
191 #endif
192 #endif
195 return vpc;
196 #undef FLD
199 /* add: add $rd,$rs,$rt */
201 static SEM_PC
202 SEM_FN_NAME (iq2000bf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
204 #define FLD(f) abuf->fields.sfmt_mrgb.f
205 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
206 int UNUSED written = 0;
207 IADDR UNUSED pc = abuf->addr;
208 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
211 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
212 SET_H_GR (FLD (f_rd), opval);
213 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
216 return vpc;
217 #undef FLD
220 /* addi: addi $rt,$rs,$lo16 */
222 static SEM_PC
223 SEM_FN_NAME (iq2000bf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
225 #define FLD(f) abuf->fields.sfmt_addi.f
226 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
227 int UNUSED written = 0;
228 IADDR UNUSED pc = abuf->addr;
229 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
232 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
233 SET_H_GR (FLD (f_rt), opval);
234 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
237 return vpc;
238 #undef FLD
241 /* addiu: addiu $rt,$rs,$lo16 */
243 static SEM_PC
244 SEM_FN_NAME (iq2000bf,addiu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
246 #define FLD(f) abuf->fields.sfmt_addi.f
247 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
248 int UNUSED written = 0;
249 IADDR UNUSED pc = abuf->addr;
250 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
253 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
254 SET_H_GR (FLD (f_rt), opval);
255 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
258 return vpc;
259 #undef FLD
262 /* addu: addu $rd,$rs,$rt */
264 static SEM_PC
265 SEM_FN_NAME (iq2000bf,addu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
267 #define FLD(f) abuf->fields.sfmt_mrgb.f
268 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
269 int UNUSED written = 0;
270 IADDR UNUSED pc = abuf->addr;
271 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
274 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
275 SET_H_GR (FLD (f_rd), opval);
276 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
279 return vpc;
280 #undef FLD
283 /* ado16: ado16 $rd,$rs,$rt */
285 static SEM_PC
286 SEM_FN_NAME (iq2000bf,ado16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
288 #define FLD(f) abuf->fields.sfmt_mrgb.f
289 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
290 int UNUSED written = 0;
291 IADDR UNUSED pc = abuf->addr;
292 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
295 HI tmp_high;
296 HI tmp_low;
297 tmp_low = ADDHI (ANDHI (GET_H_GR (FLD (f_rs)), 65535), ANDHI (GET_H_GR (FLD (f_rt)), 65535));
298 tmp_high = ADDHI (SRLSI (GET_H_GR (FLD (f_rs)), 16), SRLSI (GET_H_GR (FLD (f_rt)), 16));
300 SI opval = ORSI (SLLSI (tmp_high, 16), tmp_low);
301 SET_H_GR (FLD (f_rd), opval);
302 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
306 return vpc;
307 #undef FLD
310 /* and: and $rd,$rs,$rt */
312 static SEM_PC
313 SEM_FN_NAME (iq2000bf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
315 #define FLD(f) abuf->fields.sfmt_mrgb.f
316 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
317 int UNUSED written = 0;
318 IADDR UNUSED pc = abuf->addr;
319 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
322 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
323 SET_H_GR (FLD (f_rd), opval);
324 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
327 return vpc;
328 #undef FLD
331 /* andi: andi $rt,$rs,$lo16 */
333 static SEM_PC
334 SEM_FN_NAME (iq2000bf,andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
336 #define FLD(f) abuf->fields.sfmt_addi.f
337 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
338 int UNUSED written = 0;
339 IADDR UNUSED pc = abuf->addr;
340 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
343 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
344 SET_H_GR (FLD (f_rt), opval);
345 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
348 return vpc;
349 #undef FLD
352 /* andoi: andoi $rt,$rs,$lo16 */
354 static SEM_PC
355 SEM_FN_NAME (iq2000bf,andoi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
357 #define FLD(f) abuf->fields.sfmt_addi.f
358 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
359 int UNUSED written = 0;
360 IADDR UNUSED pc = abuf->addr;
361 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
364 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ORSI (0xffff0000, EXTHISI (TRUNCSIHI (FLD (f_imm)))));
365 SET_H_GR (FLD (f_rt), opval);
366 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
369 return vpc;
370 #undef FLD
373 /* nor: nor $rd,$rs,$rt */
375 static SEM_PC
376 SEM_FN_NAME (iq2000bf,nor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
378 #define FLD(f) abuf->fields.sfmt_mrgb.f
379 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
380 int UNUSED written = 0;
381 IADDR UNUSED pc = abuf->addr;
382 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
385 SI opval = INVSI (ORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt))));
386 SET_H_GR (FLD (f_rd), opval);
387 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
390 return vpc;
391 #undef FLD
394 /* or: or $rd,$rs,$rt */
396 static SEM_PC
397 SEM_FN_NAME (iq2000bf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
399 #define FLD(f) abuf->fields.sfmt_mrgb.f
400 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
401 int UNUSED written = 0;
402 IADDR UNUSED pc = abuf->addr;
403 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
406 SI opval = ORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
407 SET_H_GR (FLD (f_rd), opval);
408 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
411 return vpc;
412 #undef FLD
415 /* ori: ori $rt,$rs,$lo16 */
417 static SEM_PC
418 SEM_FN_NAME (iq2000bf,ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
420 #define FLD(f) abuf->fields.sfmt_addi.f
421 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
422 int UNUSED written = 0;
423 IADDR UNUSED pc = abuf->addr;
424 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
427 SI opval = ORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
428 SET_H_GR (FLD (f_rt), opval);
429 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
432 return vpc;
433 #undef FLD
436 /* ram: ram $rd,$rt,$shamt,$maskl,$maskr */
438 static SEM_PC
439 SEM_FN_NAME (iq2000bf,ram) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
441 #define FLD(f) abuf->fields.sfmt_ram.f
442 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
443 int UNUSED written = 0;
444 IADDR UNUSED pc = abuf->addr;
445 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
449 SI opval = RORSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
450 SET_H_GR (FLD (f_rd), opval);
451 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
454 SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SRLSI (0xffffffff, FLD (f_maskl)));
455 SET_H_GR (FLD (f_rd), opval);
456 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
459 SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SLLSI (0xffffffff, FLD (f_rs)));
460 SET_H_GR (FLD (f_rd), opval);
461 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
465 return vpc;
466 #undef FLD
469 /* sll: sll $rd,$rt,$shamt */
471 static SEM_PC
472 SEM_FN_NAME (iq2000bf,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
474 #define FLD(f) abuf->fields.sfmt_ram.f
475 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
476 int UNUSED written = 0;
477 IADDR UNUSED pc = abuf->addr;
478 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
481 SI opval = SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
482 SET_H_GR (FLD (f_rd), opval);
483 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
486 return vpc;
487 #undef FLD
490 /* sllv: sllv $rd,$rt,$rs */
492 static SEM_PC
493 SEM_FN_NAME (iq2000bf,sllv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
495 #define FLD(f) abuf->fields.sfmt_mrgb.f
496 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
497 int UNUSED written = 0;
498 IADDR UNUSED pc = abuf->addr;
499 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
502 SI opval = SLLSI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
503 SET_H_GR (FLD (f_rd), opval);
504 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
507 return vpc;
508 #undef FLD
511 /* slmv: slmv $rd,$rt,$rs,$shamt */
513 static SEM_PC
514 SEM_FN_NAME (iq2000bf,slmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
516 #define FLD(f) abuf->fields.sfmt_ram.f
517 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
518 int UNUSED written = 0;
519 IADDR UNUSED pc = abuf->addr;
520 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
523 SI opval = ANDSI (SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt)), SRLSI (0xffffffff, GET_H_GR (FLD (f_rs))));
524 SET_H_GR (FLD (f_rd), opval);
525 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
528 return vpc;
529 #undef FLD
532 /* slt: slt $rd,$rs,$rt */
534 static SEM_PC
535 SEM_FN_NAME (iq2000bf,slt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
537 #define FLD(f) abuf->fields.sfmt_mrgb.f
538 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
539 int UNUSED written = 0;
540 IADDR UNUSED pc = abuf->addr;
541 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
543 if (LTSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
545 SI opval = 1;
546 SET_H_GR (FLD (f_rd), opval);
547 written |= (1 << 2);
548 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
550 } else {
552 SI opval = 0;
553 SET_H_GR (FLD (f_rd), opval);
554 written |= (1 << 2);
555 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
559 abuf->written = written;
560 return vpc;
561 #undef FLD
564 /* slti: slti $rt,$rs,$imm */
566 static SEM_PC
567 SEM_FN_NAME (iq2000bf,slti) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
569 #define FLD(f) abuf->fields.sfmt_addi.f
570 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
571 int UNUSED written = 0;
572 IADDR UNUSED pc = abuf->addr;
573 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
575 if (LTSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
577 SI opval = 1;
578 SET_H_GR (FLD (f_rt), opval);
579 written |= (1 << 2);
580 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
582 } else {
584 SI opval = 0;
585 SET_H_GR (FLD (f_rt), opval);
586 written |= (1 << 2);
587 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
591 abuf->written = written;
592 return vpc;
593 #undef FLD
596 /* sltiu: sltiu $rt,$rs,$imm */
598 static SEM_PC
599 SEM_FN_NAME (iq2000bf,sltiu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
601 #define FLD(f) abuf->fields.sfmt_addi.f
602 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
603 int UNUSED written = 0;
604 IADDR UNUSED pc = abuf->addr;
605 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
607 if (LTUSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
609 SI opval = 1;
610 SET_H_GR (FLD (f_rt), opval);
611 written |= (1 << 2);
612 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
614 } else {
616 SI opval = 0;
617 SET_H_GR (FLD (f_rt), opval);
618 written |= (1 << 2);
619 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
623 abuf->written = written;
624 return vpc;
625 #undef FLD
628 /* sltu: sltu $rd,$rs,$rt */
630 static SEM_PC
631 SEM_FN_NAME (iq2000bf,sltu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
633 #define FLD(f) abuf->fields.sfmt_mrgb.f
634 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
635 int UNUSED written = 0;
636 IADDR UNUSED pc = abuf->addr;
637 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
639 if (LTUSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
641 SI opval = 1;
642 SET_H_GR (FLD (f_rd), opval);
643 written |= (1 << 2);
644 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
646 } else {
648 SI opval = 0;
649 SET_H_GR (FLD (f_rd), opval);
650 written |= (1 << 2);
651 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
655 abuf->written = written;
656 return vpc;
657 #undef FLD
660 /* sra: sra $rd,$rt,$shamt */
662 static SEM_PC
663 SEM_FN_NAME (iq2000bf,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
665 #define FLD(f) abuf->fields.sfmt_ram.f
666 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
667 int UNUSED written = 0;
668 IADDR UNUSED pc = abuf->addr;
669 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
672 SI opval = SRASI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
673 SET_H_GR (FLD (f_rd), opval);
674 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
677 return vpc;
678 #undef FLD
681 /* srav: srav $rd,$rt,$rs */
683 static SEM_PC
684 SEM_FN_NAME (iq2000bf,srav) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
686 #define FLD(f) abuf->fields.sfmt_mrgb.f
687 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
688 int UNUSED written = 0;
689 IADDR UNUSED pc = abuf->addr;
690 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
693 SI opval = SRASI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
694 SET_H_GR (FLD (f_rd), opval);
695 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
698 return vpc;
699 #undef FLD
702 /* srl: srl $rd,$rt,$shamt */
704 static SEM_PC
705 SEM_FN_NAME (iq2000bf,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
707 #define FLD(f) abuf->fields.sfmt_ram.f
708 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
709 int UNUSED written = 0;
710 IADDR UNUSED pc = abuf->addr;
711 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
714 SI opval = SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
715 SET_H_GR (FLD (f_rd), opval);
716 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
719 return vpc;
720 #undef FLD
723 /* srlv: srlv $rd,$rt,$rs */
725 static SEM_PC
726 SEM_FN_NAME (iq2000bf,srlv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
728 #define FLD(f) abuf->fields.sfmt_mrgb.f
729 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
730 int UNUSED written = 0;
731 IADDR UNUSED pc = abuf->addr;
732 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
735 SI opval = SRLSI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
736 SET_H_GR (FLD (f_rd), opval);
737 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
740 return vpc;
741 #undef FLD
744 /* srmv: srmv $rd,$rt,$rs,$shamt */
746 static SEM_PC
747 SEM_FN_NAME (iq2000bf,srmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
749 #define FLD(f) abuf->fields.sfmt_ram.f
750 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
751 int UNUSED written = 0;
752 IADDR UNUSED pc = abuf->addr;
753 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
756 SI opval = ANDSI (SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt)), SLLSI (0xffffffff, GET_H_GR (FLD (f_rs))));
757 SET_H_GR (FLD (f_rd), opval);
758 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
761 return vpc;
762 #undef FLD
765 /* sub: sub $rd,$rs,$rt */
767 static SEM_PC
768 SEM_FN_NAME (iq2000bf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
770 #define FLD(f) abuf->fields.sfmt_mrgb.f
771 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
772 int UNUSED written = 0;
773 IADDR UNUSED pc = abuf->addr;
774 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
777 SI opval = SUBSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
778 SET_H_GR (FLD (f_rd), opval);
779 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
782 return vpc;
783 #undef FLD
786 /* subu: subu $rd,$rs,$rt */
788 static SEM_PC
789 SEM_FN_NAME (iq2000bf,subu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
791 #define FLD(f) abuf->fields.sfmt_mrgb.f
792 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
793 int UNUSED written = 0;
794 IADDR UNUSED pc = abuf->addr;
795 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
798 SI opval = SUBSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
799 SET_H_GR (FLD (f_rd), opval);
800 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
803 return vpc;
804 #undef FLD
807 /* xor: xor $rd,$rs,$rt */
809 static SEM_PC
810 SEM_FN_NAME (iq2000bf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
812 #define FLD(f) abuf->fields.sfmt_mrgb.f
813 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
814 int UNUSED written = 0;
815 IADDR UNUSED pc = abuf->addr;
816 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
819 SI opval = XORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
820 SET_H_GR (FLD (f_rd), opval);
821 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
824 return vpc;
825 #undef FLD
828 /* xori: xori $rt,$rs,$lo16 */
830 static SEM_PC
831 SEM_FN_NAME (iq2000bf,xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
833 #define FLD(f) abuf->fields.sfmt_addi.f
834 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
835 int UNUSED written = 0;
836 IADDR UNUSED pc = abuf->addr;
837 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
840 SI opval = XORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
841 SET_H_GR (FLD (f_rt), opval);
842 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
845 return vpc;
846 #undef FLD
849 /* bbi: bbi $rs($bitnum),$offset */
851 static SEM_PC
852 SEM_FN_NAME (iq2000bf,bbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
854 #define FLD(f) abuf->fields.sfmt_bbi.f
855 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
856 int UNUSED written = 0;
857 IADDR UNUSED pc = abuf->addr;
858 SEM_BRANCH_INIT
859 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
861 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt)))) {
864 USI opval = FLD (i_offset);
865 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
866 written |= (1 << 3);
867 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
872 abuf->written = written;
873 SEM_BRANCH_FINI (vpc);
874 return vpc;
875 #undef FLD
878 /* bbin: bbin $rs($bitnum),$offset */
880 static SEM_PC
881 SEM_FN_NAME (iq2000bf,bbin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
883 #define FLD(f) abuf->fields.sfmt_bbi.f
884 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
885 int UNUSED written = 0;
886 IADDR UNUSED pc = abuf->addr;
887 SEM_BRANCH_INIT
888 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
890 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt))))) {
893 USI opval = FLD (i_offset);
894 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
895 written |= (1 << 3);
896 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
901 abuf->written = written;
902 SEM_BRANCH_FINI (vpc);
903 return vpc;
904 #undef FLD
907 /* bbv: bbv $rs,$rt,$offset */
909 static SEM_PC
910 SEM_FN_NAME (iq2000bf,bbv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
912 #define FLD(f) abuf->fields.sfmt_bbi.f
913 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
914 int UNUSED written = 0;
915 IADDR UNUSED pc = abuf->addr;
916 SEM_BRANCH_INIT
917 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
919 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31)))) {
922 USI opval = FLD (i_offset);
923 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
924 written |= (1 << 3);
925 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
930 abuf->written = written;
931 SEM_BRANCH_FINI (vpc);
932 return vpc;
933 #undef FLD
936 /* bbvn: bbvn $rs,$rt,$offset */
938 static SEM_PC
939 SEM_FN_NAME (iq2000bf,bbvn) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
941 #define FLD(f) abuf->fields.sfmt_bbi.f
942 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
943 int UNUSED written = 0;
944 IADDR UNUSED pc = abuf->addr;
945 SEM_BRANCH_INIT
946 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
948 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31))))) {
951 USI opval = FLD (i_offset);
952 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
953 written |= (1 << 3);
954 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
959 abuf->written = written;
960 SEM_BRANCH_FINI (vpc);
961 return vpc;
962 #undef FLD
965 /* beq: beq $rs,$rt,$offset */
967 static SEM_PC
968 SEM_FN_NAME (iq2000bf,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
970 #define FLD(f) abuf->fields.sfmt_bbi.f
971 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
972 int UNUSED written = 0;
973 IADDR UNUSED pc = abuf->addr;
974 SEM_BRANCH_INIT
975 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
977 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
980 USI opval = FLD (i_offset);
981 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
982 written |= (1 << 3);
983 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
988 abuf->written = written;
989 SEM_BRANCH_FINI (vpc);
990 return vpc;
991 #undef FLD
994 /* beql: beql $rs,$rt,$offset */
996 static SEM_PC
997 SEM_FN_NAME (iq2000bf,beql) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
999 #define FLD(f) abuf->fields.sfmt_bbi.f
1000 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1001 int UNUSED written = 0;
1002 IADDR UNUSED pc = abuf->addr;
1003 SEM_BRANCH_INIT
1004 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1006 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1009 USI opval = FLD (i_offset);
1010 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1011 written |= (1 << 3);
1012 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1015 } else {
1016 if (1)
1017 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1020 abuf->written = written;
1021 SEM_BRANCH_FINI (vpc);
1022 return vpc;
1023 #undef FLD
1026 /* bgez: bgez $rs,$offset */
1028 static SEM_PC
1029 SEM_FN_NAME (iq2000bf,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1031 #define FLD(f) abuf->fields.sfmt_bbi.f
1032 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1033 int UNUSED written = 0;
1034 IADDR UNUSED pc = abuf->addr;
1035 SEM_BRANCH_INIT
1036 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1038 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1041 USI opval = FLD (i_offset);
1042 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1043 written |= (1 << 2);
1044 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1049 abuf->written = written;
1050 SEM_BRANCH_FINI (vpc);
1051 return vpc;
1052 #undef FLD
1055 /* bgezal: bgezal $rs,$offset */
1057 static SEM_PC
1058 SEM_FN_NAME (iq2000bf,bgezal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1060 #define FLD(f) abuf->fields.sfmt_bbi.f
1061 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1062 int UNUSED written = 0;
1063 IADDR UNUSED pc = abuf->addr;
1064 SEM_BRANCH_INIT
1065 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1067 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1070 SI opval = ADDSI (pc, 8);
1071 SET_H_GR (((UINT) 31), opval);
1072 written |= (1 << 3);
1073 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1077 USI opval = FLD (i_offset);
1078 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1079 written |= (1 << 4);
1080 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1086 abuf->written = written;
1087 SEM_BRANCH_FINI (vpc);
1088 return vpc;
1089 #undef FLD
1092 /* bgezall: bgezall $rs,$offset */
1094 static SEM_PC
1095 SEM_FN_NAME (iq2000bf,bgezall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1097 #define FLD(f) abuf->fields.sfmt_bbi.f
1098 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1099 int UNUSED written = 0;
1100 IADDR UNUSED pc = abuf->addr;
1101 SEM_BRANCH_INIT
1102 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1104 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1107 SI opval = ADDSI (pc, 8);
1108 SET_H_GR (((UINT) 31), opval);
1109 written |= (1 << 3);
1110 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1114 USI opval = FLD (i_offset);
1115 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1116 written |= (1 << 4);
1117 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1121 } else {
1122 if (1)
1123 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1126 abuf->written = written;
1127 SEM_BRANCH_FINI (vpc);
1128 return vpc;
1129 #undef FLD
1132 /* bgezl: bgezl $rs,$offset */
1134 static SEM_PC
1135 SEM_FN_NAME (iq2000bf,bgezl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1137 #define FLD(f) abuf->fields.sfmt_bbi.f
1138 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1139 int UNUSED written = 0;
1140 IADDR UNUSED pc = abuf->addr;
1141 SEM_BRANCH_INIT
1142 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1144 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1147 USI opval = FLD (i_offset);
1148 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1149 written |= (1 << 2);
1150 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1153 } else {
1154 if (1)
1155 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1158 abuf->written = written;
1159 SEM_BRANCH_FINI (vpc);
1160 return vpc;
1161 #undef FLD
1164 /* bltz: bltz $rs,$offset */
1166 static SEM_PC
1167 SEM_FN_NAME (iq2000bf,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1169 #define FLD(f) abuf->fields.sfmt_bbi.f
1170 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1171 int UNUSED written = 0;
1172 IADDR UNUSED pc = abuf->addr;
1173 SEM_BRANCH_INIT
1174 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1176 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1179 USI opval = FLD (i_offset);
1180 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1181 written |= (1 << 2);
1182 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1187 abuf->written = written;
1188 SEM_BRANCH_FINI (vpc);
1189 return vpc;
1190 #undef FLD
1193 /* bltzl: bltzl $rs,$offset */
1195 static SEM_PC
1196 SEM_FN_NAME (iq2000bf,bltzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1198 #define FLD(f) abuf->fields.sfmt_bbi.f
1199 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1200 int UNUSED written = 0;
1201 IADDR UNUSED pc = abuf->addr;
1202 SEM_BRANCH_INIT
1203 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1205 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1208 USI opval = FLD (i_offset);
1209 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1210 written |= (1 << 2);
1211 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1214 } else {
1215 if (1)
1216 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1219 abuf->written = written;
1220 SEM_BRANCH_FINI (vpc);
1221 return vpc;
1222 #undef FLD
1225 /* bltzal: bltzal $rs,$offset */
1227 static SEM_PC
1228 SEM_FN_NAME (iq2000bf,bltzal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1230 #define FLD(f) abuf->fields.sfmt_bbi.f
1231 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1232 int UNUSED written = 0;
1233 IADDR UNUSED pc = abuf->addr;
1234 SEM_BRANCH_INIT
1235 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1237 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1240 SI opval = ADDSI (pc, 8);
1241 SET_H_GR (((UINT) 31), opval);
1242 written |= (1 << 3);
1243 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1247 USI opval = FLD (i_offset);
1248 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1249 written |= (1 << 4);
1250 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1256 abuf->written = written;
1257 SEM_BRANCH_FINI (vpc);
1258 return vpc;
1259 #undef FLD
1262 /* bltzall: bltzall $rs,$offset */
1264 static SEM_PC
1265 SEM_FN_NAME (iq2000bf,bltzall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1267 #define FLD(f) abuf->fields.sfmt_bbi.f
1268 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1269 int UNUSED written = 0;
1270 IADDR UNUSED pc = abuf->addr;
1271 SEM_BRANCH_INIT
1272 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1274 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1277 SI opval = ADDSI (pc, 8);
1278 SET_H_GR (((UINT) 31), opval);
1279 written |= (1 << 3);
1280 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1284 USI opval = FLD (i_offset);
1285 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1286 written |= (1 << 4);
1287 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1291 } else {
1292 if (1)
1293 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1296 abuf->written = written;
1297 SEM_BRANCH_FINI (vpc);
1298 return vpc;
1299 #undef FLD
1302 /* bmb0: bmb0 $rs,$rt,$offset */
1304 static SEM_PC
1305 SEM_FN_NAME (iq2000bf,bmb0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1307 #define FLD(f) abuf->fields.sfmt_bbi.f
1308 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1309 int UNUSED written = 0;
1310 IADDR UNUSED pc = abuf->addr;
1311 SEM_BRANCH_INIT
1312 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1314 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
1317 USI opval = FLD (i_offset);
1318 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1319 written |= (1 << 3);
1320 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1325 abuf->written = written;
1326 SEM_BRANCH_FINI (vpc);
1327 return vpc;
1328 #undef FLD
1331 /* bmb1: bmb1 $rs,$rt,$offset */
1333 static SEM_PC
1334 SEM_FN_NAME (iq2000bf,bmb1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1336 #define FLD(f) abuf->fields.sfmt_bbi.f
1337 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1338 int UNUSED written = 0;
1339 IADDR UNUSED pc = abuf->addr;
1340 SEM_BRANCH_INIT
1341 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1343 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
1346 USI opval = FLD (i_offset);
1347 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1348 written |= (1 << 3);
1349 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1354 abuf->written = written;
1355 SEM_BRANCH_FINI (vpc);
1356 return vpc;
1357 #undef FLD
1360 /* bmb2: bmb2 $rs,$rt,$offset */
1362 static SEM_PC
1363 SEM_FN_NAME (iq2000bf,bmb2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1365 #define FLD(f) abuf->fields.sfmt_bbi.f
1366 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1367 int UNUSED written = 0;
1368 IADDR UNUSED pc = abuf->addr;
1369 SEM_BRANCH_INIT
1370 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1372 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
1375 USI opval = FLD (i_offset);
1376 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1377 written |= (1 << 3);
1378 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1383 abuf->written = written;
1384 SEM_BRANCH_FINI (vpc);
1385 return vpc;
1386 #undef FLD
1389 /* bmb3: bmb3 $rs,$rt,$offset */
1391 static SEM_PC
1392 SEM_FN_NAME (iq2000bf,bmb3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1394 #define FLD(f) abuf->fields.sfmt_bbi.f
1395 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1396 int UNUSED written = 0;
1397 IADDR UNUSED pc = abuf->addr;
1398 SEM_BRANCH_INIT
1399 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1401 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
1404 USI opval = FLD (i_offset);
1405 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1406 written |= (1 << 3);
1407 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1412 abuf->written = written;
1413 SEM_BRANCH_FINI (vpc);
1414 return vpc;
1415 #undef FLD
1418 /* bne: bne $rs,$rt,$offset */
1420 static SEM_PC
1421 SEM_FN_NAME (iq2000bf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1423 #define FLD(f) abuf->fields.sfmt_bbi.f
1424 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1425 int UNUSED written = 0;
1426 IADDR UNUSED pc = abuf->addr;
1427 SEM_BRANCH_INIT
1428 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1430 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1433 USI opval = FLD (i_offset);
1434 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1435 written |= (1 << 3);
1436 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1441 abuf->written = written;
1442 SEM_BRANCH_FINI (vpc);
1443 return vpc;
1444 #undef FLD
1447 /* bnel: bnel $rs,$rt,$offset */
1449 static SEM_PC
1450 SEM_FN_NAME (iq2000bf,bnel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1452 #define FLD(f) abuf->fields.sfmt_bbi.f
1453 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1454 int UNUSED written = 0;
1455 IADDR UNUSED pc = abuf->addr;
1456 SEM_BRANCH_INIT
1457 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1459 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1462 USI opval = FLD (i_offset);
1463 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1464 written |= (1 << 3);
1465 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1468 } else {
1469 if (1)
1470 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1473 abuf->written = written;
1474 SEM_BRANCH_FINI (vpc);
1475 return vpc;
1476 #undef FLD
1479 /* jalr: jalr $rd,$rs */
1481 static SEM_PC
1482 SEM_FN_NAME (iq2000bf,jalr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1484 #define FLD(f) abuf->fields.sfmt_mrgb.f
1485 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1486 int UNUSED written = 0;
1487 IADDR UNUSED pc = abuf->addr;
1488 SEM_BRANCH_INIT
1489 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1494 SI opval = ADDSI (pc, 8);
1495 SET_H_GR (FLD (f_rd), opval);
1496 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1499 USI opval = GET_H_GR (FLD (f_rs));
1500 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1501 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1506 SEM_BRANCH_FINI (vpc);
1507 return vpc;
1508 #undef FLD
1511 /* jr: jr $rs */
1513 static SEM_PC
1514 SEM_FN_NAME (iq2000bf,jr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1516 #define FLD(f) abuf->fields.sfmt_bbi.f
1517 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1518 int UNUSED written = 0;
1519 IADDR UNUSED pc = abuf->addr;
1520 SEM_BRANCH_INIT
1521 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1525 USI opval = GET_H_GR (FLD (f_rs));
1526 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1527 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1531 SEM_BRANCH_FINI (vpc);
1532 return vpc;
1533 #undef FLD
1536 /* lb: lb $rt,$lo16($base) */
1538 static SEM_PC
1539 SEM_FN_NAME (iq2000bf,lb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1541 #define FLD(f) abuf->fields.sfmt_addi.f
1542 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1543 int UNUSED written = 0;
1544 IADDR UNUSED pc = abuf->addr;
1545 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1548 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1549 SET_H_GR (FLD (f_rt), opval);
1550 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1553 return vpc;
1554 #undef FLD
1557 /* lbu: lbu $rt,$lo16($base) */
1559 static SEM_PC
1560 SEM_FN_NAME (iq2000bf,lbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1562 #define FLD(f) abuf->fields.sfmt_addi.f
1563 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1564 int UNUSED written = 0;
1565 IADDR UNUSED pc = abuf->addr;
1566 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1569 SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1570 SET_H_GR (FLD (f_rt), opval);
1571 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1574 return vpc;
1575 #undef FLD
1578 /* lh: lh $rt,$lo16($base) */
1580 static SEM_PC
1581 SEM_FN_NAME (iq2000bf,lh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1583 #define FLD(f) abuf->fields.sfmt_addi.f
1584 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1585 int UNUSED written = 0;
1586 IADDR UNUSED pc = abuf->addr;
1587 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1590 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1591 SET_H_GR (FLD (f_rt), opval);
1592 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1595 return vpc;
1596 #undef FLD
1599 /* lhu: lhu $rt,$lo16($base) */
1601 static SEM_PC
1602 SEM_FN_NAME (iq2000bf,lhu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1604 #define FLD(f) abuf->fields.sfmt_addi.f
1605 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1606 int UNUSED written = 0;
1607 IADDR UNUSED pc = abuf->addr;
1608 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1611 SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1612 SET_H_GR (FLD (f_rt), opval);
1613 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1616 return vpc;
1617 #undef FLD
1620 /* lui: lui $rt,$hi16 */
1622 static SEM_PC
1623 SEM_FN_NAME (iq2000bf,lui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1625 #define FLD(f) abuf->fields.sfmt_addi.f
1626 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1627 int UNUSED written = 0;
1628 IADDR UNUSED pc = abuf->addr;
1629 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1632 SI opval = SLLSI (FLD (f_imm), 16);
1633 SET_H_GR (FLD (f_rt), opval);
1634 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1637 return vpc;
1638 #undef FLD
1641 /* lw: lw $rt,$lo16($base) */
1643 static SEM_PC
1644 SEM_FN_NAME (iq2000bf,lw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1646 #define FLD(f) abuf->fields.sfmt_addi.f
1647 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1648 int UNUSED written = 0;
1649 IADDR UNUSED pc = abuf->addr;
1650 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1653 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))));
1654 SET_H_GR (FLD (f_rt), opval);
1655 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1658 return vpc;
1659 #undef FLD
1662 /* sb: sb $rt,$lo16($base) */
1664 static SEM_PC
1665 SEM_FN_NAME (iq2000bf,sb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1667 #define FLD(f) abuf->fields.sfmt_addi.f
1668 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1669 int UNUSED written = 0;
1670 IADDR UNUSED pc = abuf->addr;
1671 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1674 QI opval = ANDQI (GET_H_GR (FLD (f_rt)), 255);
1675 SETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1676 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1679 return vpc;
1680 #undef FLD
1683 /* sh: sh $rt,$lo16($base) */
1685 static SEM_PC
1686 SEM_FN_NAME (iq2000bf,sh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1688 #define FLD(f) abuf->fields.sfmt_addi.f
1689 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1690 int UNUSED written = 0;
1691 IADDR UNUSED pc = abuf->addr;
1692 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1695 HI opval = ANDHI (GET_H_GR (FLD (f_rt)), 65535);
1696 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1697 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1700 return vpc;
1701 #undef FLD
1704 /* sw: sw $rt,$lo16($base) */
1706 static SEM_PC
1707 SEM_FN_NAME (iq2000bf,sw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1709 #define FLD(f) abuf->fields.sfmt_addi.f
1710 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1711 int UNUSED written = 0;
1712 IADDR UNUSED pc = abuf->addr;
1713 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1716 SI opval = GET_H_GR (FLD (f_rt));
1717 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1718 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1721 return vpc;
1722 #undef FLD
1725 /* break: break */
1727 static SEM_PC
1728 SEM_FN_NAME (iq2000bf,break) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1730 #define FLD(f) abuf->fields.sfmt_empty.f
1731 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1732 int UNUSED written = 0;
1733 IADDR UNUSED pc = abuf->addr;
1734 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1736 do_break (current_cpu, pc);
1738 return vpc;
1739 #undef FLD
1742 /* syscall: syscall */
1744 static SEM_PC
1745 SEM_FN_NAME (iq2000bf,syscall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1747 #define FLD(f) abuf->fields.sfmt_empty.f
1748 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1749 int UNUSED written = 0;
1750 IADDR UNUSED pc = abuf->addr;
1751 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1753 do_syscall (current_cpu);
1755 return vpc;
1756 #undef FLD
1759 /* andoui: andoui $rt,$rs,$hi16 */
1761 static SEM_PC
1762 SEM_FN_NAME (iq2000bf,andoui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1764 #define FLD(f) abuf->fields.sfmt_addi.f
1765 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1766 int UNUSED written = 0;
1767 IADDR UNUSED pc = abuf->addr;
1768 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1771 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ORSI (SLLSI (FLD (f_imm), 16), 65535));
1772 SET_H_GR (FLD (f_rt), opval);
1773 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1776 return vpc;
1777 #undef FLD
1780 /* orui: orui $rt,$rs,$hi16 */
1782 static SEM_PC
1783 SEM_FN_NAME (iq2000bf,orui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1785 #define FLD(f) abuf->fields.sfmt_addi.f
1786 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1787 int UNUSED written = 0;
1788 IADDR UNUSED pc = abuf->addr;
1789 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1792 SI opval = ORSI (GET_H_GR (FLD (f_rs)), SLLSI (FLD (f_imm), 16));
1793 SET_H_GR (FLD (f_rt), opval);
1794 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1797 return vpc;
1798 #undef FLD
1801 /* bgtz: bgtz $rs,$offset */
1803 static SEM_PC
1804 SEM_FN_NAME (iq2000bf,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1806 #define FLD(f) abuf->fields.sfmt_bbi.f
1807 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1808 int UNUSED written = 0;
1809 IADDR UNUSED pc = abuf->addr;
1810 SEM_BRANCH_INIT
1811 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1813 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1816 USI opval = FLD (i_offset);
1817 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1818 written |= (1 << 2);
1819 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1824 abuf->written = written;
1825 SEM_BRANCH_FINI (vpc);
1826 return vpc;
1827 #undef FLD
1830 /* bgtzl: bgtzl $rs,$offset */
1832 static SEM_PC
1833 SEM_FN_NAME (iq2000bf,bgtzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1835 #define FLD(f) abuf->fields.sfmt_bbi.f
1836 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1837 int UNUSED written = 0;
1838 IADDR UNUSED pc = abuf->addr;
1839 SEM_BRANCH_INIT
1840 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1842 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1845 USI opval = FLD (i_offset);
1846 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1847 written |= (1 << 2);
1848 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1851 } else {
1852 if (1)
1853 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1856 abuf->written = written;
1857 SEM_BRANCH_FINI (vpc);
1858 return vpc;
1859 #undef FLD
1862 /* blez: blez $rs,$offset */
1864 static SEM_PC
1865 SEM_FN_NAME (iq2000bf,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1867 #define FLD(f) abuf->fields.sfmt_bbi.f
1868 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1869 int UNUSED written = 0;
1870 IADDR UNUSED pc = abuf->addr;
1871 SEM_BRANCH_INIT
1872 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1874 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1877 USI opval = FLD (i_offset);
1878 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1879 written |= (1 << 2);
1880 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1885 abuf->written = written;
1886 SEM_BRANCH_FINI (vpc);
1887 return vpc;
1888 #undef FLD
1891 /* blezl: blezl $rs,$offset */
1893 static SEM_PC
1894 SEM_FN_NAME (iq2000bf,blezl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1896 #define FLD(f) abuf->fields.sfmt_bbi.f
1897 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1898 int UNUSED written = 0;
1899 IADDR UNUSED pc = abuf->addr;
1900 SEM_BRANCH_INIT
1901 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1903 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1906 USI opval = FLD (i_offset);
1907 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1908 written |= (1 << 2);
1909 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1912 } else {
1913 if (1)
1914 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1917 abuf->written = written;
1918 SEM_BRANCH_FINI (vpc);
1919 return vpc;
1920 #undef FLD
1923 /* mrgb: mrgb $rd,$rs,$rt,$mask */
1925 static SEM_PC
1926 SEM_FN_NAME (iq2000bf,mrgb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1928 #define FLD(f) abuf->fields.sfmt_mrgb.f
1929 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1930 int UNUSED written = 0;
1931 IADDR UNUSED pc = abuf->addr;
1932 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1935 SI tmp_temp;
1936 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 0)))) {
1937 tmp_temp = ANDSI (GET_H_GR (FLD (f_rs)), 255);
1938 } else {
1939 tmp_temp = ANDSI (GET_H_GR (FLD (f_rt)), 255);
1941 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 1)))) {
1942 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 65280));
1943 } else {
1944 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 65280));
1946 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 2)))) {
1947 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 16711680));
1948 } else {
1949 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 16711680));
1951 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 3)))) {
1952 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000));
1953 } else {
1954 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000));
1957 SI opval = tmp_temp;
1958 SET_H_GR (FLD (f_rd), opval);
1959 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1963 return vpc;
1964 #undef FLD
1967 /* bctxt: bctxt $rs,$offset */
1969 static SEM_PC
1970 SEM_FN_NAME (iq2000bf,bctxt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1972 #define FLD(f) abuf->fields.sfmt_empty.f
1973 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1974 int UNUSED written = 0;
1975 IADDR UNUSED pc = abuf->addr;
1976 SEM_BRANCH_INIT
1977 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1979 ((void) 0); /*nop*/
1981 SEM_BRANCH_FINI (vpc);
1982 return vpc;
1983 #undef FLD
1986 /* bc0f: bc0f $offset */
1988 static SEM_PC
1989 SEM_FN_NAME (iq2000bf,bc0f) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1991 #define FLD(f) abuf->fields.sfmt_empty.f
1992 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1993 int UNUSED written = 0;
1994 IADDR UNUSED pc = abuf->addr;
1995 SEM_BRANCH_INIT
1996 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1998 ((void) 0); /*nop*/
2000 SEM_BRANCH_FINI (vpc);
2001 return vpc;
2002 #undef FLD
2005 /* bc0fl: bc0fl $offset */
2007 static SEM_PC
2008 SEM_FN_NAME (iq2000bf,bc0fl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2010 #define FLD(f) abuf->fields.sfmt_empty.f
2011 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2012 int UNUSED written = 0;
2013 IADDR UNUSED pc = abuf->addr;
2014 SEM_BRANCH_INIT
2015 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2017 ((void) 0); /*nop*/
2019 SEM_BRANCH_FINI (vpc);
2020 return vpc;
2021 #undef FLD
2024 /* bc3f: bc3f $offset */
2026 static SEM_PC
2027 SEM_FN_NAME (iq2000bf,bc3f) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2029 #define FLD(f) abuf->fields.sfmt_empty.f
2030 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2031 int UNUSED written = 0;
2032 IADDR UNUSED pc = abuf->addr;
2033 SEM_BRANCH_INIT
2034 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2036 ((void) 0); /*nop*/
2038 SEM_BRANCH_FINI (vpc);
2039 return vpc;
2040 #undef FLD
2043 /* bc3fl: bc3fl $offset */
2045 static SEM_PC
2046 SEM_FN_NAME (iq2000bf,bc3fl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2048 #define FLD(f) abuf->fields.sfmt_empty.f
2049 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2050 int UNUSED written = 0;
2051 IADDR UNUSED pc = abuf->addr;
2052 SEM_BRANCH_INIT
2053 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2055 ((void) 0); /*nop*/
2057 SEM_BRANCH_FINI (vpc);
2058 return vpc;
2059 #undef FLD
2062 /* bc0t: bc0t $offset */
2064 static SEM_PC
2065 SEM_FN_NAME (iq2000bf,bc0t) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2067 #define FLD(f) abuf->fields.sfmt_empty.f
2068 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2069 int UNUSED written = 0;
2070 IADDR UNUSED pc = abuf->addr;
2071 SEM_BRANCH_INIT
2072 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2074 ((void) 0); /*nop*/
2076 SEM_BRANCH_FINI (vpc);
2077 return vpc;
2078 #undef FLD
2081 /* bc0tl: bc0tl $offset */
2083 static SEM_PC
2084 SEM_FN_NAME (iq2000bf,bc0tl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2086 #define FLD(f) abuf->fields.sfmt_empty.f
2087 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2088 int UNUSED written = 0;
2089 IADDR UNUSED pc = abuf->addr;
2090 SEM_BRANCH_INIT
2091 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2093 ((void) 0); /*nop*/
2095 SEM_BRANCH_FINI (vpc);
2096 return vpc;
2097 #undef FLD
2100 /* bc3t: bc3t $offset */
2102 static SEM_PC
2103 SEM_FN_NAME (iq2000bf,bc3t) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2105 #define FLD(f) abuf->fields.sfmt_empty.f
2106 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2107 int UNUSED written = 0;
2108 IADDR UNUSED pc = abuf->addr;
2109 SEM_BRANCH_INIT
2110 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2112 ((void) 0); /*nop*/
2114 SEM_BRANCH_FINI (vpc);
2115 return vpc;
2116 #undef FLD
2119 /* bc3tl: bc3tl $offset */
2121 static SEM_PC
2122 SEM_FN_NAME (iq2000bf,bc3tl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2124 #define FLD(f) abuf->fields.sfmt_empty.f
2125 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2126 int UNUSED written = 0;
2127 IADDR UNUSED pc = abuf->addr;
2128 SEM_BRANCH_INIT
2129 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2131 ((void) 0); /*nop*/
2133 SEM_BRANCH_FINI (vpc);
2134 return vpc;
2135 #undef FLD
2138 /* cfc0: cfc0 $rt,$rd */
2140 static SEM_PC
2141 SEM_FN_NAME (iq2000bf,cfc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2143 #define FLD(f) abuf->fields.sfmt_empty.f
2144 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2145 int UNUSED written = 0;
2146 IADDR UNUSED pc = abuf->addr;
2147 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2149 ((void) 0); /*nop*/
2151 return vpc;
2152 #undef FLD
2155 /* cfc1: cfc1 $rt,$rd */
2157 static SEM_PC
2158 SEM_FN_NAME (iq2000bf,cfc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2160 #define FLD(f) abuf->fields.sfmt_empty.f
2161 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2162 int UNUSED written = 0;
2163 IADDR UNUSED pc = abuf->addr;
2164 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2166 ((void) 0); /*nop*/
2168 return vpc;
2169 #undef FLD
2172 /* cfc2: cfc2 $rt,$rd */
2174 static SEM_PC
2175 SEM_FN_NAME (iq2000bf,cfc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2177 #define FLD(f) abuf->fields.sfmt_empty.f
2178 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2179 int UNUSED written = 0;
2180 IADDR UNUSED pc = abuf->addr;
2181 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2183 ((void) 0); /*nop*/
2185 return vpc;
2186 #undef FLD
2189 /* cfc3: cfc3 $rt,$rd */
2191 static SEM_PC
2192 SEM_FN_NAME (iq2000bf,cfc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2194 #define FLD(f) abuf->fields.sfmt_empty.f
2195 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2196 int UNUSED written = 0;
2197 IADDR UNUSED pc = abuf->addr;
2198 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2200 ((void) 0); /*nop*/
2202 return vpc;
2203 #undef FLD
2206 /* chkhdr: chkhdr $rd,$rt */
2208 static SEM_PC
2209 SEM_FN_NAME (iq2000bf,chkhdr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2211 #define FLD(f) abuf->fields.sfmt_empty.f
2212 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2213 int UNUSED written = 0;
2214 IADDR UNUSED pc = abuf->addr;
2215 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2217 ((void) 0); /*nop*/
2219 return vpc;
2220 #undef FLD
2223 /* ctc0: ctc0 $rt,$rd */
2225 static SEM_PC
2226 SEM_FN_NAME (iq2000bf,ctc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2228 #define FLD(f) abuf->fields.sfmt_empty.f
2229 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2230 int UNUSED written = 0;
2231 IADDR UNUSED pc = abuf->addr;
2232 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2234 ((void) 0); /*nop*/
2236 return vpc;
2237 #undef FLD
2240 /* ctc1: ctc1 $rt,$rd */
2242 static SEM_PC
2243 SEM_FN_NAME (iq2000bf,ctc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2245 #define FLD(f) abuf->fields.sfmt_empty.f
2246 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2247 int UNUSED written = 0;
2248 IADDR UNUSED pc = abuf->addr;
2249 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2251 ((void) 0); /*nop*/
2253 return vpc;
2254 #undef FLD
2257 /* ctc2: ctc2 $rt,$rd */
2259 static SEM_PC
2260 SEM_FN_NAME (iq2000bf,ctc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2262 #define FLD(f) abuf->fields.sfmt_empty.f
2263 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2264 int UNUSED written = 0;
2265 IADDR UNUSED pc = abuf->addr;
2266 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2268 ((void) 0); /*nop*/
2270 return vpc;
2271 #undef FLD
2274 /* ctc3: ctc3 $rt,$rd */
2276 static SEM_PC
2277 SEM_FN_NAME (iq2000bf,ctc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2279 #define FLD(f) abuf->fields.sfmt_empty.f
2280 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2281 int UNUSED written = 0;
2282 IADDR UNUSED pc = abuf->addr;
2283 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2285 ((void) 0); /*nop*/
2287 return vpc;
2288 #undef FLD
2291 /* jcr: jcr $rs */
2293 static SEM_PC
2294 SEM_FN_NAME (iq2000bf,jcr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2296 #define FLD(f) abuf->fields.sfmt_empty.f
2297 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2298 int UNUSED written = 0;
2299 IADDR UNUSED pc = abuf->addr;
2300 SEM_BRANCH_INIT
2301 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2303 ((void) 0); /*nop*/
2305 SEM_BRANCH_FINI (vpc);
2306 return vpc;
2307 #undef FLD
2310 /* luc32: luc32 $rt,$rd */
2312 static SEM_PC
2313 SEM_FN_NAME (iq2000bf,luc32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2315 #define FLD(f) abuf->fields.sfmt_empty.f
2316 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2317 int UNUSED written = 0;
2318 IADDR UNUSED pc = abuf->addr;
2319 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2321 ((void) 0); /*nop*/
2323 return vpc;
2324 #undef FLD
2327 /* luc32l: luc32l $rt,$rd */
2329 static SEM_PC
2330 SEM_FN_NAME (iq2000bf,luc32l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2332 #define FLD(f) abuf->fields.sfmt_empty.f
2333 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2334 int UNUSED written = 0;
2335 IADDR UNUSED pc = abuf->addr;
2336 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2338 ((void) 0); /*nop*/
2340 return vpc;
2341 #undef FLD
2344 /* luc64: luc64 $rt,$rd */
2346 static SEM_PC
2347 SEM_FN_NAME (iq2000bf,luc64) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2349 #define FLD(f) abuf->fields.sfmt_empty.f
2350 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2351 int UNUSED written = 0;
2352 IADDR UNUSED pc = abuf->addr;
2353 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2355 ((void) 0); /*nop*/
2357 return vpc;
2358 #undef FLD
2361 /* luc64l: luc64l $rt,$rd */
2363 static SEM_PC
2364 SEM_FN_NAME (iq2000bf,luc64l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2366 #define FLD(f) abuf->fields.sfmt_empty.f
2367 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2368 int UNUSED written = 0;
2369 IADDR UNUSED pc = abuf->addr;
2370 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2372 ((void) 0); /*nop*/
2374 return vpc;
2375 #undef FLD
2378 /* luk: luk $rt,$rd */
2380 static SEM_PC
2381 SEM_FN_NAME (iq2000bf,luk) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2383 #define FLD(f) abuf->fields.sfmt_empty.f
2384 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2385 int UNUSED written = 0;
2386 IADDR UNUSED pc = abuf->addr;
2387 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2389 ((void) 0); /*nop*/
2391 return vpc;
2392 #undef FLD
2395 /* lulck: lulck $rt */
2397 static SEM_PC
2398 SEM_FN_NAME (iq2000bf,lulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2400 #define FLD(f) abuf->fields.sfmt_empty.f
2401 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2402 int UNUSED written = 0;
2403 IADDR UNUSED pc = abuf->addr;
2404 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2406 ((void) 0); /*nop*/
2408 return vpc;
2409 #undef FLD
2412 /* lum32: lum32 $rt,$rd */
2414 static SEM_PC
2415 SEM_FN_NAME (iq2000bf,lum32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2417 #define FLD(f) abuf->fields.sfmt_empty.f
2418 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2419 int UNUSED written = 0;
2420 IADDR UNUSED pc = abuf->addr;
2421 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2423 ((void) 0); /*nop*/
2425 return vpc;
2426 #undef FLD
2429 /* lum32l: lum32l $rt,$rd */
2431 static SEM_PC
2432 SEM_FN_NAME (iq2000bf,lum32l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2434 #define FLD(f) abuf->fields.sfmt_empty.f
2435 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2436 int UNUSED written = 0;
2437 IADDR UNUSED pc = abuf->addr;
2438 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2440 ((void) 0); /*nop*/
2442 return vpc;
2443 #undef FLD
2446 /* lum64: lum64 $rt,$rd */
2448 static SEM_PC
2449 SEM_FN_NAME (iq2000bf,lum64) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2451 #define FLD(f) abuf->fields.sfmt_empty.f
2452 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2453 int UNUSED written = 0;
2454 IADDR UNUSED pc = abuf->addr;
2455 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2457 ((void) 0); /*nop*/
2459 return vpc;
2460 #undef FLD
2463 /* lum64l: lum64l $rt,$rd */
2465 static SEM_PC
2466 SEM_FN_NAME (iq2000bf,lum64l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2468 #define FLD(f) abuf->fields.sfmt_empty.f
2469 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2470 int UNUSED written = 0;
2471 IADDR UNUSED pc = abuf->addr;
2472 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2474 ((void) 0); /*nop*/
2476 return vpc;
2477 #undef FLD
2480 /* lur: lur $rt,$rd */
2482 static SEM_PC
2483 SEM_FN_NAME (iq2000bf,lur) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2485 #define FLD(f) abuf->fields.sfmt_empty.f
2486 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2487 int UNUSED written = 0;
2488 IADDR UNUSED pc = abuf->addr;
2489 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2491 ((void) 0); /*nop*/
2493 return vpc;
2494 #undef FLD
2497 /* lurl: lurl $rt,$rd */
2499 static SEM_PC
2500 SEM_FN_NAME (iq2000bf,lurl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2502 #define FLD(f) abuf->fields.sfmt_empty.f
2503 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2504 int UNUSED written = 0;
2505 IADDR UNUSED pc = abuf->addr;
2506 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2508 ((void) 0); /*nop*/
2510 return vpc;
2511 #undef FLD
2514 /* luulck: luulck $rt */
2516 static SEM_PC
2517 SEM_FN_NAME (iq2000bf,luulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2519 #define FLD(f) abuf->fields.sfmt_empty.f
2520 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2521 int UNUSED written = 0;
2522 IADDR UNUSED pc = abuf->addr;
2523 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2525 ((void) 0); /*nop*/
2527 return vpc;
2528 #undef FLD
2531 /* mfc0: mfc0 $rt,$rd */
2533 static SEM_PC
2534 SEM_FN_NAME (iq2000bf,mfc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2536 #define FLD(f) abuf->fields.sfmt_empty.f
2537 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2538 int UNUSED written = 0;
2539 IADDR UNUSED pc = abuf->addr;
2540 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2542 ((void) 0); /*nop*/
2544 return vpc;
2545 #undef FLD
2548 /* mfc1: mfc1 $rt,$rd */
2550 static SEM_PC
2551 SEM_FN_NAME (iq2000bf,mfc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2553 #define FLD(f) abuf->fields.sfmt_empty.f
2554 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2555 int UNUSED written = 0;
2556 IADDR UNUSED pc = abuf->addr;
2557 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2559 ((void) 0); /*nop*/
2561 return vpc;
2562 #undef FLD
2565 /* mfc2: mfc2 $rt,$rd */
2567 static SEM_PC
2568 SEM_FN_NAME (iq2000bf,mfc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2570 #define FLD(f) abuf->fields.sfmt_empty.f
2571 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2572 int UNUSED written = 0;
2573 IADDR UNUSED pc = abuf->addr;
2574 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2576 ((void) 0); /*nop*/
2578 return vpc;
2579 #undef FLD
2582 /* mfc3: mfc3 $rt,$rd */
2584 static SEM_PC
2585 SEM_FN_NAME (iq2000bf,mfc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2587 #define FLD(f) abuf->fields.sfmt_empty.f
2588 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2589 int UNUSED written = 0;
2590 IADDR UNUSED pc = abuf->addr;
2591 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2593 ((void) 0); /*nop*/
2595 return vpc;
2596 #undef FLD
2599 /* mtc0: mtc0 $rt,$rd */
2601 static SEM_PC
2602 SEM_FN_NAME (iq2000bf,mtc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2604 #define FLD(f) abuf->fields.sfmt_empty.f
2605 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2606 int UNUSED written = 0;
2607 IADDR UNUSED pc = abuf->addr;
2608 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2610 ((void) 0); /*nop*/
2612 return vpc;
2613 #undef FLD
2616 /* mtc1: mtc1 $rt,$rd */
2618 static SEM_PC
2619 SEM_FN_NAME (iq2000bf,mtc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2621 #define FLD(f) abuf->fields.sfmt_empty.f
2622 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2623 int UNUSED written = 0;
2624 IADDR UNUSED pc = abuf->addr;
2625 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2627 ((void) 0); /*nop*/
2629 return vpc;
2630 #undef FLD
2633 /* mtc2: mtc2 $rt,$rd */
2635 static SEM_PC
2636 SEM_FN_NAME (iq2000bf,mtc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2638 #define FLD(f) abuf->fields.sfmt_empty.f
2639 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2640 int UNUSED written = 0;
2641 IADDR UNUSED pc = abuf->addr;
2642 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2644 ((void) 0); /*nop*/
2646 return vpc;
2647 #undef FLD
2650 /* mtc3: mtc3 $rt,$rd */
2652 static SEM_PC
2653 SEM_FN_NAME (iq2000bf,mtc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2655 #define FLD(f) abuf->fields.sfmt_empty.f
2656 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2657 int UNUSED written = 0;
2658 IADDR UNUSED pc = abuf->addr;
2659 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2661 ((void) 0); /*nop*/
2663 return vpc;
2664 #undef FLD
2667 /* pkrl: pkrl $rd,$rt */
2669 static SEM_PC
2670 SEM_FN_NAME (iq2000bf,pkrl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2672 #define FLD(f) abuf->fields.sfmt_empty.f
2673 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2674 int UNUSED written = 0;
2675 IADDR UNUSED pc = abuf->addr;
2676 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2678 ((void) 0); /*nop*/
2680 return vpc;
2681 #undef FLD
2684 /* pkrlr1: pkrlr1 $rt,$_index,$count */
2686 static SEM_PC
2687 SEM_FN_NAME (iq2000bf,pkrlr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2689 #define FLD(f) abuf->fields.sfmt_empty.f
2690 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2691 int UNUSED written = 0;
2692 IADDR UNUSED pc = abuf->addr;
2693 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2695 ((void) 0); /*nop*/
2697 return vpc;
2698 #undef FLD
2701 /* pkrlr30: pkrlr30 $rt,$_index,$count */
2703 static SEM_PC
2704 SEM_FN_NAME (iq2000bf,pkrlr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2706 #define FLD(f) abuf->fields.sfmt_empty.f
2707 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2708 int UNUSED written = 0;
2709 IADDR UNUSED pc = abuf->addr;
2710 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2712 ((void) 0); /*nop*/
2714 return vpc;
2715 #undef FLD
2718 /* rb: rb $rd,$rt */
2720 static SEM_PC
2721 SEM_FN_NAME (iq2000bf,rb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2723 #define FLD(f) abuf->fields.sfmt_empty.f
2724 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2725 int UNUSED written = 0;
2726 IADDR UNUSED pc = abuf->addr;
2727 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2729 ((void) 0); /*nop*/
2731 return vpc;
2732 #undef FLD
2735 /* rbr1: rbr1 $rt,$_index,$count */
2737 static SEM_PC
2738 SEM_FN_NAME (iq2000bf,rbr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2740 #define FLD(f) abuf->fields.sfmt_empty.f
2741 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2742 int UNUSED written = 0;
2743 IADDR UNUSED pc = abuf->addr;
2744 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2746 ((void) 0); /*nop*/
2748 return vpc;
2749 #undef FLD
2752 /* rbr30: rbr30 $rt,$_index,$count */
2754 static SEM_PC
2755 SEM_FN_NAME (iq2000bf,rbr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2757 #define FLD(f) abuf->fields.sfmt_empty.f
2758 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2759 int UNUSED written = 0;
2760 IADDR UNUSED pc = abuf->addr;
2761 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2763 ((void) 0); /*nop*/
2765 return vpc;
2766 #undef FLD
2769 /* rfe: rfe */
2771 static SEM_PC
2772 SEM_FN_NAME (iq2000bf,rfe) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2774 #define FLD(f) abuf->fields.sfmt_empty.f
2775 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2776 int UNUSED written = 0;
2777 IADDR UNUSED pc = abuf->addr;
2778 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2780 ((void) 0); /*nop*/
2782 return vpc;
2783 #undef FLD
2786 /* rx: rx $rd,$rt */
2788 static SEM_PC
2789 SEM_FN_NAME (iq2000bf,rx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2791 #define FLD(f) abuf->fields.sfmt_empty.f
2792 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2793 int UNUSED written = 0;
2794 IADDR UNUSED pc = abuf->addr;
2795 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2797 ((void) 0); /*nop*/
2799 return vpc;
2800 #undef FLD
2803 /* rxr1: rxr1 $rt,$_index,$count */
2805 static SEM_PC
2806 SEM_FN_NAME (iq2000bf,rxr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2808 #define FLD(f) abuf->fields.sfmt_empty.f
2809 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2810 int UNUSED written = 0;
2811 IADDR UNUSED pc = abuf->addr;
2812 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2814 ((void) 0); /*nop*/
2816 return vpc;
2817 #undef FLD
2820 /* rxr30: rxr30 $rt,$_index,$count */
2822 static SEM_PC
2823 SEM_FN_NAME (iq2000bf,rxr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2825 #define FLD(f) abuf->fields.sfmt_empty.f
2826 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2827 int UNUSED written = 0;
2828 IADDR UNUSED pc = abuf->addr;
2829 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2831 ((void) 0); /*nop*/
2833 return vpc;
2834 #undef FLD
2837 /* sleep: sleep */
2839 static SEM_PC
2840 SEM_FN_NAME (iq2000bf,sleep) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2842 #define FLD(f) abuf->fields.sfmt_empty.f
2843 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2844 int UNUSED written = 0;
2845 IADDR UNUSED pc = abuf->addr;
2846 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2848 ((void) 0); /*nop*/
2850 return vpc;
2851 #undef FLD
2854 /* srrd: srrd $rt */
2856 static SEM_PC
2857 SEM_FN_NAME (iq2000bf,srrd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2859 #define FLD(f) abuf->fields.sfmt_empty.f
2860 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2861 int UNUSED written = 0;
2862 IADDR UNUSED pc = abuf->addr;
2863 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2865 ((void) 0); /*nop*/
2867 return vpc;
2868 #undef FLD
2871 /* srrdl: srrdl $rt */
2873 static SEM_PC
2874 SEM_FN_NAME (iq2000bf,srrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2876 #define FLD(f) abuf->fields.sfmt_empty.f
2877 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2878 int UNUSED written = 0;
2879 IADDR UNUSED pc = abuf->addr;
2880 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2882 ((void) 0); /*nop*/
2884 return vpc;
2885 #undef FLD
2888 /* srulck: srulck $rt */
2890 static SEM_PC
2891 SEM_FN_NAME (iq2000bf,srulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2893 #define FLD(f) abuf->fields.sfmt_empty.f
2894 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2895 int UNUSED written = 0;
2896 IADDR UNUSED pc = abuf->addr;
2897 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2899 ((void) 0); /*nop*/
2901 return vpc;
2902 #undef FLD
2905 /* srwr: srwr $rt,$rd */
2907 static SEM_PC
2908 SEM_FN_NAME (iq2000bf,srwr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2910 #define FLD(f) abuf->fields.sfmt_empty.f
2911 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2912 int UNUSED written = 0;
2913 IADDR UNUSED pc = abuf->addr;
2914 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2916 ((void) 0); /*nop*/
2918 return vpc;
2919 #undef FLD
2922 /* srwru: srwru $rt,$rd */
2924 static SEM_PC
2925 SEM_FN_NAME (iq2000bf,srwru) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2927 #define FLD(f) abuf->fields.sfmt_empty.f
2928 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2929 int UNUSED written = 0;
2930 IADDR UNUSED pc = abuf->addr;
2931 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2933 ((void) 0); /*nop*/
2935 return vpc;
2936 #undef FLD
2939 /* trapqfl: trapqfl */
2941 static SEM_PC
2942 SEM_FN_NAME (iq2000bf,trapqfl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2944 #define FLD(f) abuf->fields.sfmt_empty.f
2945 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2946 int UNUSED written = 0;
2947 IADDR UNUSED pc = abuf->addr;
2948 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2950 ((void) 0); /*nop*/
2952 return vpc;
2953 #undef FLD
2956 /* trapqne: trapqne */
2958 static SEM_PC
2959 SEM_FN_NAME (iq2000bf,trapqne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2961 #define FLD(f) abuf->fields.sfmt_empty.f
2962 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2963 int UNUSED written = 0;
2964 IADDR UNUSED pc = abuf->addr;
2965 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2967 ((void) 0); /*nop*/
2969 return vpc;
2970 #undef FLD
2973 /* traprel: traprel $rt */
2975 static SEM_PC
2976 SEM_FN_NAME (iq2000bf,traprel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2978 #define FLD(f) abuf->fields.sfmt_empty.f
2979 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2980 int UNUSED written = 0;
2981 IADDR UNUSED pc = abuf->addr;
2982 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2984 ((void) 0); /*nop*/
2986 return vpc;
2987 #undef FLD
2990 /* wb: wb $rd,$rt */
2992 static SEM_PC
2993 SEM_FN_NAME (iq2000bf,wb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2995 #define FLD(f) abuf->fields.sfmt_empty.f
2996 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2997 int UNUSED written = 0;
2998 IADDR UNUSED pc = abuf->addr;
2999 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3001 ((void) 0); /*nop*/
3003 return vpc;
3004 #undef FLD
3007 /* wbu: wbu $rd,$rt */
3009 static SEM_PC
3010 SEM_FN_NAME (iq2000bf,wbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3012 #define FLD(f) abuf->fields.sfmt_empty.f
3013 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3014 int UNUSED written = 0;
3015 IADDR UNUSED pc = abuf->addr;
3016 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3018 ((void) 0); /*nop*/
3020 return vpc;
3021 #undef FLD
3024 /* wbr1: wbr1 $rt,$_index,$count */
3026 static SEM_PC
3027 SEM_FN_NAME (iq2000bf,wbr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3029 #define FLD(f) abuf->fields.sfmt_empty.f
3030 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3031 int UNUSED written = 0;
3032 IADDR UNUSED pc = abuf->addr;
3033 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3035 ((void) 0); /*nop*/
3037 return vpc;
3038 #undef FLD
3041 /* wbr1u: wbr1u $rt,$_index,$count */
3043 static SEM_PC
3044 SEM_FN_NAME (iq2000bf,wbr1u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3046 #define FLD(f) abuf->fields.sfmt_empty.f
3047 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3048 int UNUSED written = 0;
3049 IADDR UNUSED pc = abuf->addr;
3050 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3052 ((void) 0); /*nop*/
3054 return vpc;
3055 #undef FLD
3058 /* wbr30: wbr30 $rt,$_index,$count */
3060 static SEM_PC
3061 SEM_FN_NAME (iq2000bf,wbr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3063 #define FLD(f) abuf->fields.sfmt_empty.f
3064 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3065 int UNUSED written = 0;
3066 IADDR UNUSED pc = abuf->addr;
3067 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3069 ((void) 0); /*nop*/
3071 return vpc;
3072 #undef FLD
3075 /* wbr30u: wbr30u $rt,$_index,$count */
3077 static SEM_PC
3078 SEM_FN_NAME (iq2000bf,wbr30u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3080 #define FLD(f) abuf->fields.sfmt_empty.f
3081 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3082 int UNUSED written = 0;
3083 IADDR UNUSED pc = abuf->addr;
3084 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3086 ((void) 0); /*nop*/
3088 return vpc;
3089 #undef FLD
3092 /* wx: wx $rd,$rt */
3094 static SEM_PC
3095 SEM_FN_NAME (iq2000bf,wx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3097 #define FLD(f) abuf->fields.sfmt_empty.f
3098 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3099 int UNUSED written = 0;
3100 IADDR UNUSED pc = abuf->addr;
3101 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3103 ((void) 0); /*nop*/
3105 return vpc;
3106 #undef FLD
3109 /* wxu: wxu $rd,$rt */
3111 static SEM_PC
3112 SEM_FN_NAME (iq2000bf,wxu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3114 #define FLD(f) abuf->fields.sfmt_empty.f
3115 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3116 int UNUSED written = 0;
3117 IADDR UNUSED pc = abuf->addr;
3118 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3120 ((void) 0); /*nop*/
3122 return vpc;
3123 #undef FLD
3126 /* wxr1: wxr1 $rt,$_index,$count */
3128 static SEM_PC
3129 SEM_FN_NAME (iq2000bf,wxr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3131 #define FLD(f) abuf->fields.sfmt_empty.f
3132 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3133 int UNUSED written = 0;
3134 IADDR UNUSED pc = abuf->addr;
3135 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3137 ((void) 0); /*nop*/
3139 return vpc;
3140 #undef FLD
3143 /* wxr1u: wxr1u $rt,$_index,$count */
3145 static SEM_PC
3146 SEM_FN_NAME (iq2000bf,wxr1u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3148 #define FLD(f) abuf->fields.sfmt_empty.f
3149 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3150 int UNUSED written = 0;
3151 IADDR UNUSED pc = abuf->addr;
3152 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3154 ((void) 0); /*nop*/
3156 return vpc;
3157 #undef FLD
3160 /* wxr30: wxr30 $rt,$_index,$count */
3162 static SEM_PC
3163 SEM_FN_NAME (iq2000bf,wxr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3165 #define FLD(f) abuf->fields.sfmt_empty.f
3166 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3167 int UNUSED written = 0;
3168 IADDR UNUSED pc = abuf->addr;
3169 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3171 ((void) 0); /*nop*/
3173 return vpc;
3174 #undef FLD
3177 /* wxr30u: wxr30u $rt,$_index,$count */
3179 static SEM_PC
3180 SEM_FN_NAME (iq2000bf,wxr30u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3182 #define FLD(f) abuf->fields.sfmt_empty.f
3183 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3184 int UNUSED written = 0;
3185 IADDR UNUSED pc = abuf->addr;
3186 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3188 ((void) 0); /*nop*/
3190 return vpc;
3191 #undef FLD
3194 /* ldw: ldw $rt,$lo16($base) */
3196 static SEM_PC
3197 SEM_FN_NAME (iq2000bf,ldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3199 #define FLD(f) abuf->fields.sfmt_addi.f
3200 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3201 int UNUSED written = 0;
3202 IADDR UNUSED pc = abuf->addr;
3203 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3206 SI tmp_addr;
3207 tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3209 SI opval = GETMEMSI (current_cpu, pc, tmp_addr);
3210 SET_H_GR (ADDSI (FLD (f_rt), 1), opval);
3211 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3214 SI opval = GETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4));
3215 SET_H_GR (FLD (f_rt), opval);
3216 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3220 return vpc;
3221 #undef FLD
3224 /* sdw: sdw $rt,$lo16($base) */
3226 static SEM_PC
3227 SEM_FN_NAME (iq2000bf,sdw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3229 #define FLD(f) abuf->fields.sfmt_addi.f
3230 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3231 int UNUSED written = 0;
3232 IADDR UNUSED pc = abuf->addr;
3233 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3236 SI tmp_addr;
3237 tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3239 SI opval = GET_H_GR (FLD (f_rt));
3240 SETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4), opval);
3241 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3244 SI opval = GET_H_GR (ADDSI (FLD (f_rt), 1));
3245 SETMEMSI (current_cpu, pc, tmp_addr, opval);
3246 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3250 return vpc;
3251 #undef FLD
3254 /* j: j $jmptarg */
3256 static SEM_PC
3257 SEM_FN_NAME (iq2000bf,j) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3259 #define FLD(f) abuf->fields.sfmt_j.f
3260 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3261 int UNUSED written = 0;
3262 IADDR UNUSED pc = abuf->addr;
3263 SEM_BRANCH_INIT
3264 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3268 USI opval = FLD (i_jmptarg);
3269 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3270 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3274 SEM_BRANCH_FINI (vpc);
3275 return vpc;
3276 #undef FLD
3279 /* jal: jal $jmptarg */
3281 static SEM_PC
3282 SEM_FN_NAME (iq2000bf,jal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3284 #define FLD(f) abuf->fields.sfmt_j.f
3285 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3286 int UNUSED written = 0;
3287 IADDR UNUSED pc = abuf->addr;
3288 SEM_BRANCH_INIT
3289 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3294 SI opval = ADDSI (pc, 8);
3295 SET_H_GR (((UINT) 31), opval);
3296 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3299 USI opval = FLD (i_jmptarg);
3300 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3301 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3306 SEM_BRANCH_FINI (vpc);
3307 return vpc;
3308 #undef FLD
3311 /* bmb: bmb $rs,$rt,$offset */
3313 static SEM_PC
3314 SEM_FN_NAME (iq2000bf,bmb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3316 #define FLD(f) abuf->fields.sfmt_bbi.f
3317 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3318 int UNUSED written = 0;
3319 IADDR UNUSED pc = abuf->addr;
3320 SEM_BRANCH_INIT
3321 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3324 BI tmp_branch_;
3325 tmp_branch_ = 0;
3326 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
3327 tmp_branch_ = 1;
3329 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
3330 tmp_branch_ = 1;
3332 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
3333 tmp_branch_ = 1;
3335 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
3336 tmp_branch_ = 1;
3338 if (tmp_branch_) {
3341 USI opval = FLD (i_offset);
3342 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3343 written |= (1 << 3);
3344 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3350 abuf->written = written;
3351 SEM_BRANCH_FINI (vpc);
3352 return vpc;
3353 #undef FLD
3356 /* Table of all semantic fns. */
3358 static const struct sem_fn_desc sem_fns[] = {
3359 { IQ2000BF_INSN_X_INVALID, SEM_FN_NAME (iq2000bf,x_invalid) },
3360 { IQ2000BF_INSN_X_AFTER, SEM_FN_NAME (iq2000bf,x_after) },
3361 { IQ2000BF_INSN_X_BEFORE, SEM_FN_NAME (iq2000bf,x_before) },
3362 { IQ2000BF_INSN_X_CTI_CHAIN, SEM_FN_NAME (iq2000bf,x_cti_chain) },
3363 { IQ2000BF_INSN_X_CHAIN, SEM_FN_NAME (iq2000bf,x_chain) },
3364 { IQ2000BF_INSN_X_BEGIN, SEM_FN_NAME (iq2000bf,x_begin) },
3365 { IQ2000BF_INSN_ADD, SEM_FN_NAME (iq2000bf,add) },
3366 { IQ2000BF_INSN_ADDI, SEM_FN_NAME (iq2000bf,addi) },
3367 { IQ2000BF_INSN_ADDIU, SEM_FN_NAME (iq2000bf,addiu) },
3368 { IQ2000BF_INSN_ADDU, SEM_FN_NAME (iq2000bf,addu) },
3369 { IQ2000BF_INSN_ADO16, SEM_FN_NAME (iq2000bf,ado16) },
3370 { IQ2000BF_INSN_AND, SEM_FN_NAME (iq2000bf,and) },
3371 { IQ2000BF_INSN_ANDI, SEM_FN_NAME (iq2000bf,andi) },
3372 { IQ2000BF_INSN_ANDOI, SEM_FN_NAME (iq2000bf,andoi) },
3373 { IQ2000BF_INSN_NOR, SEM_FN_NAME (iq2000bf,nor) },
3374 { IQ2000BF_INSN_OR, SEM_FN_NAME (iq2000bf,or) },
3375 { IQ2000BF_INSN_ORI, SEM_FN_NAME (iq2000bf,ori) },
3376 { IQ2000BF_INSN_RAM, SEM_FN_NAME (iq2000bf,ram) },
3377 { IQ2000BF_INSN_SLL, SEM_FN_NAME (iq2000bf,sll) },
3378 { IQ2000BF_INSN_SLLV, SEM_FN_NAME (iq2000bf,sllv) },
3379 { IQ2000BF_INSN_SLMV, SEM_FN_NAME (iq2000bf,slmv) },
3380 { IQ2000BF_INSN_SLT, SEM_FN_NAME (iq2000bf,slt) },
3381 { IQ2000BF_INSN_SLTI, SEM_FN_NAME (iq2000bf,slti) },
3382 { IQ2000BF_INSN_SLTIU, SEM_FN_NAME (iq2000bf,sltiu) },
3383 { IQ2000BF_INSN_SLTU, SEM_FN_NAME (iq2000bf,sltu) },
3384 { IQ2000BF_INSN_SRA, SEM_FN_NAME (iq2000bf,sra) },
3385 { IQ2000BF_INSN_SRAV, SEM_FN_NAME (iq2000bf,srav) },
3386 { IQ2000BF_INSN_SRL, SEM_FN_NAME (iq2000bf,srl) },
3387 { IQ2000BF_INSN_SRLV, SEM_FN_NAME (iq2000bf,srlv) },
3388 { IQ2000BF_INSN_SRMV, SEM_FN_NAME (iq2000bf,srmv) },
3389 { IQ2000BF_INSN_SUB, SEM_FN_NAME (iq2000bf,sub) },
3390 { IQ2000BF_INSN_SUBU, SEM_FN_NAME (iq2000bf,subu) },
3391 { IQ2000BF_INSN_XOR, SEM_FN_NAME (iq2000bf,xor) },
3392 { IQ2000BF_INSN_XORI, SEM_FN_NAME (iq2000bf,xori) },
3393 { IQ2000BF_INSN_BBI, SEM_FN_NAME (iq2000bf,bbi) },
3394 { IQ2000BF_INSN_BBIN, SEM_FN_NAME (iq2000bf,bbin) },
3395 { IQ2000BF_INSN_BBV, SEM_FN_NAME (iq2000bf,bbv) },
3396 { IQ2000BF_INSN_BBVN, SEM_FN_NAME (iq2000bf,bbvn) },
3397 { IQ2000BF_INSN_BEQ, SEM_FN_NAME (iq2000bf,beq) },
3398 { IQ2000BF_INSN_BEQL, SEM_FN_NAME (iq2000bf,beql) },
3399 { IQ2000BF_INSN_BGEZ, SEM_FN_NAME (iq2000bf,bgez) },
3400 { IQ2000BF_INSN_BGEZAL, SEM_FN_NAME (iq2000bf,bgezal) },
3401 { IQ2000BF_INSN_BGEZALL, SEM_FN_NAME (iq2000bf,bgezall) },
3402 { IQ2000BF_INSN_BGEZL, SEM_FN_NAME (iq2000bf,bgezl) },
3403 { IQ2000BF_INSN_BLTZ, SEM_FN_NAME (iq2000bf,bltz) },
3404 { IQ2000BF_INSN_BLTZL, SEM_FN_NAME (iq2000bf,bltzl) },
3405 { IQ2000BF_INSN_BLTZAL, SEM_FN_NAME (iq2000bf,bltzal) },
3406 { IQ2000BF_INSN_BLTZALL, SEM_FN_NAME (iq2000bf,bltzall) },
3407 { IQ2000BF_INSN_BMB0, SEM_FN_NAME (iq2000bf,bmb0) },
3408 { IQ2000BF_INSN_BMB1, SEM_FN_NAME (iq2000bf,bmb1) },
3409 { IQ2000BF_INSN_BMB2, SEM_FN_NAME (iq2000bf,bmb2) },
3410 { IQ2000BF_INSN_BMB3, SEM_FN_NAME (iq2000bf,bmb3) },
3411 { IQ2000BF_INSN_BNE, SEM_FN_NAME (iq2000bf,bne) },
3412 { IQ2000BF_INSN_BNEL, SEM_FN_NAME (iq2000bf,bnel) },
3413 { IQ2000BF_INSN_JALR, SEM_FN_NAME (iq2000bf,jalr) },
3414 { IQ2000BF_INSN_JR, SEM_FN_NAME (iq2000bf,jr) },
3415 { IQ2000BF_INSN_LB, SEM_FN_NAME (iq2000bf,lb) },
3416 { IQ2000BF_INSN_LBU, SEM_FN_NAME (iq2000bf,lbu) },
3417 { IQ2000BF_INSN_LH, SEM_FN_NAME (iq2000bf,lh) },
3418 { IQ2000BF_INSN_LHU, SEM_FN_NAME (iq2000bf,lhu) },
3419 { IQ2000BF_INSN_LUI, SEM_FN_NAME (iq2000bf,lui) },
3420 { IQ2000BF_INSN_LW, SEM_FN_NAME (iq2000bf,lw) },
3421 { IQ2000BF_INSN_SB, SEM_FN_NAME (iq2000bf,sb) },
3422 { IQ2000BF_INSN_SH, SEM_FN_NAME (iq2000bf,sh) },
3423 { IQ2000BF_INSN_SW, SEM_FN_NAME (iq2000bf,sw) },
3424 { IQ2000BF_INSN_BREAK, SEM_FN_NAME (iq2000bf,break) },
3425 { IQ2000BF_INSN_SYSCALL, SEM_FN_NAME (iq2000bf,syscall) },
3426 { IQ2000BF_INSN_ANDOUI, SEM_FN_NAME (iq2000bf,andoui) },
3427 { IQ2000BF_INSN_ORUI, SEM_FN_NAME (iq2000bf,orui) },
3428 { IQ2000BF_INSN_BGTZ, SEM_FN_NAME (iq2000bf,bgtz) },
3429 { IQ2000BF_INSN_BGTZL, SEM_FN_NAME (iq2000bf,bgtzl) },
3430 { IQ2000BF_INSN_BLEZ, SEM_FN_NAME (iq2000bf,blez) },
3431 { IQ2000BF_INSN_BLEZL, SEM_FN_NAME (iq2000bf,blezl) },
3432 { IQ2000BF_INSN_MRGB, SEM_FN_NAME (iq2000bf,mrgb) },
3433 { IQ2000BF_INSN_BCTXT, SEM_FN_NAME (iq2000bf,bctxt) },
3434 { IQ2000BF_INSN_BC0F, SEM_FN_NAME (iq2000bf,bc0f) },
3435 { IQ2000BF_INSN_BC0FL, SEM_FN_NAME (iq2000bf,bc0fl) },
3436 { IQ2000BF_INSN_BC3F, SEM_FN_NAME (iq2000bf,bc3f) },
3437 { IQ2000BF_INSN_BC3FL, SEM_FN_NAME (iq2000bf,bc3fl) },
3438 { IQ2000BF_INSN_BC0T, SEM_FN_NAME (iq2000bf,bc0t) },
3439 { IQ2000BF_INSN_BC0TL, SEM_FN_NAME (iq2000bf,bc0tl) },
3440 { IQ2000BF_INSN_BC3T, SEM_FN_NAME (iq2000bf,bc3t) },
3441 { IQ2000BF_INSN_BC3TL, SEM_FN_NAME (iq2000bf,bc3tl) },
3442 { IQ2000BF_INSN_CFC0, SEM_FN_NAME (iq2000bf,cfc0) },
3443 { IQ2000BF_INSN_CFC1, SEM_FN_NAME (iq2000bf,cfc1) },
3444 { IQ2000BF_INSN_CFC2, SEM_FN_NAME (iq2000bf,cfc2) },
3445 { IQ2000BF_INSN_CFC3, SEM_FN_NAME (iq2000bf,cfc3) },
3446 { IQ2000BF_INSN_CHKHDR, SEM_FN_NAME (iq2000bf,chkhdr) },
3447 { IQ2000BF_INSN_CTC0, SEM_FN_NAME (iq2000bf,ctc0) },
3448 { IQ2000BF_INSN_CTC1, SEM_FN_NAME (iq2000bf,ctc1) },
3449 { IQ2000BF_INSN_CTC2, SEM_FN_NAME (iq2000bf,ctc2) },
3450 { IQ2000BF_INSN_CTC3, SEM_FN_NAME (iq2000bf,ctc3) },
3451 { IQ2000BF_INSN_JCR, SEM_FN_NAME (iq2000bf,jcr) },
3452 { IQ2000BF_INSN_LUC32, SEM_FN_NAME (iq2000bf,luc32) },
3453 { IQ2000BF_INSN_LUC32L, SEM_FN_NAME (iq2000bf,luc32l) },
3454 { IQ2000BF_INSN_LUC64, SEM_FN_NAME (iq2000bf,luc64) },
3455 { IQ2000BF_INSN_LUC64L, SEM_FN_NAME (iq2000bf,luc64l) },
3456 { IQ2000BF_INSN_LUK, SEM_FN_NAME (iq2000bf,luk) },
3457 { IQ2000BF_INSN_LULCK, SEM_FN_NAME (iq2000bf,lulck) },
3458 { IQ2000BF_INSN_LUM32, SEM_FN_NAME (iq2000bf,lum32) },
3459 { IQ2000BF_INSN_LUM32L, SEM_FN_NAME (iq2000bf,lum32l) },
3460 { IQ2000BF_INSN_LUM64, SEM_FN_NAME (iq2000bf,lum64) },
3461 { IQ2000BF_INSN_LUM64L, SEM_FN_NAME (iq2000bf,lum64l) },
3462 { IQ2000BF_INSN_LUR, SEM_FN_NAME (iq2000bf,lur) },
3463 { IQ2000BF_INSN_LURL, SEM_FN_NAME (iq2000bf,lurl) },
3464 { IQ2000BF_INSN_LUULCK, SEM_FN_NAME (iq2000bf,luulck) },
3465 { IQ2000BF_INSN_MFC0, SEM_FN_NAME (iq2000bf,mfc0) },
3466 { IQ2000BF_INSN_MFC1, SEM_FN_NAME (iq2000bf,mfc1) },
3467 { IQ2000BF_INSN_MFC2, SEM_FN_NAME (iq2000bf,mfc2) },
3468 { IQ2000BF_INSN_MFC3, SEM_FN_NAME (iq2000bf,mfc3) },
3469 { IQ2000BF_INSN_MTC0, SEM_FN_NAME (iq2000bf,mtc0) },
3470 { IQ2000BF_INSN_MTC1, SEM_FN_NAME (iq2000bf,mtc1) },
3471 { IQ2000BF_INSN_MTC2, SEM_FN_NAME (iq2000bf,mtc2) },
3472 { IQ2000BF_INSN_MTC3, SEM_FN_NAME (iq2000bf,mtc3) },
3473 { IQ2000BF_INSN_PKRL, SEM_FN_NAME (iq2000bf,pkrl) },
3474 { IQ2000BF_INSN_PKRLR1, SEM_FN_NAME (iq2000bf,pkrlr1) },
3475 { IQ2000BF_INSN_PKRLR30, SEM_FN_NAME (iq2000bf,pkrlr30) },
3476 { IQ2000BF_INSN_RB, SEM_FN_NAME (iq2000bf,rb) },
3477 { IQ2000BF_INSN_RBR1, SEM_FN_NAME (iq2000bf,rbr1) },
3478 { IQ2000BF_INSN_RBR30, SEM_FN_NAME (iq2000bf,rbr30) },
3479 { IQ2000BF_INSN_RFE, SEM_FN_NAME (iq2000bf,rfe) },
3480 { IQ2000BF_INSN_RX, SEM_FN_NAME (iq2000bf,rx) },
3481 { IQ2000BF_INSN_RXR1, SEM_FN_NAME (iq2000bf,rxr1) },
3482 { IQ2000BF_INSN_RXR30, SEM_FN_NAME (iq2000bf,rxr30) },
3483 { IQ2000BF_INSN_SLEEP, SEM_FN_NAME (iq2000bf,sleep) },
3484 { IQ2000BF_INSN_SRRD, SEM_FN_NAME (iq2000bf,srrd) },
3485 { IQ2000BF_INSN_SRRDL, SEM_FN_NAME (iq2000bf,srrdl) },
3486 { IQ2000BF_INSN_SRULCK, SEM_FN_NAME (iq2000bf,srulck) },
3487 { IQ2000BF_INSN_SRWR, SEM_FN_NAME (iq2000bf,srwr) },
3488 { IQ2000BF_INSN_SRWRU, SEM_FN_NAME (iq2000bf,srwru) },
3489 { IQ2000BF_INSN_TRAPQFL, SEM_FN_NAME (iq2000bf,trapqfl) },
3490 { IQ2000BF_INSN_TRAPQNE, SEM_FN_NAME (iq2000bf,trapqne) },
3491 { IQ2000BF_INSN_TRAPREL, SEM_FN_NAME (iq2000bf,traprel) },
3492 { IQ2000BF_INSN_WB, SEM_FN_NAME (iq2000bf,wb) },
3493 { IQ2000BF_INSN_WBU, SEM_FN_NAME (iq2000bf,wbu) },
3494 { IQ2000BF_INSN_WBR1, SEM_FN_NAME (iq2000bf,wbr1) },
3495 { IQ2000BF_INSN_WBR1U, SEM_FN_NAME (iq2000bf,wbr1u) },
3496 { IQ2000BF_INSN_WBR30, SEM_FN_NAME (iq2000bf,wbr30) },
3497 { IQ2000BF_INSN_WBR30U, SEM_FN_NAME (iq2000bf,wbr30u) },
3498 { IQ2000BF_INSN_WX, SEM_FN_NAME (iq2000bf,wx) },
3499 { IQ2000BF_INSN_WXU, SEM_FN_NAME (iq2000bf,wxu) },
3500 { IQ2000BF_INSN_WXR1, SEM_FN_NAME (iq2000bf,wxr1) },
3501 { IQ2000BF_INSN_WXR1U, SEM_FN_NAME (iq2000bf,wxr1u) },
3502 { IQ2000BF_INSN_WXR30, SEM_FN_NAME (iq2000bf,wxr30) },
3503 { IQ2000BF_INSN_WXR30U, SEM_FN_NAME (iq2000bf,wxr30u) },
3504 { IQ2000BF_INSN_LDW, SEM_FN_NAME (iq2000bf,ldw) },
3505 { IQ2000BF_INSN_SDW, SEM_FN_NAME (iq2000bf,sdw) },
3506 { IQ2000BF_INSN_J, SEM_FN_NAME (iq2000bf,j) },
3507 { IQ2000BF_INSN_JAL, SEM_FN_NAME (iq2000bf,jal) },
3508 { IQ2000BF_INSN_BMB, SEM_FN_NAME (iq2000bf,bmb) },
3509 { 0, 0 }
3512 /* Add the semantic fns to IDESC_TABLE. */
3514 void
3515 SEM_FN_NAME (iq2000bf,init_idesc_table) (SIM_CPU *current_cpu)
3517 IDESC *idesc_table = CPU_IDESC (current_cpu);
3518 const struct sem_fn_desc *sf;
3519 int mach_num = MACH_NUM (CPU_MACH (current_cpu));
3521 for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
3523 const CGEN_INSN *insn = idesc_table[sf->index].idata;
3524 int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
3525 || CGEN_INSN_MACH_HAS_P (insn, mach_num));
3526 #if FAST_P
3527 if (valid_p)
3528 idesc_table[sf->index].sem_fast = sf->fn;
3529 else
3530 idesc_table[sf->index].sem_fast = SEM_FN_NAME (iq2000bf,x_invalid);
3531 #else
3532 if (valid_p)
3533 idesc_table[sf->index].sem_full = sf->fn;
3534 else
3535 idesc_table[sf->index].sem_full = SEM_FN_NAME (iq2000bf,x_invalid);
3536 #endif