1 /* Simulator instruction semantics for iq2000bf.
2 
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4 
5 Copyright 1996-2013 Free Software Foundation, Inc.
6 
7 This file is part of the GNU simulators.
8 
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.
13 
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.
18 
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/>.
21 
22 */
23 
24 #define WANT_CPU iq2000bf
25 #define WANT_CPU_IQ2000BF
26 
27 #include "sim-main.h"
28 #include "cgen-mem.h"
29 #include "cgen-ops.h"
30 
31 #undef GET_ATTR
32 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
33 
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 TRACE_RESULT
40 #define TRACE_RESULT(cpu, abuf, name, type, val)
41 #else
42 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
43 #endif
44 
45 /* x-invalid: --invalid-- */
46 
47 static SEM_PC
SEM_FN_NAME(iq2000bf,x_invalid)48 SEM_FN_NAME (iq2000bf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
49 {
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);
55 
56   {
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);
66   }
67 
68   return vpc;
69 #undef FLD
70 }
71 
72 /* x-after: --after-- */
73 
74 static SEM_PC
SEM_FN_NAME(iq2000bf,x_after)75 SEM_FN_NAME (iq2000bf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
76 {
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);
82 
83   {
84 #if WITH_SCACHE_PBB_IQ2000BF
85     iq2000bf_pbb_after (current_cpu, sem_arg);
86 #endif
87   }
88 
89   return vpc;
90 #undef FLD
91 }
92 
93 /* x-before: --before-- */
94 
95 static SEM_PC
SEM_FN_NAME(iq2000bf,x_before)96 SEM_FN_NAME (iq2000bf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
97 {
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);
103 
104   {
105 #if WITH_SCACHE_PBB_IQ2000BF
106     iq2000bf_pbb_before (current_cpu, sem_arg);
107 #endif
108   }
109 
110   return vpc;
111 #undef FLD
112 }
113 
114 /* x-cti-chain: --cti-chain-- */
115 
116 static SEM_PC
SEM_FN_NAME(iq2000bf,x_cti_chain)117 SEM_FN_NAME (iq2000bf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
118 {
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);
124 
125   {
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
138   }
139 
140   return vpc;
141 #undef FLD
142 }
143 
144 /* x-chain: --chain-- */
145 
146 static SEM_PC
SEM_FN_NAME(iq2000bf,x_chain)147 SEM_FN_NAME (iq2000bf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
148 {
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);
154 
155   {
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
162   }
163 
164   return vpc;
165 #undef FLD
166 }
167 
168 /* x-begin: --begin-- */
169 
170 static SEM_PC
SEM_FN_NAME(iq2000bf,x_begin)171 SEM_FN_NAME (iq2000bf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
172 {
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);
178 
179   {
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
193   }
194 
195   return vpc;
196 #undef FLD
197 }
198 
199 /* add: add $rd,$rs,$rt */
200 
201 static SEM_PC
SEM_FN_NAME(iq2000bf,add)202 SEM_FN_NAME (iq2000bf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
203 {
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);
209 
210   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
214   }
215 
216   return vpc;
217 #undef FLD
218 }
219 
220 /* addi: addi $rt,$rs,$lo16 */
221 
222 static SEM_PC
SEM_FN_NAME(iq2000bf,addi)223 SEM_FN_NAME (iq2000bf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
224 {
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);
230 
231   {
232     SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
233     SET_H_GR (FLD (f_rt), opval);
234     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
235   }
236 
237   return vpc;
238 #undef FLD
239 }
240 
241 /* addiu: addiu $rt,$rs,$lo16 */
242 
243 static SEM_PC
SEM_FN_NAME(iq2000bf,addiu)244 SEM_FN_NAME (iq2000bf,addiu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
245 {
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);
251 
252   {
253     SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
254     SET_H_GR (FLD (f_rt), opval);
255     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
256   }
257 
258   return vpc;
259 #undef FLD
260 }
261 
262 /* addu: addu $rd,$rs,$rt */
263 
264 static SEM_PC
SEM_FN_NAME(iq2000bf,addu)265 SEM_FN_NAME (iq2000bf,addu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
266 {
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);
272 
273   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
277   }
278 
279   return vpc;
280 #undef FLD
281 }
282 
283 /* ado16: ado16 $rd,$rs,$rt */
284 
285 static SEM_PC
SEM_FN_NAME(iq2000bf,ado16)286 SEM_FN_NAME (iq2000bf,ado16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
287 {
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);
293 
294 {
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));
299   {
300     SI opval = ORSI (SLLSI (tmp_high, 16), tmp_low);
301     SET_H_GR (FLD (f_rd), opval);
302     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
303   }
304 }
305 
306   return vpc;
307 #undef FLD
308 }
309 
310 /* and: and $rd,$rs,$rt */
311 
312 static SEM_PC
SEM_FN_NAME(iq2000bf,and)313 SEM_FN_NAME (iq2000bf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
314 {
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);
320 
321   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
325   }
326 
327   return vpc;
328 #undef FLD
329 }
330 
331 /* andi: andi $rt,$rs,$lo16 */
332 
333 static SEM_PC
SEM_FN_NAME(iq2000bf,andi)334 SEM_FN_NAME (iq2000bf,andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
335 {
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);
341 
342   {
343     SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
344     SET_H_GR (FLD (f_rt), opval);
345     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
346   }
347 
348   return vpc;
349 #undef FLD
350 }
351 
352 /* andoi: andoi $rt,$rs,$lo16 */
353 
354 static SEM_PC
SEM_FN_NAME(iq2000bf,andoi)355 SEM_FN_NAME (iq2000bf,andoi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
356 {
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);
362 
363   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
367   }
368 
369   return vpc;
370 #undef FLD
371 }
372 
373 /* nor: nor $rd,$rs,$rt */
374 
375 static SEM_PC
SEM_FN_NAME(iq2000bf,nor)376 SEM_FN_NAME (iq2000bf,nor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
377 {
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);
383 
384   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
388   }
389 
390   return vpc;
391 #undef FLD
392 }
393 
394 /* or: or $rd,$rs,$rt */
395 
396 static SEM_PC
SEM_FN_NAME(iq2000bf,or)397 SEM_FN_NAME (iq2000bf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
398 {
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);
404 
405   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
409   }
410 
411   return vpc;
412 #undef FLD
413 }
414 
415 /* ori: ori $rt,$rs,$lo16 */
416 
417 static SEM_PC
SEM_FN_NAME(iq2000bf,ori)418 SEM_FN_NAME (iq2000bf,ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
419 {
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);
425 
426   {
427     SI opval = ORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
428     SET_H_GR (FLD (f_rt), opval);
429     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
430   }
431 
432   return vpc;
433 #undef FLD
434 }
435 
436 /* ram: ram $rd,$rt,$shamt,$maskl,$maskr */
437 
438 static SEM_PC
SEM_FN_NAME(iq2000bf,ram)439 SEM_FN_NAME (iq2000bf,ram) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
440 {
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);
446 
447 {
448   {
449     SI opval = RORSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
450     SET_H_GR (FLD (f_rd), opval);
451     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
452   }
453   {
454     SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SRLSI (0xffffffff, FLD (f_maskl)));
455     SET_H_GR (FLD (f_rd), opval);
456     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
457   }
458   {
459     SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SLLSI (0xffffffff, FLD (f_rs)));
460     SET_H_GR (FLD (f_rd), opval);
461     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
462   }
463 }
464 
465   return vpc;
466 #undef FLD
467 }
468 
469 /* sll: sll $rd,$rt,$shamt */
470 
471 static SEM_PC
SEM_FN_NAME(iq2000bf,sll)472 SEM_FN_NAME (iq2000bf,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
473 {
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);
479 
480   {
481     SI opval = SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
482     SET_H_GR (FLD (f_rd), opval);
483     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
484   }
485 
486   return vpc;
487 #undef FLD
488 }
489 
490 /* sllv: sllv $rd,$rt,$rs */
491 
492 static SEM_PC
SEM_FN_NAME(iq2000bf,sllv)493 SEM_FN_NAME (iq2000bf,sllv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
494 {
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);
500 
501   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
505   }
506 
507   return vpc;
508 #undef FLD
509 }
510 
511 /* slmv: slmv $rd,$rt,$rs,$shamt */
512 
513 static SEM_PC
SEM_FN_NAME(iq2000bf,slmv)514 SEM_FN_NAME (iq2000bf,slmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
515 {
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);
521 
522   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
526   }
527 
528   return vpc;
529 #undef FLD
530 }
531 
532 /* slt: slt $rd,$rs,$rt */
533 
534 static SEM_PC
SEM_FN_NAME(iq2000bf,slt)535 SEM_FN_NAME (iq2000bf,slt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
536 {
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);
542 
543 if (LTSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
544   {
545     SI opval = 1;
546     SET_H_GR (FLD (f_rd), opval);
547     written |= (1 << 2);
548     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
549   }
550 } else {
551   {
552     SI opval = 0;
553     SET_H_GR (FLD (f_rd), opval);
554     written |= (1 << 2);
555     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
556   }
557 }
558 
559   abuf->written = written;
560   return vpc;
561 #undef FLD
562 }
563 
564 /* slti: slti $rt,$rs,$imm */
565 
566 static SEM_PC
SEM_FN_NAME(iq2000bf,slti)567 SEM_FN_NAME (iq2000bf,slti) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
568 {
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);
574 
575 if (LTSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
576   {
577     SI opval = 1;
578     SET_H_GR (FLD (f_rt), opval);
579     written |= (1 << 2);
580     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
581   }
582 } else {
583   {
584     SI opval = 0;
585     SET_H_GR (FLD (f_rt), opval);
586     written |= (1 << 2);
587     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
588   }
589 }
590 
591   abuf->written = written;
592   return vpc;
593 #undef FLD
594 }
595 
596 /* sltiu: sltiu $rt,$rs,$imm */
597 
598 static SEM_PC
SEM_FN_NAME(iq2000bf,sltiu)599 SEM_FN_NAME (iq2000bf,sltiu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
600 {
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);
606 
607 if (LTUSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
608   {
609     SI opval = 1;
610     SET_H_GR (FLD (f_rt), opval);
611     written |= (1 << 2);
612     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
613   }
614 } else {
615   {
616     SI opval = 0;
617     SET_H_GR (FLD (f_rt), opval);
618     written |= (1 << 2);
619     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
620   }
621 }
622 
623   abuf->written = written;
624   return vpc;
625 #undef FLD
626 }
627 
628 /* sltu: sltu $rd,$rs,$rt */
629 
630 static SEM_PC
SEM_FN_NAME(iq2000bf,sltu)631 SEM_FN_NAME (iq2000bf,sltu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
632 {
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);
638 
639 if (LTUSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
640   {
641     SI opval = 1;
642     SET_H_GR (FLD (f_rd), opval);
643     written |= (1 << 2);
644     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
645   }
646 } else {
647   {
648     SI opval = 0;
649     SET_H_GR (FLD (f_rd), opval);
650     written |= (1 << 2);
651     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
652   }
653 }
654 
655   abuf->written = written;
656   return vpc;
657 #undef FLD
658 }
659 
660 /* sra: sra $rd,$rt,$shamt */
661 
662 static SEM_PC
SEM_FN_NAME(iq2000bf,sra)663 SEM_FN_NAME (iq2000bf,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
664 {
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);
670 
671   {
672     SI opval = SRASI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
673     SET_H_GR (FLD (f_rd), opval);
674     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
675   }
676 
677   return vpc;
678 #undef FLD
679 }
680 
681 /* srav: srav $rd,$rt,$rs */
682 
683 static SEM_PC
SEM_FN_NAME(iq2000bf,srav)684 SEM_FN_NAME (iq2000bf,srav) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
685 {
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);
691 
692   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
696   }
697 
698   return vpc;
699 #undef FLD
700 }
701 
702 /* srl: srl $rd,$rt,$shamt */
703 
704 static SEM_PC
SEM_FN_NAME(iq2000bf,srl)705 SEM_FN_NAME (iq2000bf,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
706 {
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);
712 
713   {
714     SI opval = SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
715     SET_H_GR (FLD (f_rd), opval);
716     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
717   }
718 
719   return vpc;
720 #undef FLD
721 }
722 
723 /* srlv: srlv $rd,$rt,$rs */
724 
725 static SEM_PC
SEM_FN_NAME(iq2000bf,srlv)726 SEM_FN_NAME (iq2000bf,srlv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
727 {
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);
733 
734   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
738   }
739 
740   return vpc;
741 #undef FLD
742 }
743 
744 /* srmv: srmv $rd,$rt,$rs,$shamt */
745 
746 static SEM_PC
SEM_FN_NAME(iq2000bf,srmv)747 SEM_FN_NAME (iq2000bf,srmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
748 {
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);
754 
755   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
759   }
760 
761   return vpc;
762 #undef FLD
763 }
764 
765 /* sub: sub $rd,$rs,$rt */
766 
767 static SEM_PC
SEM_FN_NAME(iq2000bf,sub)768 SEM_FN_NAME (iq2000bf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
769 {
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);
775 
776   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
780   }
781 
782   return vpc;
783 #undef FLD
784 }
785 
786 /* subu: subu $rd,$rs,$rt */
787 
788 static SEM_PC
SEM_FN_NAME(iq2000bf,subu)789 SEM_FN_NAME (iq2000bf,subu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
790 {
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);
796 
797   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
801   }
802 
803   return vpc;
804 #undef FLD
805 }
806 
807 /* xor: xor $rd,$rs,$rt */
808 
809 static SEM_PC
SEM_FN_NAME(iq2000bf,xor)810 SEM_FN_NAME (iq2000bf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
811 {
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);
817 
818   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
822   }
823 
824   return vpc;
825 #undef FLD
826 }
827 
828 /* xori: xori $rt,$rs,$lo16 */
829 
830 static SEM_PC
SEM_FN_NAME(iq2000bf,xori)831 SEM_FN_NAME (iq2000bf,xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
832 {
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);
838 
839   {
840     SI opval = XORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
841     SET_H_GR (FLD (f_rt), opval);
842     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
843   }
844 
845   return vpc;
846 #undef FLD
847 }
848 
849 /* bbi: bbi $rs($bitnum),$offset */
850 
851 static SEM_PC
SEM_FN_NAME(iq2000bf,bbi)852 SEM_FN_NAME (iq2000bf,bbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
853 {
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);
860 
861 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt)))) {
862 {
863   {
864     USI opval = FLD (i_offset);
865     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
866     written |= (1 << 3);
867     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
868   }
869 }
870 }
871 
872   abuf->written = written;
873   SEM_BRANCH_FINI (vpc);
874   return vpc;
875 #undef FLD
876 }
877 
878 /* bbin: bbin $rs($bitnum),$offset */
879 
880 static SEM_PC
SEM_FN_NAME(iq2000bf,bbin)881 SEM_FN_NAME (iq2000bf,bbin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
882 {
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);
889 
890 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt))))) {
891 {
892   {
893     USI opval = FLD (i_offset);
894     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
895     written |= (1 << 3);
896     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
897   }
898 }
899 }
900 
901   abuf->written = written;
902   SEM_BRANCH_FINI (vpc);
903   return vpc;
904 #undef FLD
905 }
906 
907 /* bbv: bbv $rs,$rt,$offset */
908 
909 static SEM_PC
SEM_FN_NAME(iq2000bf,bbv)910 SEM_FN_NAME (iq2000bf,bbv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
911 {
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);
918 
919 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31)))) {
920 {
921   {
922     USI opval = FLD (i_offset);
923     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
924     written |= (1 << 3);
925     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
926   }
927 }
928 }
929 
930   abuf->written = written;
931   SEM_BRANCH_FINI (vpc);
932   return vpc;
933 #undef FLD
934 }
935 
936 /* bbvn: bbvn $rs,$rt,$offset */
937 
938 static SEM_PC
SEM_FN_NAME(iq2000bf,bbvn)939 SEM_FN_NAME (iq2000bf,bbvn) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
940 {
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);
947 
948 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31))))) {
949 {
950   {
951     USI opval = FLD (i_offset);
952     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
953     written |= (1 << 3);
954     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
955   }
956 }
957 }
958 
959   abuf->written = written;
960   SEM_BRANCH_FINI (vpc);
961   return vpc;
962 #undef FLD
963 }
964 
965 /* beq: beq $rs,$rt,$offset */
966 
967 static SEM_PC
SEM_FN_NAME(iq2000bf,beq)968 SEM_FN_NAME (iq2000bf,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
969 {
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);
976 
977 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
978 {
979   {
980     USI opval = FLD (i_offset);
981     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
982     written |= (1 << 3);
983     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
984   }
985 }
986 }
987 
988   abuf->written = written;
989   SEM_BRANCH_FINI (vpc);
990   return vpc;
991 #undef FLD
992 }
993 
994 /* beql: beql $rs,$rt,$offset */
995 
996 static SEM_PC
SEM_FN_NAME(iq2000bf,beql)997 SEM_FN_NAME (iq2000bf,beql) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
998 {
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);
1005 
1006 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1007 {
1008   {
1009     USI opval = FLD (i_offset);
1010     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1011     written |= (1 << 3);
1012     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1013   }
1014 }
1015 } else {
1016 if (1)
1017   SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1018 }
1019 
1020   abuf->written = written;
1021   SEM_BRANCH_FINI (vpc);
1022   return vpc;
1023 #undef FLD
1024 }
1025 
1026 /* bgez: bgez $rs,$offset */
1027 
1028 static SEM_PC
SEM_FN_NAME(iq2000bf,bgez)1029 SEM_FN_NAME (iq2000bf,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1030 {
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);
1037 
1038 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1039 {
1040   {
1041     USI opval = FLD (i_offset);
1042     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1043     written |= (1 << 2);
1044     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1045   }
1046 }
1047 }
1048 
1049   abuf->written = written;
1050   SEM_BRANCH_FINI (vpc);
1051   return vpc;
1052 #undef FLD
1053 }
1054 
1055 /* bgezal: bgezal $rs,$offset */
1056 
1057 static SEM_PC
SEM_FN_NAME(iq2000bf,bgezal)1058 SEM_FN_NAME (iq2000bf,bgezal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1059 {
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);
1066 
1067 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1068 {
1069   {
1070     SI opval = ADDSI (pc, 8);
1071     SET_H_GR (((UINT) 31), opval);
1072     written |= (1 << 3);
1073     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1074   }
1075 {
1076   {
1077     USI opval = FLD (i_offset);
1078     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1079     written |= (1 << 4);
1080     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1081   }
1082 }
1083 }
1084 }
1085 
1086   abuf->written = written;
1087   SEM_BRANCH_FINI (vpc);
1088   return vpc;
1089 #undef FLD
1090 }
1091 
1092 /* bgezall: bgezall $rs,$offset */
1093 
1094 static SEM_PC
SEM_FN_NAME(iq2000bf,bgezall)1095 SEM_FN_NAME (iq2000bf,bgezall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1096 {
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);
1103 
1104 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1105 {
1106   {
1107     SI opval = ADDSI (pc, 8);
1108     SET_H_GR (((UINT) 31), opval);
1109     written |= (1 << 3);
1110     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1111   }
1112 {
1113   {
1114     USI opval = FLD (i_offset);
1115     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1116     written |= (1 << 4);
1117     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1118   }
1119 }
1120 }
1121 } else {
1122 if (1)
1123   SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1124 }
1125 
1126   abuf->written = written;
1127   SEM_BRANCH_FINI (vpc);
1128   return vpc;
1129 #undef FLD
1130 }
1131 
1132 /* bgezl: bgezl $rs,$offset */
1133 
1134 static SEM_PC
SEM_FN_NAME(iq2000bf,bgezl)1135 SEM_FN_NAME (iq2000bf,bgezl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1136 {
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);
1143 
1144 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1145 {
1146   {
1147     USI opval = FLD (i_offset);
1148     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1149     written |= (1 << 2);
1150     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1151   }
1152 }
1153 } else {
1154 if (1)
1155   SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1156 }
1157 
1158   abuf->written = written;
1159   SEM_BRANCH_FINI (vpc);
1160   return vpc;
1161 #undef FLD
1162 }
1163 
1164 /* bltz: bltz $rs,$offset */
1165 
1166 static SEM_PC
SEM_FN_NAME(iq2000bf,bltz)1167 SEM_FN_NAME (iq2000bf,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1168 {
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);
1175 
1176 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1177 {
1178   {
1179     USI opval = FLD (i_offset);
1180     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1181     written |= (1 << 2);
1182     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1183   }
1184 }
1185 }
1186 
1187   abuf->written = written;
1188   SEM_BRANCH_FINI (vpc);
1189   return vpc;
1190 #undef FLD
1191 }
1192 
1193 /* bltzl: bltzl $rs,$offset */
1194 
1195 static SEM_PC
SEM_FN_NAME(iq2000bf,bltzl)1196 SEM_FN_NAME (iq2000bf,bltzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1197 {
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);
1204 
1205 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1206 {
1207   {
1208     USI opval = FLD (i_offset);
1209     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1210     written |= (1 << 2);
1211     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1212   }
1213 }
1214 } else {
1215 if (1)
1216   SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1217 }
1218 
1219   abuf->written = written;
1220   SEM_BRANCH_FINI (vpc);
1221   return vpc;
1222 #undef FLD
1223 }
1224 
1225 /* bltzal: bltzal $rs,$offset */
1226 
1227 static SEM_PC
SEM_FN_NAME(iq2000bf,bltzal)1228 SEM_FN_NAME (iq2000bf,bltzal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1229 {
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);
1236 
1237 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1238 {
1239   {
1240     SI opval = ADDSI (pc, 8);
1241     SET_H_GR (((UINT) 31), opval);
1242     written |= (1 << 3);
1243     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1244   }
1245 {
1246   {
1247     USI opval = FLD (i_offset);
1248     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1249     written |= (1 << 4);
1250     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1251   }
1252 }
1253 }
1254 }
1255 
1256   abuf->written = written;
1257   SEM_BRANCH_FINI (vpc);
1258   return vpc;
1259 #undef FLD
1260 }
1261 
1262 /* bltzall: bltzall $rs,$offset */
1263 
1264 static SEM_PC
SEM_FN_NAME(iq2000bf,bltzall)1265 SEM_FN_NAME (iq2000bf,bltzall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1266 {
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);
1273 
1274 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1275 {
1276   {
1277     SI opval = ADDSI (pc, 8);
1278     SET_H_GR (((UINT) 31), opval);
1279     written |= (1 << 3);
1280     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1281   }
1282 {
1283   {
1284     USI opval = FLD (i_offset);
1285     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1286     written |= (1 << 4);
1287     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1288   }
1289 }
1290 }
1291 } else {
1292 if (1)
1293   SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1294 }
1295 
1296   abuf->written = written;
1297   SEM_BRANCH_FINI (vpc);
1298   return vpc;
1299 #undef FLD
1300 }
1301 
1302 /* bmb0: bmb0 $rs,$rt,$offset */
1303 
1304 static SEM_PC
SEM_FN_NAME(iq2000bf,bmb0)1305 SEM_FN_NAME (iq2000bf,bmb0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1306 {
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);
1313 
1314 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
1315 {
1316   {
1317     USI opval = FLD (i_offset);
1318     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1319     written |= (1 << 3);
1320     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1321   }
1322 }
1323 }
1324 
1325   abuf->written = written;
1326   SEM_BRANCH_FINI (vpc);
1327   return vpc;
1328 #undef FLD
1329 }
1330 
1331 /* bmb1: bmb1 $rs,$rt,$offset */
1332 
1333 static SEM_PC
SEM_FN_NAME(iq2000bf,bmb1)1334 SEM_FN_NAME (iq2000bf,bmb1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1335 {
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);
1342 
1343 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
1344 {
1345   {
1346     USI opval = FLD (i_offset);
1347     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1348     written |= (1 << 3);
1349     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1350   }
1351 }
1352 }
1353 
1354   abuf->written = written;
1355   SEM_BRANCH_FINI (vpc);
1356   return vpc;
1357 #undef FLD
1358 }
1359 
1360 /* bmb2: bmb2 $rs,$rt,$offset */
1361 
1362 static SEM_PC
SEM_FN_NAME(iq2000bf,bmb2)1363 SEM_FN_NAME (iq2000bf,bmb2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1364 {
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);
1371 
1372 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
1373 {
1374   {
1375     USI opval = FLD (i_offset);
1376     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1377     written |= (1 << 3);
1378     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1379   }
1380 }
1381 }
1382 
1383   abuf->written = written;
1384   SEM_BRANCH_FINI (vpc);
1385   return vpc;
1386 #undef FLD
1387 }
1388 
1389 /* bmb3: bmb3 $rs,$rt,$offset */
1390 
1391 static SEM_PC
SEM_FN_NAME(iq2000bf,bmb3)1392 SEM_FN_NAME (iq2000bf,bmb3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1393 {
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);
1400 
1401 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
1402 {
1403   {
1404     USI opval = FLD (i_offset);
1405     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1406     written |= (1 << 3);
1407     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1408   }
1409 }
1410 }
1411 
1412   abuf->written = written;
1413   SEM_BRANCH_FINI (vpc);
1414   return vpc;
1415 #undef FLD
1416 }
1417 
1418 /* bne: bne $rs,$rt,$offset */
1419 
1420 static SEM_PC
SEM_FN_NAME(iq2000bf,bne)1421 SEM_FN_NAME (iq2000bf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1422 {
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);
1429 
1430 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1431 {
1432   {
1433     USI opval = FLD (i_offset);
1434     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1435     written |= (1 << 3);
1436     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1437   }
1438 }
1439 }
1440 
1441   abuf->written = written;
1442   SEM_BRANCH_FINI (vpc);
1443   return vpc;
1444 #undef FLD
1445 }
1446 
1447 /* bnel: bnel $rs,$rt,$offset */
1448 
1449 static SEM_PC
SEM_FN_NAME(iq2000bf,bnel)1450 SEM_FN_NAME (iq2000bf,bnel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1451 {
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);
1458 
1459 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1460 {
1461   {
1462     USI opval = FLD (i_offset);
1463     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1464     written |= (1 << 3);
1465     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1466   }
1467 }
1468 } else {
1469 if (1)
1470   SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1471 }
1472 
1473   abuf->written = written;
1474   SEM_BRANCH_FINI (vpc);
1475   return vpc;
1476 #undef FLD
1477 }
1478 
1479 /* jalr: jalr $rd,$rs */
1480 
1481 static SEM_PC
SEM_FN_NAME(iq2000bf,jalr)1482 SEM_FN_NAME (iq2000bf,jalr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1483 {
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);
1490 
1491 {
1492 {
1493   {
1494     SI opval = ADDSI (pc, 8);
1495     SET_H_GR (FLD (f_rd), opval);
1496     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1497   }
1498   {
1499     USI opval = GET_H_GR (FLD (f_rs));
1500     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1501     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1502   }
1503 }
1504 }
1505 
1506   SEM_BRANCH_FINI (vpc);
1507   return vpc;
1508 #undef FLD
1509 }
1510 
1511 /* jr: jr $rs */
1512 
1513 static SEM_PC
SEM_FN_NAME(iq2000bf,jr)1514 SEM_FN_NAME (iq2000bf,jr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1515 {
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);
1522 
1523 {
1524   {
1525     USI opval = GET_H_GR (FLD (f_rs));
1526     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1527     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1528   }
1529 }
1530 
1531   SEM_BRANCH_FINI (vpc);
1532   return vpc;
1533 #undef FLD
1534 }
1535 
1536 /* lb: lb $rt,$lo16($base) */
1537 
1538 static SEM_PC
SEM_FN_NAME(iq2000bf,lb)1539 SEM_FN_NAME (iq2000bf,lb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1540 {
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);
1546 
1547   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1551   }
1552 
1553   return vpc;
1554 #undef FLD
1555 }
1556 
1557 /* lbu: lbu $rt,$lo16($base) */
1558 
1559 static SEM_PC
SEM_FN_NAME(iq2000bf,lbu)1560 SEM_FN_NAME (iq2000bf,lbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1561 {
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);
1567 
1568   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1572   }
1573 
1574   return vpc;
1575 #undef FLD
1576 }
1577 
1578 /* lh: lh $rt,$lo16($base) */
1579 
1580 static SEM_PC
SEM_FN_NAME(iq2000bf,lh)1581 SEM_FN_NAME (iq2000bf,lh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1582 {
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);
1588 
1589   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1593   }
1594 
1595   return vpc;
1596 #undef FLD
1597 }
1598 
1599 /* lhu: lhu $rt,$lo16($base) */
1600 
1601 static SEM_PC
SEM_FN_NAME(iq2000bf,lhu)1602 SEM_FN_NAME (iq2000bf,lhu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1603 {
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);
1609 
1610   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1614   }
1615 
1616   return vpc;
1617 #undef FLD
1618 }
1619 
1620 /* lui: lui $rt,$hi16 */
1621 
1622 static SEM_PC
SEM_FN_NAME(iq2000bf,lui)1623 SEM_FN_NAME (iq2000bf,lui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1624 {
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);
1630 
1631   {
1632     SI opval = SLLSI (FLD (f_imm), 16);
1633     SET_H_GR (FLD (f_rt), opval);
1634     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1635   }
1636 
1637   return vpc;
1638 #undef FLD
1639 }
1640 
1641 /* lw: lw $rt,$lo16($base) */
1642 
1643 static SEM_PC
SEM_FN_NAME(iq2000bf,lw)1644 SEM_FN_NAME (iq2000bf,lw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1645 {
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);
1651 
1652   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1656   }
1657 
1658   return vpc;
1659 #undef FLD
1660 }
1661 
1662 /* sb: sb $rt,$lo16($base) */
1663 
1664 static SEM_PC
SEM_FN_NAME(iq2000bf,sb)1665 SEM_FN_NAME (iq2000bf,sb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1666 {
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);
1672 
1673   {
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     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1677   }
1678 
1679   return vpc;
1680 #undef FLD
1681 }
1682 
1683 /* sh: sh $rt,$lo16($base) */
1684 
1685 static SEM_PC
SEM_FN_NAME(iq2000bf,sh)1686 SEM_FN_NAME (iq2000bf,sh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1687 {
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);
1693 
1694   {
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     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1698   }
1699 
1700   return vpc;
1701 #undef FLD
1702 }
1703 
1704 /* sw: sw $rt,$lo16($base) */
1705 
1706 static SEM_PC
SEM_FN_NAME(iq2000bf,sw)1707 SEM_FN_NAME (iq2000bf,sw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1708 {
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);
1714 
1715   {
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     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1719   }
1720 
1721   return vpc;
1722 #undef FLD
1723 }
1724 
1725 /* break: break */
1726 
1727 static SEM_PC
SEM_FN_NAME(iq2000bf,break)1728 SEM_FN_NAME (iq2000bf,break) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1729 {
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);
1735 
1736 do_break (current_cpu, pc);
1737 
1738   return vpc;
1739 #undef FLD
1740 }
1741 
1742 /* syscall: syscall */
1743 
1744 static SEM_PC
SEM_FN_NAME(iq2000bf,syscall)1745 SEM_FN_NAME (iq2000bf,syscall) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1746 {
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);
1752 
1753 do_syscall (current_cpu);
1754 
1755   return vpc;
1756 #undef FLD
1757 }
1758 
1759 /* andoui: andoui $rt,$rs,$hi16 */
1760 
1761 static SEM_PC
SEM_FN_NAME(iq2000bf,andoui)1762 SEM_FN_NAME (iq2000bf,andoui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1763 {
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);
1769 
1770   {
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     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1774   }
1775 
1776   return vpc;
1777 #undef FLD
1778 }
1779 
1780 /* orui: orui $rt,$rs,$hi16 */
1781 
1782 static SEM_PC
SEM_FN_NAME(iq2000bf,orui)1783 SEM_FN_NAME (iq2000bf,orui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1784 {
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);
1790 
1791   {
1792     SI opval = ORSI (GET_H_GR (FLD (f_rs)), SLLSI (FLD (f_imm), 16));
1793     SET_H_GR (FLD (f_rt), opval);
1794     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1795   }
1796 
1797   return vpc;
1798 #undef FLD
1799 }
1800 
1801 /* bgtz: bgtz $rs,$offset */
1802 
1803 static SEM_PC
SEM_FN_NAME(iq2000bf,bgtz)1804 SEM_FN_NAME (iq2000bf,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1805 {
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);
1812 
1813 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1814 {
1815   {
1816     USI opval = FLD (i_offset);
1817     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1818     written |= (1 << 2);
1819     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1820   }
1821 }
1822 }
1823 
1824   abuf->written = written;
1825   SEM_BRANCH_FINI (vpc);
1826   return vpc;
1827 #undef FLD
1828 }
1829 
1830 /* bgtzl: bgtzl $rs,$offset */
1831 
1832 static SEM_PC
SEM_FN_NAME(iq2000bf,bgtzl)1833 SEM_FN_NAME (iq2000bf,bgtzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1834 {
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);
1841 
1842 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1843 {
1844   {
1845     USI opval = FLD (i_offset);
1846     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1847     written |= (1 << 2);
1848     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1849   }
1850 }
1851 } else {
1852 if (1)
1853   SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1854 }
1855 
1856   abuf->written = written;
1857   SEM_BRANCH_FINI (vpc);
1858   return vpc;
1859 #undef FLD
1860 }
1861 
1862 /* blez: blez $rs,$offset */
1863 
1864 static SEM_PC
SEM_FN_NAME(iq2000bf,blez)1865 SEM_FN_NAME (iq2000bf,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1866 {
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);
1873 
1874 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1875 {
1876   {
1877     USI opval = FLD (i_offset);
1878     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1879     written |= (1 << 2);
1880     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1881   }
1882 }
1883 }
1884 
1885   abuf->written = written;
1886   SEM_BRANCH_FINI (vpc);
1887   return vpc;
1888 #undef FLD
1889 }
1890 
1891 /* blezl: blezl $rs,$offset */
1892 
1893 static SEM_PC
SEM_FN_NAME(iq2000bf,blezl)1894 SEM_FN_NAME (iq2000bf,blezl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1895 {
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);
1902 
1903 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1904 {
1905   {
1906     USI opval = FLD (i_offset);
1907     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1908     written |= (1 << 2);
1909     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1910   }
1911 }
1912 } else {
1913 if (1)
1914   SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1915 }
1916 
1917   abuf->written = written;
1918   SEM_BRANCH_FINI (vpc);
1919   return vpc;
1920 #undef FLD
1921 }
1922 
1923 /* mrgb: mrgb $rd,$rs,$rt,$mask */
1924 
1925 static SEM_PC
SEM_FN_NAME(iq2000bf,mrgb)1926 SEM_FN_NAME (iq2000bf,mrgb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1927 {
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);
1933 
1934 {
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);
1940 }
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));
1945 }
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));
1950 }
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));
1955 }
1956   {
1957     SI opval = tmp_temp;
1958     SET_H_GR (FLD (f_rd), opval);
1959     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1960   }
1961 }
1962 
1963   return vpc;
1964 #undef FLD
1965 }
1966 
1967 /* bctxt: bctxt $rs,$offset */
1968 
1969 static SEM_PC
SEM_FN_NAME(iq2000bf,bctxt)1970 SEM_FN_NAME (iq2000bf,bctxt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1971 {
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);
1978 
1979 ((void) 0); /*nop*/
1980 
1981   SEM_BRANCH_FINI (vpc);
1982   return vpc;
1983 #undef FLD
1984 }
1985 
1986 /* bc0f: bc0f $offset */
1987 
1988 static SEM_PC
SEM_FN_NAME(iq2000bf,bc0f)1989 SEM_FN_NAME (iq2000bf,bc0f) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1990 {
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);
1997 
1998 ((void) 0); /*nop*/
1999 
2000   SEM_BRANCH_FINI (vpc);
2001   return vpc;
2002 #undef FLD
2003 }
2004 
2005 /* bc0fl: bc0fl $offset */
2006 
2007 static SEM_PC
SEM_FN_NAME(iq2000bf,bc0fl)2008 SEM_FN_NAME (iq2000bf,bc0fl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2009 {
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);
2016 
2017 ((void) 0); /*nop*/
2018 
2019   SEM_BRANCH_FINI (vpc);
2020   return vpc;
2021 #undef FLD
2022 }
2023 
2024 /* bc3f: bc3f $offset */
2025 
2026 static SEM_PC
SEM_FN_NAME(iq2000bf,bc3f)2027 SEM_FN_NAME (iq2000bf,bc3f) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2028 {
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);
2035 
2036 ((void) 0); /*nop*/
2037 
2038   SEM_BRANCH_FINI (vpc);
2039   return vpc;
2040 #undef FLD
2041 }
2042 
2043 /* bc3fl: bc3fl $offset */
2044 
2045 static SEM_PC
SEM_FN_NAME(iq2000bf,bc3fl)2046 SEM_FN_NAME (iq2000bf,bc3fl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2047 {
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);
2054 
2055 ((void) 0); /*nop*/
2056 
2057   SEM_BRANCH_FINI (vpc);
2058   return vpc;
2059 #undef FLD
2060 }
2061 
2062 /* bc0t: bc0t $offset */
2063 
2064 static SEM_PC
SEM_FN_NAME(iq2000bf,bc0t)2065 SEM_FN_NAME (iq2000bf,bc0t) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2066 {
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);
2073 
2074 ((void) 0); /*nop*/
2075 
2076   SEM_BRANCH_FINI (vpc);
2077   return vpc;
2078 #undef FLD
2079 }
2080 
2081 /* bc0tl: bc0tl $offset */
2082 
2083 static SEM_PC
SEM_FN_NAME(iq2000bf,bc0tl)2084 SEM_FN_NAME (iq2000bf,bc0tl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2085 {
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);
2092 
2093 ((void) 0); /*nop*/
2094 
2095   SEM_BRANCH_FINI (vpc);
2096   return vpc;
2097 #undef FLD
2098 }
2099 
2100 /* bc3t: bc3t $offset */
2101 
2102 static SEM_PC
SEM_FN_NAME(iq2000bf,bc3t)2103 SEM_FN_NAME (iq2000bf,bc3t) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2104 {
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);
2111 
2112 ((void) 0); /*nop*/
2113 
2114   SEM_BRANCH_FINI (vpc);
2115   return vpc;
2116 #undef FLD
2117 }
2118 
2119 /* bc3tl: bc3tl $offset */
2120 
2121 static SEM_PC
SEM_FN_NAME(iq2000bf,bc3tl)2122 SEM_FN_NAME (iq2000bf,bc3tl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2123 {
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);
2130 
2131 ((void) 0); /*nop*/
2132 
2133   SEM_BRANCH_FINI (vpc);
2134   return vpc;
2135 #undef FLD
2136 }
2137 
2138 /* cfc0: cfc0 $rt,$rd */
2139 
2140 static SEM_PC
SEM_FN_NAME(iq2000bf,cfc0)2141 SEM_FN_NAME (iq2000bf,cfc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2142 {
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);
2148 
2149 ((void) 0); /*nop*/
2150 
2151   return vpc;
2152 #undef FLD
2153 }
2154 
2155 /* cfc1: cfc1 $rt,$rd */
2156 
2157 static SEM_PC
SEM_FN_NAME(iq2000bf,cfc1)2158 SEM_FN_NAME (iq2000bf,cfc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2159 {
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);
2165 
2166 ((void) 0); /*nop*/
2167 
2168   return vpc;
2169 #undef FLD
2170 }
2171 
2172 /* cfc2: cfc2 $rt,$rd */
2173 
2174 static SEM_PC
SEM_FN_NAME(iq2000bf,cfc2)2175 SEM_FN_NAME (iq2000bf,cfc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2176 {
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);
2182 
2183 ((void) 0); /*nop*/
2184 
2185   return vpc;
2186 #undef FLD
2187 }
2188 
2189 /* cfc3: cfc3 $rt,$rd */
2190 
2191 static SEM_PC
SEM_FN_NAME(iq2000bf,cfc3)2192 SEM_FN_NAME (iq2000bf,cfc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2193 {
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);
2199 
2200 ((void) 0); /*nop*/
2201 
2202   return vpc;
2203 #undef FLD
2204 }
2205 
2206 /* chkhdr: chkhdr $rd,$rt */
2207 
2208 static SEM_PC
SEM_FN_NAME(iq2000bf,chkhdr)2209 SEM_FN_NAME (iq2000bf,chkhdr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2210 {
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);
2216 
2217 ((void) 0); /*nop*/
2218 
2219   return vpc;
2220 #undef FLD
2221 }
2222 
2223 /* ctc0: ctc0 $rt,$rd */
2224 
2225 static SEM_PC
SEM_FN_NAME(iq2000bf,ctc0)2226 SEM_FN_NAME (iq2000bf,ctc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2227 {
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);
2233 
2234 ((void) 0); /*nop*/
2235 
2236   return vpc;
2237 #undef FLD
2238 }
2239 
2240 /* ctc1: ctc1 $rt,$rd */
2241 
2242 static SEM_PC
SEM_FN_NAME(iq2000bf,ctc1)2243 SEM_FN_NAME (iq2000bf,ctc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2244 {
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);
2250 
2251 ((void) 0); /*nop*/
2252 
2253   return vpc;
2254 #undef FLD
2255 }
2256 
2257 /* ctc2: ctc2 $rt,$rd */
2258 
2259 static SEM_PC
SEM_FN_NAME(iq2000bf,ctc2)2260 SEM_FN_NAME (iq2000bf,ctc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2261 {
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);
2267 
2268 ((void) 0); /*nop*/
2269 
2270   return vpc;
2271 #undef FLD
2272 }
2273 
2274 /* ctc3: ctc3 $rt,$rd */
2275 
2276 static SEM_PC
SEM_FN_NAME(iq2000bf,ctc3)2277 SEM_FN_NAME (iq2000bf,ctc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2278 {
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);
2284 
2285 ((void) 0); /*nop*/
2286 
2287   return vpc;
2288 #undef FLD
2289 }
2290 
2291 /* jcr: jcr $rs */
2292 
2293 static SEM_PC
SEM_FN_NAME(iq2000bf,jcr)2294 SEM_FN_NAME (iq2000bf,jcr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2295 {
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);
2302 
2303 ((void) 0); /*nop*/
2304 
2305   SEM_BRANCH_FINI (vpc);
2306   return vpc;
2307 #undef FLD
2308 }
2309 
2310 /* luc32: luc32 $rt,$rd */
2311 
2312 static SEM_PC
SEM_FN_NAME(iq2000bf,luc32)2313 SEM_FN_NAME (iq2000bf,luc32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2314 {
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);
2320 
2321 ((void) 0); /*nop*/
2322 
2323   return vpc;
2324 #undef FLD
2325 }
2326 
2327 /* luc32l: luc32l $rt,$rd */
2328 
2329 static SEM_PC
SEM_FN_NAME(iq2000bf,luc32l)2330 SEM_FN_NAME (iq2000bf,luc32l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2331 {
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);
2337 
2338 ((void) 0); /*nop*/
2339 
2340   return vpc;
2341 #undef FLD
2342 }
2343 
2344 /* luc64: luc64 $rt,$rd */
2345 
2346 static SEM_PC
SEM_FN_NAME(iq2000bf,luc64)2347 SEM_FN_NAME (iq2000bf,luc64) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2348 {
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);
2354 
2355 ((void) 0); /*nop*/
2356 
2357   return vpc;
2358 #undef FLD
2359 }
2360 
2361 /* luc64l: luc64l $rt,$rd */
2362 
2363 static SEM_PC
SEM_FN_NAME(iq2000bf,luc64l)2364 SEM_FN_NAME (iq2000bf,luc64l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2365 {
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);
2371 
2372 ((void) 0); /*nop*/
2373 
2374   return vpc;
2375 #undef FLD
2376 }
2377 
2378 /* luk: luk $rt,$rd */
2379 
2380 static SEM_PC
SEM_FN_NAME(iq2000bf,luk)2381 SEM_FN_NAME (iq2000bf,luk) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2382 {
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);
2388 
2389 ((void) 0); /*nop*/
2390 
2391   return vpc;
2392 #undef FLD
2393 }
2394 
2395 /* lulck: lulck $rt */
2396 
2397 static SEM_PC
SEM_FN_NAME(iq2000bf,lulck)2398 SEM_FN_NAME (iq2000bf,lulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2399 {
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);
2405 
2406 ((void) 0); /*nop*/
2407 
2408   return vpc;
2409 #undef FLD
2410 }
2411 
2412 /* lum32: lum32 $rt,$rd */
2413 
2414 static SEM_PC
SEM_FN_NAME(iq2000bf,lum32)2415 SEM_FN_NAME (iq2000bf,lum32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2416 {
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);
2422 
2423 ((void) 0); /*nop*/
2424 
2425   return vpc;
2426 #undef FLD
2427 }
2428 
2429 /* lum32l: lum32l $rt,$rd */
2430 
2431 static SEM_PC
SEM_FN_NAME(iq2000bf,lum32l)2432 SEM_FN_NAME (iq2000bf,lum32l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2433 {
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);
2439 
2440 ((void) 0); /*nop*/
2441 
2442   return vpc;
2443 #undef FLD
2444 }
2445 
2446 /* lum64: lum64 $rt,$rd */
2447 
2448 static SEM_PC
SEM_FN_NAME(iq2000bf,lum64)2449 SEM_FN_NAME (iq2000bf,lum64) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2450 {
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);
2456 
2457 ((void) 0); /*nop*/
2458 
2459   return vpc;
2460 #undef FLD
2461 }
2462 
2463 /* lum64l: lum64l $rt,$rd */
2464 
2465 static SEM_PC
SEM_FN_NAME(iq2000bf,lum64l)2466 SEM_FN_NAME (iq2000bf,lum64l) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2467 {
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);
2473 
2474 ((void) 0); /*nop*/
2475 
2476   return vpc;
2477 #undef FLD
2478 }
2479 
2480 /* lur: lur $rt,$rd */
2481 
2482 static SEM_PC
SEM_FN_NAME(iq2000bf,lur)2483 SEM_FN_NAME (iq2000bf,lur) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2484 {
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);
2490 
2491 ((void) 0); /*nop*/
2492 
2493   return vpc;
2494 #undef FLD
2495 }
2496 
2497 /* lurl: lurl $rt,$rd */
2498 
2499 static SEM_PC
SEM_FN_NAME(iq2000bf,lurl)2500 SEM_FN_NAME (iq2000bf,lurl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2501 {
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);
2507 
2508 ((void) 0); /*nop*/
2509 
2510   return vpc;
2511 #undef FLD
2512 }
2513 
2514 /* luulck: luulck $rt */
2515 
2516 static SEM_PC
SEM_FN_NAME(iq2000bf,luulck)2517 SEM_FN_NAME (iq2000bf,luulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2518 {
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);
2524 
2525 ((void) 0); /*nop*/
2526 
2527   return vpc;
2528 #undef FLD
2529 }
2530 
2531 /* mfc0: mfc0 $rt,$rd */
2532 
2533 static SEM_PC
SEM_FN_NAME(iq2000bf,mfc0)2534 SEM_FN_NAME (iq2000bf,mfc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2535 {
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);
2541 
2542 ((void) 0); /*nop*/
2543 
2544   return vpc;
2545 #undef FLD
2546 }
2547 
2548 /* mfc1: mfc1 $rt,$rd */
2549 
2550 static SEM_PC
SEM_FN_NAME(iq2000bf,mfc1)2551 SEM_FN_NAME (iq2000bf,mfc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2552 {
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);
2558 
2559 ((void) 0); /*nop*/
2560 
2561   return vpc;
2562 #undef FLD
2563 }
2564 
2565 /* mfc2: mfc2 $rt,$rd */
2566 
2567 static SEM_PC
SEM_FN_NAME(iq2000bf,mfc2)2568 SEM_FN_NAME (iq2000bf,mfc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2569 {
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);
2575 
2576 ((void) 0); /*nop*/
2577 
2578   return vpc;
2579 #undef FLD
2580 }
2581 
2582 /* mfc3: mfc3 $rt,$rd */
2583 
2584 static SEM_PC
SEM_FN_NAME(iq2000bf,mfc3)2585 SEM_FN_NAME (iq2000bf,mfc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2586 {
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);
2592 
2593 ((void) 0); /*nop*/
2594 
2595   return vpc;
2596 #undef FLD
2597 }
2598 
2599 /* mtc0: mtc0 $rt,$rd */
2600 
2601 static SEM_PC
SEM_FN_NAME(iq2000bf,mtc0)2602 SEM_FN_NAME (iq2000bf,mtc0) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2603 {
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);
2609 
2610 ((void) 0); /*nop*/
2611 
2612   return vpc;
2613 #undef FLD
2614 }
2615 
2616 /* mtc1: mtc1 $rt,$rd */
2617 
2618 static SEM_PC
SEM_FN_NAME(iq2000bf,mtc1)2619 SEM_FN_NAME (iq2000bf,mtc1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2620 {
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);
2626 
2627 ((void) 0); /*nop*/
2628 
2629   return vpc;
2630 #undef FLD
2631 }
2632 
2633 /* mtc2: mtc2 $rt,$rd */
2634 
2635 static SEM_PC
SEM_FN_NAME(iq2000bf,mtc2)2636 SEM_FN_NAME (iq2000bf,mtc2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2637 {
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);
2643 
2644 ((void) 0); /*nop*/
2645 
2646   return vpc;
2647 #undef FLD
2648 }
2649 
2650 /* mtc3: mtc3 $rt,$rd */
2651 
2652 static SEM_PC
SEM_FN_NAME(iq2000bf,mtc3)2653 SEM_FN_NAME (iq2000bf,mtc3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2654 {
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);
2660 
2661 ((void) 0); /*nop*/
2662 
2663   return vpc;
2664 #undef FLD
2665 }
2666 
2667 /* pkrl: pkrl $rd,$rt */
2668 
2669 static SEM_PC
SEM_FN_NAME(iq2000bf,pkrl)2670 SEM_FN_NAME (iq2000bf,pkrl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2671 {
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);
2677 
2678 ((void) 0); /*nop*/
2679 
2680   return vpc;
2681 #undef FLD
2682 }
2683 
2684 /* pkrlr1: pkrlr1 $rt,$_index,$count */
2685 
2686 static SEM_PC
SEM_FN_NAME(iq2000bf,pkrlr1)2687 SEM_FN_NAME (iq2000bf,pkrlr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2688 {
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);
2694 
2695 ((void) 0); /*nop*/
2696 
2697   return vpc;
2698 #undef FLD
2699 }
2700 
2701 /* pkrlr30: pkrlr30 $rt,$_index,$count */
2702 
2703 static SEM_PC
SEM_FN_NAME(iq2000bf,pkrlr30)2704 SEM_FN_NAME (iq2000bf,pkrlr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2705 {
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);
2711 
2712 ((void) 0); /*nop*/
2713 
2714   return vpc;
2715 #undef FLD
2716 }
2717 
2718 /* rb: rb $rd,$rt */
2719 
2720 static SEM_PC
SEM_FN_NAME(iq2000bf,rb)2721 SEM_FN_NAME (iq2000bf,rb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2722 {
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);
2728 
2729 ((void) 0); /*nop*/
2730 
2731   return vpc;
2732 #undef FLD
2733 }
2734 
2735 /* rbr1: rbr1 $rt,$_index,$count */
2736 
2737 static SEM_PC
SEM_FN_NAME(iq2000bf,rbr1)2738 SEM_FN_NAME (iq2000bf,rbr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2739 {
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);
2745 
2746 ((void) 0); /*nop*/
2747 
2748   return vpc;
2749 #undef FLD
2750 }
2751 
2752 /* rbr30: rbr30 $rt,$_index,$count */
2753 
2754 static SEM_PC
SEM_FN_NAME(iq2000bf,rbr30)2755 SEM_FN_NAME (iq2000bf,rbr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2756 {
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);
2762 
2763 ((void) 0); /*nop*/
2764 
2765   return vpc;
2766 #undef FLD
2767 }
2768 
2769 /* rfe: rfe */
2770 
2771 static SEM_PC
SEM_FN_NAME(iq2000bf,rfe)2772 SEM_FN_NAME (iq2000bf,rfe) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2773 {
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);
2779 
2780 ((void) 0); /*nop*/
2781 
2782   return vpc;
2783 #undef FLD
2784 }
2785 
2786 /* rx: rx $rd,$rt */
2787 
2788 static SEM_PC
SEM_FN_NAME(iq2000bf,rx)2789 SEM_FN_NAME (iq2000bf,rx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2790 {
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);
2796 
2797 ((void) 0); /*nop*/
2798 
2799   return vpc;
2800 #undef FLD
2801 }
2802 
2803 /* rxr1: rxr1 $rt,$_index,$count */
2804 
2805 static SEM_PC
SEM_FN_NAME(iq2000bf,rxr1)2806 SEM_FN_NAME (iq2000bf,rxr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2807 {
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);
2813 
2814 ((void) 0); /*nop*/
2815 
2816   return vpc;
2817 #undef FLD
2818 }
2819 
2820 /* rxr30: rxr30 $rt,$_index,$count */
2821 
2822 static SEM_PC
SEM_FN_NAME(iq2000bf,rxr30)2823 SEM_FN_NAME (iq2000bf,rxr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2824 {
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);
2830 
2831 ((void) 0); /*nop*/
2832 
2833   return vpc;
2834 #undef FLD
2835 }
2836 
2837 /* sleep: sleep */
2838 
2839 static SEM_PC
SEM_FN_NAME(iq2000bf,sleep)2840 SEM_FN_NAME (iq2000bf,sleep) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2841 {
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);
2847 
2848 ((void) 0); /*nop*/
2849 
2850   return vpc;
2851 #undef FLD
2852 }
2853 
2854 /* srrd: srrd $rt */
2855 
2856 static SEM_PC
SEM_FN_NAME(iq2000bf,srrd)2857 SEM_FN_NAME (iq2000bf,srrd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2858 {
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);
2864 
2865 ((void) 0); /*nop*/
2866 
2867   return vpc;
2868 #undef FLD
2869 }
2870 
2871 /* srrdl: srrdl $rt */
2872 
2873 static SEM_PC
SEM_FN_NAME(iq2000bf,srrdl)2874 SEM_FN_NAME (iq2000bf,srrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2875 {
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);
2881 
2882 ((void) 0); /*nop*/
2883 
2884   return vpc;
2885 #undef FLD
2886 }
2887 
2888 /* srulck: srulck $rt */
2889 
2890 static SEM_PC
SEM_FN_NAME(iq2000bf,srulck)2891 SEM_FN_NAME (iq2000bf,srulck) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2892 {
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);
2898 
2899 ((void) 0); /*nop*/
2900 
2901   return vpc;
2902 #undef FLD
2903 }
2904 
2905 /* srwr: srwr $rt,$rd */
2906 
2907 static SEM_PC
SEM_FN_NAME(iq2000bf,srwr)2908 SEM_FN_NAME (iq2000bf,srwr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2909 {
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);
2915 
2916 ((void) 0); /*nop*/
2917 
2918   return vpc;
2919 #undef FLD
2920 }
2921 
2922 /* srwru: srwru $rt,$rd */
2923 
2924 static SEM_PC
SEM_FN_NAME(iq2000bf,srwru)2925 SEM_FN_NAME (iq2000bf,srwru) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2926 {
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);
2932 
2933 ((void) 0); /*nop*/
2934 
2935   return vpc;
2936 #undef FLD
2937 }
2938 
2939 /* trapqfl: trapqfl */
2940 
2941 static SEM_PC
SEM_FN_NAME(iq2000bf,trapqfl)2942 SEM_FN_NAME (iq2000bf,trapqfl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2943 {
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);
2949 
2950 ((void) 0); /*nop*/
2951 
2952   return vpc;
2953 #undef FLD
2954 }
2955 
2956 /* trapqne: trapqne */
2957 
2958 static SEM_PC
SEM_FN_NAME(iq2000bf,trapqne)2959 SEM_FN_NAME (iq2000bf,trapqne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2960 {
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);
2966 
2967 ((void) 0); /*nop*/
2968 
2969   return vpc;
2970 #undef FLD
2971 }
2972 
2973 /* traprel: traprel $rt */
2974 
2975 static SEM_PC
SEM_FN_NAME(iq2000bf,traprel)2976 SEM_FN_NAME (iq2000bf,traprel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2977 {
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);
2983 
2984 ((void) 0); /*nop*/
2985 
2986   return vpc;
2987 #undef FLD
2988 }
2989 
2990 /* wb: wb $rd,$rt */
2991 
2992 static SEM_PC
SEM_FN_NAME(iq2000bf,wb)2993 SEM_FN_NAME (iq2000bf,wb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2994 {
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);
3000 
3001 ((void) 0); /*nop*/
3002 
3003   return vpc;
3004 #undef FLD
3005 }
3006 
3007 /* wbu: wbu $rd,$rt */
3008 
3009 static SEM_PC
SEM_FN_NAME(iq2000bf,wbu)3010 SEM_FN_NAME (iq2000bf,wbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3011 {
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);
3017 
3018 ((void) 0); /*nop*/
3019 
3020   return vpc;
3021 #undef FLD
3022 }
3023 
3024 /* wbr1: wbr1 $rt,$_index,$count */
3025 
3026 static SEM_PC
SEM_FN_NAME(iq2000bf,wbr1)3027 SEM_FN_NAME (iq2000bf,wbr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3028 {
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);
3034 
3035 ((void) 0); /*nop*/
3036 
3037   return vpc;
3038 #undef FLD
3039 }
3040 
3041 /* wbr1u: wbr1u $rt,$_index,$count */
3042 
3043 static SEM_PC
SEM_FN_NAME(iq2000bf,wbr1u)3044 SEM_FN_NAME (iq2000bf,wbr1u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3045 {
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);
3051 
3052 ((void) 0); /*nop*/
3053 
3054   return vpc;
3055 #undef FLD
3056 }
3057 
3058 /* wbr30: wbr30 $rt,$_index,$count */
3059 
3060 static SEM_PC
SEM_FN_NAME(iq2000bf,wbr30)3061 SEM_FN_NAME (iq2000bf,wbr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3062 {
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);
3068 
3069 ((void) 0); /*nop*/
3070 
3071   return vpc;
3072 #undef FLD
3073 }
3074 
3075 /* wbr30u: wbr30u $rt,$_index,$count */
3076 
3077 static SEM_PC
SEM_FN_NAME(iq2000bf,wbr30u)3078 SEM_FN_NAME (iq2000bf,wbr30u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3079 {
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);
3085 
3086 ((void) 0); /*nop*/
3087 
3088   return vpc;
3089 #undef FLD
3090 }
3091 
3092 /* wx: wx $rd,$rt */
3093 
3094 static SEM_PC
SEM_FN_NAME(iq2000bf,wx)3095 SEM_FN_NAME (iq2000bf,wx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3096 {
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);
3102 
3103 ((void) 0); /*nop*/
3104 
3105   return vpc;
3106 #undef FLD
3107 }
3108 
3109 /* wxu: wxu $rd,$rt */
3110 
3111 static SEM_PC
SEM_FN_NAME(iq2000bf,wxu)3112 SEM_FN_NAME (iq2000bf,wxu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3113 {
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);
3119 
3120 ((void) 0); /*nop*/
3121 
3122   return vpc;
3123 #undef FLD
3124 }
3125 
3126 /* wxr1: wxr1 $rt,$_index,$count */
3127 
3128 static SEM_PC
SEM_FN_NAME(iq2000bf,wxr1)3129 SEM_FN_NAME (iq2000bf,wxr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3130 {
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);
3136 
3137 ((void) 0); /*nop*/
3138 
3139   return vpc;
3140 #undef FLD
3141 }
3142 
3143 /* wxr1u: wxr1u $rt,$_index,$count */
3144 
3145 static SEM_PC
SEM_FN_NAME(iq2000bf,wxr1u)3146 SEM_FN_NAME (iq2000bf,wxr1u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3147 {
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);
3153 
3154 ((void) 0); /*nop*/
3155 
3156   return vpc;
3157 #undef FLD
3158 }
3159 
3160 /* wxr30: wxr30 $rt,$_index,$count */
3161 
3162 static SEM_PC
SEM_FN_NAME(iq2000bf,wxr30)3163 SEM_FN_NAME (iq2000bf,wxr30) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3164 {
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);
3170 
3171 ((void) 0); /*nop*/
3172 
3173   return vpc;
3174 #undef FLD
3175 }
3176 
3177 /* wxr30u: wxr30u $rt,$_index,$count */
3178 
3179 static SEM_PC
SEM_FN_NAME(iq2000bf,wxr30u)3180 SEM_FN_NAME (iq2000bf,wxr30u) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3181 {
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);
3187 
3188 ((void) 0); /*nop*/
3189 
3190   return vpc;
3191 #undef FLD
3192 }
3193 
3194 /* ldw: ldw $rt,$lo16($base) */
3195 
3196 static SEM_PC
SEM_FN_NAME(iq2000bf,ldw)3197 SEM_FN_NAME (iq2000bf,ldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3198 {
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);
3204 
3205 {
3206   SI tmp_addr;
3207   tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3208   {
3209     SI opval = GETMEMSI (current_cpu, pc, tmp_addr);
3210     SET_H_GR (ADDSI (FLD (f_rt), 1), opval);
3211     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3212   }
3213   {
3214     SI opval = GETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4));
3215     SET_H_GR (FLD (f_rt), opval);
3216     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3217   }
3218 }
3219 
3220   return vpc;
3221 #undef FLD
3222 }
3223 
3224 /* sdw: sdw $rt,$lo16($base) */
3225 
3226 static SEM_PC
SEM_FN_NAME(iq2000bf,sdw)3227 SEM_FN_NAME (iq2000bf,sdw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3228 {
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);
3234 
3235 {
3236   SI tmp_addr;
3237   tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3238   {
3239     SI opval = GET_H_GR (FLD (f_rt));
3240     SETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4), opval);
3241     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3242   }
3243   {
3244     SI opval = GET_H_GR (ADDSI (FLD (f_rt), 1));
3245     SETMEMSI (current_cpu, pc, tmp_addr, opval);
3246     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3247   }
3248 }
3249 
3250   return vpc;
3251 #undef FLD
3252 }
3253 
3254 /* j: j $jmptarg */
3255 
3256 static SEM_PC
SEM_FN_NAME(iq2000bf,j)3257 SEM_FN_NAME (iq2000bf,j) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3258 {
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);
3265 
3266 {
3267   {
3268     USI opval = FLD (i_jmptarg);
3269     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3270     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3271   }
3272 }
3273 
3274   SEM_BRANCH_FINI (vpc);
3275   return vpc;
3276 #undef FLD
3277 }
3278 
3279 /* jal: jal $jmptarg */
3280 
3281 static SEM_PC
SEM_FN_NAME(iq2000bf,jal)3282 SEM_FN_NAME (iq2000bf,jal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3283 {
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);
3290 
3291 {
3292 {
3293   {
3294     SI opval = ADDSI (pc, 8);
3295     SET_H_GR (((UINT) 31), opval);
3296     TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3297   }
3298   {
3299     USI opval = FLD (i_jmptarg);
3300     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3301     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3302   }
3303 }
3304 }
3305 
3306   SEM_BRANCH_FINI (vpc);
3307   return vpc;
3308 #undef FLD
3309 }
3310 
3311 /* bmb: bmb $rs,$rt,$offset */
3312 
3313 static SEM_PC
SEM_FN_NAME(iq2000bf,bmb)3314 SEM_FN_NAME (iq2000bf,bmb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3315 {
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);
3322 
3323 {
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;
3328 }
3329 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
3330   tmp_branch_ = 1;
3331 }
3332 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
3333   tmp_branch_ = 1;
3334 }
3335 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
3336   tmp_branch_ = 1;
3337 }
3338 if (tmp_branch_) {
3339 {
3340   {
3341     USI opval = FLD (i_offset);
3342     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3343     written |= (1 << 3);
3344     TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3345   }
3346 }
3347 }
3348 }
3349 
3350   abuf->written = written;
3351   SEM_BRANCH_FINI (vpc);
3352   return vpc;
3353 #undef FLD
3354 }
3355 
3356 /* Table of all semantic fns.  */
3357 
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 }
3510 };
3511 
3512 /* Add the semantic fns to IDESC_TABLE.  */
3513 
3514 void
SEM_FN_NAME(iq2000bf,init_idesc_table)3515 SEM_FN_NAME (iq2000bf,init_idesc_table) (SIM_CPU *current_cpu)
3516 {
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));
3520 
3521   for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
3522     {
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
3537     }
3538 }
3539 
3540