1 /* Simulator instruction semantics for iq2000bf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2016 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
9 This file is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, see <http://www.gnu.org/licenses/>.
26 /* The labels have the case they have because the enum of insn types
27 is all uppercase and in the non-stdc case the insn symbol is built
28 into the enum name. */
34 { IQ2000BF_INSN_X_INVALID, && case_sem_INSN_X_INVALID },
35 { IQ2000BF_INSN_X_AFTER, && case_sem_INSN_X_AFTER },
36 { IQ2000BF_INSN_X_BEFORE, && case_sem_INSN_X_BEFORE },
37 { IQ2000BF_INSN_X_CTI_CHAIN, && case_sem_INSN_X_CTI_CHAIN },
38 { IQ2000BF_INSN_X_CHAIN, && case_sem_INSN_X_CHAIN },
39 { IQ2000BF_INSN_X_BEGIN, && case_sem_INSN_X_BEGIN },
40 { IQ2000BF_INSN_ADD, && case_sem_INSN_ADD },
41 { IQ2000BF_INSN_ADDI, && case_sem_INSN_ADDI },
42 { IQ2000BF_INSN_ADDIU, && case_sem_INSN_ADDIU },
43 { IQ2000BF_INSN_ADDU, && case_sem_INSN_ADDU },
44 { IQ2000BF_INSN_ADO16, && case_sem_INSN_ADO16 },
45 { IQ2000BF_INSN_AND, && case_sem_INSN_AND },
46 { IQ2000BF_INSN_ANDI, && case_sem_INSN_ANDI },
47 { IQ2000BF_INSN_ANDOI, && case_sem_INSN_ANDOI },
48 { IQ2000BF_INSN_NOR, && case_sem_INSN_NOR },
49 { IQ2000BF_INSN_OR, && case_sem_INSN_OR },
50 { IQ2000BF_INSN_ORI, && case_sem_INSN_ORI },
51 { IQ2000BF_INSN_RAM, && case_sem_INSN_RAM },
52 { IQ2000BF_INSN_SLL, && case_sem_INSN_SLL },
53 { IQ2000BF_INSN_SLLV, && case_sem_INSN_SLLV },
54 { IQ2000BF_INSN_SLMV, && case_sem_INSN_SLMV },
55 { IQ2000BF_INSN_SLT, && case_sem_INSN_SLT },
56 { IQ2000BF_INSN_SLTI, && case_sem_INSN_SLTI },
57 { IQ2000BF_INSN_SLTIU, && case_sem_INSN_SLTIU },
58 { IQ2000BF_INSN_SLTU, && case_sem_INSN_SLTU },
59 { IQ2000BF_INSN_SRA, && case_sem_INSN_SRA },
60 { IQ2000BF_INSN_SRAV, && case_sem_INSN_SRAV },
61 { IQ2000BF_INSN_SRL, && case_sem_INSN_SRL },
62 { IQ2000BF_INSN_SRLV, && case_sem_INSN_SRLV },
63 { IQ2000BF_INSN_SRMV, && case_sem_INSN_SRMV },
64 { IQ2000BF_INSN_SUB, && case_sem_INSN_SUB },
65 { IQ2000BF_INSN_SUBU, && case_sem_INSN_SUBU },
66 { IQ2000BF_INSN_XOR, && case_sem_INSN_XOR },
67 { IQ2000BF_INSN_XORI, && case_sem_INSN_XORI },
68 { IQ2000BF_INSN_BBI, && case_sem_INSN_BBI },
69 { IQ2000BF_INSN_BBIN, && case_sem_INSN_BBIN },
70 { IQ2000BF_INSN_BBV, && case_sem_INSN_BBV },
71 { IQ2000BF_INSN_BBVN, && case_sem_INSN_BBVN },
72 { IQ2000BF_INSN_BEQ, && case_sem_INSN_BEQ },
73 { IQ2000BF_INSN_BEQL, && case_sem_INSN_BEQL },
74 { IQ2000BF_INSN_BGEZ, && case_sem_INSN_BGEZ },
75 { IQ2000BF_INSN_BGEZAL, && case_sem_INSN_BGEZAL },
76 { IQ2000BF_INSN_BGEZALL, && case_sem_INSN_BGEZALL },
77 { IQ2000BF_INSN_BGEZL, && case_sem_INSN_BGEZL },
78 { IQ2000BF_INSN_BLTZ, && case_sem_INSN_BLTZ },
79 { IQ2000BF_INSN_BLTZL, && case_sem_INSN_BLTZL },
80 { IQ2000BF_INSN_BLTZAL, && case_sem_INSN_BLTZAL },
81 { IQ2000BF_INSN_BLTZALL, && case_sem_INSN_BLTZALL },
82 { IQ2000BF_INSN_BMB0, && case_sem_INSN_BMB0 },
83 { IQ2000BF_INSN_BMB1, && case_sem_INSN_BMB1 },
84 { IQ2000BF_INSN_BMB2, && case_sem_INSN_BMB2 },
85 { IQ2000BF_INSN_BMB3, && case_sem_INSN_BMB3 },
86 { IQ2000BF_INSN_BNE, && case_sem_INSN_BNE },
87 { IQ2000BF_INSN_BNEL, && case_sem_INSN_BNEL },
88 { IQ2000BF_INSN_JALR, && case_sem_INSN_JALR },
89 { IQ2000BF_INSN_JR, && case_sem_INSN_JR },
90 { IQ2000BF_INSN_LB, && case_sem_INSN_LB },
91 { IQ2000BF_INSN_LBU, && case_sem_INSN_LBU },
92 { IQ2000BF_INSN_LH, && case_sem_INSN_LH },
93 { IQ2000BF_INSN_LHU, && case_sem_INSN_LHU },
94 { IQ2000BF_INSN_LUI, && case_sem_INSN_LUI },
95 { IQ2000BF_INSN_LW, && case_sem_INSN_LW },
96 { IQ2000BF_INSN_SB, && case_sem_INSN_SB },
97 { IQ2000BF_INSN_SH, && case_sem_INSN_SH },
98 { IQ2000BF_INSN_SW, && case_sem_INSN_SW },
99 { IQ2000BF_INSN_BREAK, && case_sem_INSN_BREAK },
100 { IQ2000BF_INSN_SYSCALL, && case_sem_INSN_SYSCALL },
101 { IQ2000BF_INSN_ANDOUI, && case_sem_INSN_ANDOUI },
102 { IQ2000BF_INSN_ORUI, && case_sem_INSN_ORUI },
103 { IQ2000BF_INSN_BGTZ, && case_sem_INSN_BGTZ },
104 { IQ2000BF_INSN_BGTZL, && case_sem_INSN_BGTZL },
105 { IQ2000BF_INSN_BLEZ, && case_sem_INSN_BLEZ },
106 { IQ2000BF_INSN_BLEZL, && case_sem_INSN_BLEZL },
107 { IQ2000BF_INSN_MRGB, && case_sem_INSN_MRGB },
108 { IQ2000BF_INSN_BCTXT, && case_sem_INSN_BCTXT },
109 { IQ2000BF_INSN_BC0F, && case_sem_INSN_BC0F },
110 { IQ2000BF_INSN_BC0FL, && case_sem_INSN_BC0FL },
111 { IQ2000BF_INSN_BC3F, && case_sem_INSN_BC3F },
112 { IQ2000BF_INSN_BC3FL, && case_sem_INSN_BC3FL },
113 { IQ2000BF_INSN_BC0T, && case_sem_INSN_BC0T },
114 { IQ2000BF_INSN_BC0TL, && case_sem_INSN_BC0TL },
115 { IQ2000BF_INSN_BC3T, && case_sem_INSN_BC3T },
116 { IQ2000BF_INSN_BC3TL, && case_sem_INSN_BC3TL },
117 { IQ2000BF_INSN_CFC0, && case_sem_INSN_CFC0 },
118 { IQ2000BF_INSN_CFC1, && case_sem_INSN_CFC1 },
119 { IQ2000BF_INSN_CFC2, && case_sem_INSN_CFC2 },
120 { IQ2000BF_INSN_CFC3, && case_sem_INSN_CFC3 },
121 { IQ2000BF_INSN_CHKHDR, && case_sem_INSN_CHKHDR },
122 { IQ2000BF_INSN_CTC0, && case_sem_INSN_CTC0 },
123 { IQ2000BF_INSN_CTC1, && case_sem_INSN_CTC1 },
124 { IQ2000BF_INSN_CTC2, && case_sem_INSN_CTC2 },
125 { IQ2000BF_INSN_CTC3, && case_sem_INSN_CTC3 },
126 { IQ2000BF_INSN_JCR, && case_sem_INSN_JCR },
127 { IQ2000BF_INSN_LUC32, && case_sem_INSN_LUC32 },
128 { IQ2000BF_INSN_LUC32L, && case_sem_INSN_LUC32L },
129 { IQ2000BF_INSN_LUC64, && case_sem_INSN_LUC64 },
130 { IQ2000BF_INSN_LUC64L, && case_sem_INSN_LUC64L },
131 { IQ2000BF_INSN_LUK, && case_sem_INSN_LUK },
132 { IQ2000BF_INSN_LULCK, && case_sem_INSN_LULCK },
133 { IQ2000BF_INSN_LUM32, && case_sem_INSN_LUM32 },
134 { IQ2000BF_INSN_LUM32L, && case_sem_INSN_LUM32L },
135 { IQ2000BF_INSN_LUM64, && case_sem_INSN_LUM64 },
136 { IQ2000BF_INSN_LUM64L, && case_sem_INSN_LUM64L },
137 { IQ2000BF_INSN_LUR, && case_sem_INSN_LUR },
138 { IQ2000BF_INSN_LURL, && case_sem_INSN_LURL },
139 { IQ2000BF_INSN_LUULCK, && case_sem_INSN_LUULCK },
140 { IQ2000BF_INSN_MFC0, && case_sem_INSN_MFC0 },
141 { IQ2000BF_INSN_MFC1, && case_sem_INSN_MFC1 },
142 { IQ2000BF_INSN_MFC2, && case_sem_INSN_MFC2 },
143 { IQ2000BF_INSN_MFC3, && case_sem_INSN_MFC3 },
144 { IQ2000BF_INSN_MTC0, && case_sem_INSN_MTC0 },
145 { IQ2000BF_INSN_MTC1, && case_sem_INSN_MTC1 },
146 { IQ2000BF_INSN_MTC2, && case_sem_INSN_MTC2 },
147 { IQ2000BF_INSN_MTC3, && case_sem_INSN_MTC3 },
148 { IQ2000BF_INSN_PKRL, && case_sem_INSN_PKRL },
149 { IQ2000BF_INSN_PKRLR1, && case_sem_INSN_PKRLR1 },
150 { IQ2000BF_INSN_PKRLR30, && case_sem_INSN_PKRLR30 },
151 { IQ2000BF_INSN_RB, && case_sem_INSN_RB },
152 { IQ2000BF_INSN_RBR1, && case_sem_INSN_RBR1 },
153 { IQ2000BF_INSN_RBR30, && case_sem_INSN_RBR30 },
154 { IQ2000BF_INSN_RFE, && case_sem_INSN_RFE },
155 { IQ2000BF_INSN_RX, && case_sem_INSN_RX },
156 { IQ2000BF_INSN_RXR1, && case_sem_INSN_RXR1 },
157 { IQ2000BF_INSN_RXR30, && case_sem_INSN_RXR30 },
158 { IQ2000BF_INSN_SLEEP, && case_sem_INSN_SLEEP },
159 { IQ2000BF_INSN_SRRD, && case_sem_INSN_SRRD },
160 { IQ2000BF_INSN_SRRDL, && case_sem_INSN_SRRDL },
161 { IQ2000BF_INSN_SRULCK, && case_sem_INSN_SRULCK },
162 { IQ2000BF_INSN_SRWR, && case_sem_INSN_SRWR },
163 { IQ2000BF_INSN_SRWRU, && case_sem_INSN_SRWRU },
164 { IQ2000BF_INSN_TRAPQFL, && case_sem_INSN_TRAPQFL },
165 { IQ2000BF_INSN_TRAPQNE, && case_sem_INSN_TRAPQNE },
166 { IQ2000BF_INSN_TRAPREL, && case_sem_INSN_TRAPREL },
167 { IQ2000BF_INSN_WB, && case_sem_INSN_WB },
168 { IQ2000BF_INSN_WBU, && case_sem_INSN_WBU },
169 { IQ2000BF_INSN_WBR1, && case_sem_INSN_WBR1 },
170 { IQ2000BF_INSN_WBR1U, && case_sem_INSN_WBR1U },
171 { IQ2000BF_INSN_WBR30, && case_sem_INSN_WBR30 },
172 { IQ2000BF_INSN_WBR30U, && case_sem_INSN_WBR30U },
173 { IQ2000BF_INSN_WX, && case_sem_INSN_WX },
174 { IQ2000BF_INSN_WXU, && case_sem_INSN_WXU },
175 { IQ2000BF_INSN_WXR1, && case_sem_INSN_WXR1 },
176 { IQ2000BF_INSN_WXR1U, && case_sem_INSN_WXR1U },
177 { IQ2000BF_INSN_WXR30, && case_sem_INSN_WXR30 },
178 { IQ2000BF_INSN_WXR30U, && case_sem_INSN_WXR30U },
179 { IQ2000BF_INSN_LDW, && case_sem_INSN_LDW },
180 { IQ2000BF_INSN_SDW, && case_sem_INSN_SDW },
181 { IQ2000BF_INSN_J, && case_sem_INSN_J },
182 { IQ2000BF_INSN_JAL, && case_sem_INSN_JAL },
183 { IQ2000BF_INSN_BMB, && case_sem_INSN_BMB },
188 for (i = 0; labels[i].label != 0; ++i)
191 CPU_IDESC (current_cpu) [labels[i].index].sem_fast_lab = labels[i].label;
193 CPU_IDESC (current_cpu) [labels[i].index].sem_full_lab = labels[i].label;
198 #endif /* DEFINE_LABELS */
202 /* If hyper-fast [well not unnecessarily slow] execution is selected, turn
203 off frills like tracing and profiling. */
204 /* FIXME: A better way would be to have CGEN_TRACE_RESULT check for something
205 that can cause it to be optimized out. Another way would be to emit
206 special handlers into the instruction "stream". */
209 #undef CGEN_TRACE_RESULT
210 #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val)
214 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
220 /* Branch to next handler without going around main loop. */
221 #define NEXT(vpc) goto * SEM_ARGBUF (vpc) -> semantic.sem_case
222 SWITCH (sem, SEM_ARGBUF (vpc) -> semantic.sem_case)
224 #else /* ! WITH_SCACHE_PBB */
226 #define NEXT(vpc) BREAK (sem)
229 SWITCH (sem, SEM_ARGBUF (sc) -> idesc->sem_fast_lab)
231 SWITCH (sem, SEM_ARGBUF (sc) -> idesc->sem_full_lab)
234 SWITCH (sem, SEM_ARGBUF (sc) -> idesc->num)
237 #endif /* ! WITH_SCACHE_PBB */
241 CASE (sem, INSN_X_INVALID) : /* --invalid-- */
243 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
244 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
245 #define FLD(f) abuf->fields.sfmt_empty.f
246 int UNUSED written = 0;
247 IADDR UNUSED pc = abuf->addr;
248 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
251 /* Update the recorded pc in the cpu state struct.
252 Only necessary for WITH_SCACHE case, but to avoid the
253 conditional compilation .... */
255 /* Virtual insns have zero size. Overwrite vpc with address of next insn
256 using the default-insn-bitsize spec. When executing insns in parallel
257 we may want to queue the fault and continue execution. */
258 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
259 vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
266 CASE (sem, INSN_X_AFTER) : /* --after-- */
268 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
269 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
270 #define FLD(f) abuf->fields.sfmt_empty.f
271 int UNUSED written = 0;
272 IADDR UNUSED pc = abuf->addr;
273 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
276 #if WITH_SCACHE_PBB_IQ2000BF
277 iq2000bf_pbb_after (current_cpu, sem_arg);
285 CASE (sem, INSN_X_BEFORE) : /* --before-- */
287 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
288 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
289 #define FLD(f) abuf->fields.sfmt_empty.f
290 int UNUSED written = 0;
291 IADDR UNUSED pc = abuf->addr;
292 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
295 #if WITH_SCACHE_PBB_IQ2000BF
296 iq2000bf_pbb_before (current_cpu, sem_arg);
304 CASE (sem, INSN_X_CTI_CHAIN) : /* --cti-chain-- */
306 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
307 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
308 #define FLD(f) abuf->fields.sfmt_empty.f
309 int UNUSED written = 0;
310 IADDR UNUSED pc = abuf->addr;
311 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
314 #if WITH_SCACHE_PBB_IQ2000BF
316 vpc = iq2000bf_pbb_cti_chain (current_cpu, sem_arg,
317 pbb_br_type, pbb_br_npc);
320 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
321 vpc = iq2000bf_pbb_cti_chain (current_cpu, sem_arg,
322 CPU_PBB_BR_TYPE (current_cpu),
323 CPU_PBB_BR_NPC (current_cpu));
332 CASE (sem, INSN_X_CHAIN) : /* --chain-- */
334 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
335 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
336 #define FLD(f) abuf->fields.sfmt_empty.f
337 int UNUSED written = 0;
338 IADDR UNUSED pc = abuf->addr;
339 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
342 #if WITH_SCACHE_PBB_IQ2000BF
343 vpc = iq2000bf_pbb_chain (current_cpu, sem_arg);
354 CASE (sem, INSN_X_BEGIN) : /* --begin-- */
356 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
357 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
358 #define FLD(f) abuf->fields.sfmt_empty.f
359 int UNUSED written = 0;
360 IADDR UNUSED pc = abuf->addr;
361 vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
364 #if WITH_SCACHE_PBB_IQ2000BF
365 #if defined DEFINE_SWITCH || defined FAST_P
366 /* In the switch case FAST_P is a constant, allowing several optimizations
367 in any called inline functions. */
368 vpc = iq2000bf_pbb_begin (current_cpu, FAST_P);
370 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
371 vpc = iq2000bf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
373 vpc = iq2000bf_pbb_begin (current_cpu, 0);
383 CASE (sem, INSN_ADD) : /* add $rd,$rs,$rt */
385 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
386 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
387 #define FLD(f) abuf->fields.sfmt_mrgb.f
388 int UNUSED written = 0;
389 IADDR UNUSED pc = abuf->addr;
390 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
393 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
394 SET_H_GR (FLD (f_rd), opval);
395 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
402 CASE (sem, INSN_ADDI) : /* addi $rt,$rs,$lo16 */
404 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
405 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
406 #define FLD(f) abuf->fields.sfmt_addi.f
407 int UNUSED written = 0;
408 IADDR UNUSED pc = abuf->addr;
409 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
412 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
413 SET_H_GR (FLD (f_rt), opval);
414 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
421 CASE (sem, INSN_ADDIU) : /* addiu $rt,$rs,$lo16 */
423 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
424 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
425 #define FLD(f) abuf->fields.sfmt_addi.f
426 int UNUSED written = 0;
427 IADDR UNUSED pc = abuf->addr;
428 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
431 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))));
432 SET_H_GR (FLD (f_rt), opval);
433 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
440 CASE (sem, INSN_ADDU) : /* addu $rd,$rs,$rt */
442 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
443 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
444 #define FLD(f) abuf->fields.sfmt_mrgb.f
445 int UNUSED written = 0;
446 IADDR UNUSED pc = abuf->addr;
447 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
450 SI opval = ADDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
451 SET_H_GR (FLD (f_rd), opval);
452 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
459 CASE (sem, INSN_ADO16) : /* ado16 $rd,$rs,$rt */
461 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
462 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
463 #define FLD(f) abuf->fields.sfmt_mrgb.f
464 int UNUSED written = 0;
465 IADDR UNUSED pc = abuf->addr;
466 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
471 tmp_low = ADDHI (ANDHI (GET_H_GR (FLD (f_rs)), 65535), ANDHI (GET_H_GR (FLD (f_rt)), 65535));
472 tmp_high = ADDHI (SRLSI (GET_H_GR (FLD (f_rs)), 16), SRLSI (GET_H_GR (FLD (f_rt)), 16));
474 SI opval = ORSI (SLLSI (tmp_high, 16), tmp_low);
475 SET_H_GR (FLD (f_rd), opval);
476 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
484 CASE (sem, INSN_AND) : /* and $rd,$rs,$rt */
486 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
487 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
488 #define FLD(f) abuf->fields.sfmt_mrgb.f
489 int UNUSED written = 0;
490 IADDR UNUSED pc = abuf->addr;
491 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
494 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
495 SET_H_GR (FLD (f_rd), opval);
496 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
503 CASE (sem, INSN_ANDI) : /* andi $rt,$rs,$lo16 */
505 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
506 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
507 #define FLD(f) abuf->fields.sfmt_addi.f
508 int UNUSED written = 0;
509 IADDR UNUSED pc = abuf->addr;
510 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
513 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
514 SET_H_GR (FLD (f_rt), opval);
515 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
522 CASE (sem, INSN_ANDOI) : /* andoi $rt,$rs,$lo16 */
524 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
525 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
526 #define FLD(f) abuf->fields.sfmt_addi.f
527 int UNUSED written = 0;
528 IADDR UNUSED pc = abuf->addr;
529 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
532 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ORSI (0xffff0000, EXTHISI (TRUNCSIHI (FLD (f_imm)))));
533 SET_H_GR (FLD (f_rt), opval);
534 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
541 CASE (sem, INSN_NOR) : /* nor $rd,$rs,$rt */
543 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
544 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
545 #define FLD(f) abuf->fields.sfmt_mrgb.f
546 int UNUSED written = 0;
547 IADDR UNUSED pc = abuf->addr;
548 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
551 SI opval = INVSI (ORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt))));
552 SET_H_GR (FLD (f_rd), opval);
553 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
560 CASE (sem, INSN_OR) : /* or $rd,$rs,$rt */
562 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
563 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
564 #define FLD(f) abuf->fields.sfmt_mrgb.f
565 int UNUSED written = 0;
566 IADDR UNUSED pc = abuf->addr;
567 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
570 SI opval = ORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
571 SET_H_GR (FLD (f_rd), opval);
572 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
579 CASE (sem, INSN_ORI) : /* ori $rt,$rs,$lo16 */
581 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
582 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
583 #define FLD(f) abuf->fields.sfmt_addi.f
584 int UNUSED written = 0;
585 IADDR UNUSED pc = abuf->addr;
586 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
589 SI opval = ORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
590 SET_H_GR (FLD (f_rt), opval);
591 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
598 CASE (sem, INSN_RAM) : /* ram $rd,$rt,$shamt,$maskl,$maskr */
600 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
601 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
602 #define FLD(f) abuf->fields.sfmt_ram.f
603 int UNUSED written = 0;
604 IADDR UNUSED pc = abuf->addr;
605 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
609 SI opval = RORSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
610 SET_H_GR (FLD (f_rd), opval);
611 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
614 SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SRLSI (0xffffffff, FLD (f_maskl)));
615 SET_H_GR (FLD (f_rd), opval);
616 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
619 SI opval = ANDSI (GET_H_GR (FLD (f_rd)), SLLSI (0xffffffff, FLD (f_rs)));
620 SET_H_GR (FLD (f_rd), opval);
621 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
629 CASE (sem, INSN_SLL) : /* sll $rd,$rt,$shamt */
631 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
632 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
633 #define FLD(f) abuf->fields.sfmt_ram.f
634 int UNUSED written = 0;
635 IADDR UNUSED pc = abuf->addr;
636 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
639 SI opval = SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
640 SET_H_GR (FLD (f_rd), opval);
641 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
648 CASE (sem, INSN_SLLV) : /* sllv $rd,$rt,$rs */
650 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
651 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
652 #define FLD(f) abuf->fields.sfmt_mrgb.f
653 int UNUSED written = 0;
654 IADDR UNUSED pc = abuf->addr;
655 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
658 SI opval = SLLSI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
659 SET_H_GR (FLD (f_rd), opval);
660 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
667 CASE (sem, INSN_SLMV) : /* slmv $rd,$rt,$rs,$shamt */
669 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
670 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
671 #define FLD(f) abuf->fields.sfmt_ram.f
672 int UNUSED written = 0;
673 IADDR UNUSED pc = abuf->addr;
674 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
677 SI opval = ANDSI (SLLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt)), SRLSI (0xffffffff, GET_H_GR (FLD (f_rs))));
678 SET_H_GR (FLD (f_rd), opval);
679 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
686 CASE (sem, INSN_SLT) : /* slt $rd,$rs,$rt */
688 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
689 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
690 #define FLD(f) abuf->fields.sfmt_mrgb.f
691 int UNUSED written = 0;
692 IADDR UNUSED pc = abuf->addr;
693 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
695 if (LTSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
698 SET_H_GR (FLD (f_rd), opval);
700 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
705 SET_H_GR (FLD (f_rd), opval);
707 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
711 abuf->written = written;
716 CASE (sem, INSN_SLTI) : /* slti $rt,$rs,$imm */
718 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
719 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
720 #define FLD(f) abuf->fields.sfmt_addi.f
721 int UNUSED written = 0;
722 IADDR UNUSED pc = abuf->addr;
723 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
725 if (LTSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
728 SET_H_GR (FLD (f_rt), opval);
730 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
735 SET_H_GR (FLD (f_rt), opval);
737 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
741 abuf->written = written;
746 CASE (sem, INSN_SLTIU) : /* sltiu $rt,$rs,$imm */
748 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
749 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
750 #define FLD(f) abuf->fields.sfmt_addi.f
751 int UNUSED written = 0;
752 IADDR UNUSED pc = abuf->addr;
753 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
755 if (LTUSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))) {
758 SET_H_GR (FLD (f_rt), opval);
760 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
765 SET_H_GR (FLD (f_rt), opval);
767 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
771 abuf->written = written;
776 CASE (sem, INSN_SLTU) : /* sltu $rd,$rs,$rt */
778 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
779 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
780 #define FLD(f) abuf->fields.sfmt_mrgb.f
781 int UNUSED written = 0;
782 IADDR UNUSED pc = abuf->addr;
783 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
785 if (LTUSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
788 SET_H_GR (FLD (f_rd), opval);
790 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
795 SET_H_GR (FLD (f_rd), opval);
797 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
801 abuf->written = written;
806 CASE (sem, INSN_SRA) : /* sra $rd,$rt,$shamt */
808 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
809 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
810 #define FLD(f) abuf->fields.sfmt_ram.f
811 int UNUSED written = 0;
812 IADDR UNUSED pc = abuf->addr;
813 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
816 SI opval = SRASI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
817 SET_H_GR (FLD (f_rd), opval);
818 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
825 CASE (sem, INSN_SRAV) : /* srav $rd,$rt,$rs */
827 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
828 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
829 #define FLD(f) abuf->fields.sfmt_mrgb.f
830 int UNUSED written = 0;
831 IADDR UNUSED pc = abuf->addr;
832 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
835 SI opval = SRASI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
836 SET_H_GR (FLD (f_rd), opval);
837 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
844 CASE (sem, INSN_SRL) : /* srl $rd,$rt,$shamt */
846 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
847 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
848 #define FLD(f) abuf->fields.sfmt_ram.f
849 int UNUSED written = 0;
850 IADDR UNUSED pc = abuf->addr;
851 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
854 SI opval = SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt));
855 SET_H_GR (FLD (f_rd), opval);
856 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
863 CASE (sem, INSN_SRLV) : /* srlv $rd,$rt,$rs */
865 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
866 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
867 #define FLD(f) abuf->fields.sfmt_mrgb.f
868 int UNUSED written = 0;
869 IADDR UNUSED pc = abuf->addr;
870 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
873 SI opval = SRLSI (GET_H_GR (FLD (f_rt)), ANDSI (GET_H_GR (FLD (f_rs)), 31));
874 SET_H_GR (FLD (f_rd), opval);
875 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
882 CASE (sem, INSN_SRMV) : /* srmv $rd,$rt,$rs,$shamt */
884 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
885 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
886 #define FLD(f) abuf->fields.sfmt_ram.f
887 int UNUSED written = 0;
888 IADDR UNUSED pc = abuf->addr;
889 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
892 SI opval = ANDSI (SRLSI (GET_H_GR (FLD (f_rt)), FLD (f_shamt)), SLLSI (0xffffffff, GET_H_GR (FLD (f_rs))));
893 SET_H_GR (FLD (f_rd), opval);
894 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
901 CASE (sem, INSN_SUB) : /* sub $rd,$rs,$rt */
903 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
904 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
905 #define FLD(f) abuf->fields.sfmt_mrgb.f
906 int UNUSED written = 0;
907 IADDR UNUSED pc = abuf->addr;
908 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
911 SI opval = SUBSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
912 SET_H_GR (FLD (f_rd), opval);
913 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
920 CASE (sem, INSN_SUBU) : /* subu $rd,$rs,$rt */
922 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
923 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
924 #define FLD(f) abuf->fields.sfmt_mrgb.f
925 int UNUSED written = 0;
926 IADDR UNUSED pc = abuf->addr;
927 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
930 SI opval = SUBSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
931 SET_H_GR (FLD (f_rd), opval);
932 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
939 CASE (sem, INSN_XOR) : /* xor $rd,$rs,$rt */
941 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
942 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
943 #define FLD(f) abuf->fields.sfmt_mrgb.f
944 int UNUSED written = 0;
945 IADDR UNUSED pc = abuf->addr;
946 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
949 SI opval = XORSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)));
950 SET_H_GR (FLD (f_rd), opval);
951 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
958 CASE (sem, INSN_XORI) : /* xori $rt,$rs,$lo16 */
960 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
961 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
962 #define FLD(f) abuf->fields.sfmt_addi.f
963 int UNUSED written = 0;
964 IADDR UNUSED pc = abuf->addr;
965 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
968 SI opval = XORSI (GET_H_GR (FLD (f_rs)), ZEXTSISI (FLD (f_imm)));
969 SET_H_GR (FLD (f_rt), opval);
970 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
977 CASE (sem, INSN_BBI) : /* bbi $rs($bitnum),$offset */
979 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
980 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
981 #define FLD(f) abuf->fields.sfmt_bbi.f
982 int UNUSED written = 0;
983 IADDR UNUSED pc = abuf->addr;
985 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
987 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt)))) {
990 USI opval = FLD (i_offset);
991 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
993 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
998 abuf->written = written;
999 SEM_BRANCH_FINI (vpc);
1004 CASE (sem, INSN_BBIN) : /* bbin $rs($bitnum),$offset */
1006 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1007 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1008 #define FLD(f) abuf->fields.sfmt_bbi.f
1009 int UNUSED written = 0;
1010 IADDR UNUSED pc = abuf->addr;
1012 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1014 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, FLD (f_rt))))) {
1017 USI opval = FLD (i_offset);
1018 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1019 written |= (1 << 3);
1020 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1025 abuf->written = written;
1026 SEM_BRANCH_FINI (vpc);
1031 CASE (sem, INSN_BBV) : /* bbv $rs,$rt,$offset */
1033 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1034 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1035 #define FLD(f) abuf->fields.sfmt_bbi.f
1036 int UNUSED written = 0;
1037 IADDR UNUSED pc = abuf->addr;
1039 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1041 if (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31)))) {
1044 USI opval = FLD (i_offset);
1045 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1046 written |= (1 << 3);
1047 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1052 abuf->written = written;
1053 SEM_BRANCH_FINI (vpc);
1058 CASE (sem, INSN_BBVN) : /* bbvn $rs,$rt,$offset */
1060 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1061 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1062 #define FLD(f) abuf->fields.sfmt_bbi.f
1063 int UNUSED written = 0;
1064 IADDR UNUSED pc = abuf->addr;
1066 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1068 if (NOTSI (ANDSI (GET_H_GR (FLD (f_rs)), SLLSI (1, ANDSI (GET_H_GR (FLD (f_rt)), 31))))) {
1071 USI opval = FLD (i_offset);
1072 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1073 written |= (1 << 3);
1074 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1079 abuf->written = written;
1080 SEM_BRANCH_FINI (vpc);
1085 CASE (sem, INSN_BEQ) : /* beq $rs,$rt,$offset */
1087 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1088 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1089 #define FLD(f) abuf->fields.sfmt_bbi.f
1090 int UNUSED written = 0;
1091 IADDR UNUSED pc = abuf->addr;
1093 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1095 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1098 USI opval = FLD (i_offset);
1099 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1100 written |= (1 << 3);
1101 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1106 abuf->written = written;
1107 SEM_BRANCH_FINI (vpc);
1112 CASE (sem, INSN_BEQL) : /* beql $rs,$rt,$offset */
1114 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1115 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1116 #define FLD(f) abuf->fields.sfmt_bbi.f
1117 int UNUSED written = 0;
1118 IADDR UNUSED pc = abuf->addr;
1120 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1122 if (EQSI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1125 USI opval = FLD (i_offset);
1126 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1127 written |= (1 << 3);
1128 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1133 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1136 abuf->written = written;
1137 SEM_BRANCH_FINI (vpc);
1142 CASE (sem, INSN_BGEZ) : /* bgez $rs,$offset */
1144 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1145 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1146 #define FLD(f) abuf->fields.sfmt_bbi.f
1147 int UNUSED written = 0;
1148 IADDR UNUSED pc = abuf->addr;
1150 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1152 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1155 USI opval = FLD (i_offset);
1156 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1157 written |= (1 << 2);
1158 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1163 abuf->written = written;
1164 SEM_BRANCH_FINI (vpc);
1169 CASE (sem, INSN_BGEZAL) : /* bgezal $rs,$offset */
1171 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1172 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1173 #define FLD(f) abuf->fields.sfmt_bbi.f
1174 int UNUSED written = 0;
1175 IADDR UNUSED pc = abuf->addr;
1177 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1179 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1182 SI opval = ADDSI (pc, 8);
1183 SET_H_GR (((UINT) 31), opval);
1184 written |= (1 << 3);
1185 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1189 USI opval = FLD (i_offset);
1190 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1191 written |= (1 << 4);
1192 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1198 abuf->written = written;
1199 SEM_BRANCH_FINI (vpc);
1204 CASE (sem, INSN_BGEZALL) : /* bgezall $rs,$offset */
1206 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1207 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1208 #define FLD(f) abuf->fields.sfmt_bbi.f
1209 int UNUSED written = 0;
1210 IADDR UNUSED pc = abuf->addr;
1212 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1214 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1217 SI opval = ADDSI (pc, 8);
1218 SET_H_GR (((UINT) 31), opval);
1219 written |= (1 << 3);
1220 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1224 USI opval = FLD (i_offset);
1225 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1226 written |= (1 << 4);
1227 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1233 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1236 abuf->written = written;
1237 SEM_BRANCH_FINI (vpc);
1242 CASE (sem, INSN_BGEZL) : /* bgezl $rs,$offset */
1244 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1245 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1246 #define FLD(f) abuf->fields.sfmt_bbi.f
1247 int UNUSED written = 0;
1248 IADDR UNUSED pc = abuf->addr;
1250 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1252 if (GESI (GET_H_GR (FLD (f_rs)), 0)) {
1255 USI opval = FLD (i_offset);
1256 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1257 written |= (1 << 2);
1258 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1263 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1266 abuf->written = written;
1267 SEM_BRANCH_FINI (vpc);
1272 CASE (sem, INSN_BLTZ) : /* bltz $rs,$offset */
1274 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1275 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1276 #define FLD(f) abuf->fields.sfmt_bbi.f
1277 int UNUSED written = 0;
1278 IADDR UNUSED pc = abuf->addr;
1280 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1282 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1285 USI opval = FLD (i_offset);
1286 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1287 written |= (1 << 2);
1288 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1293 abuf->written = written;
1294 SEM_BRANCH_FINI (vpc);
1299 CASE (sem, INSN_BLTZL) : /* bltzl $rs,$offset */
1301 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1302 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1303 #define FLD(f) abuf->fields.sfmt_bbi.f
1304 int UNUSED written = 0;
1305 IADDR UNUSED pc = abuf->addr;
1307 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1309 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1312 USI opval = FLD (i_offset);
1313 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1314 written |= (1 << 2);
1315 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1320 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1323 abuf->written = written;
1324 SEM_BRANCH_FINI (vpc);
1329 CASE (sem, INSN_BLTZAL) : /* bltzal $rs,$offset */
1331 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1332 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1333 #define FLD(f) abuf->fields.sfmt_bbi.f
1334 int UNUSED written = 0;
1335 IADDR UNUSED pc = abuf->addr;
1337 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1339 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1342 SI opval = ADDSI (pc, 8);
1343 SET_H_GR (((UINT) 31), opval);
1344 written |= (1 << 3);
1345 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1349 USI opval = FLD (i_offset);
1350 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1351 written |= (1 << 4);
1352 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1358 abuf->written = written;
1359 SEM_BRANCH_FINI (vpc);
1364 CASE (sem, INSN_BLTZALL) : /* bltzall $rs,$offset */
1366 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1367 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1368 #define FLD(f) abuf->fields.sfmt_bbi.f
1369 int UNUSED written = 0;
1370 IADDR UNUSED pc = abuf->addr;
1372 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1374 if (LTSI (GET_H_GR (FLD (f_rs)), 0)) {
1377 SI opval = ADDSI (pc, 8);
1378 SET_H_GR (((UINT) 31), opval);
1379 written |= (1 << 3);
1380 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1384 USI opval = FLD (i_offset);
1385 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1386 written |= (1 << 4);
1387 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1393 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1396 abuf->written = written;
1397 SEM_BRANCH_FINI (vpc);
1402 CASE (sem, INSN_BMB0) : /* bmb0 $rs,$rt,$offset */
1404 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1405 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1406 #define FLD(f) abuf->fields.sfmt_bbi.f
1407 int UNUSED written = 0;
1408 IADDR UNUSED pc = abuf->addr;
1410 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1412 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
1415 USI opval = FLD (i_offset);
1416 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1417 written |= (1 << 3);
1418 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1423 abuf->written = written;
1424 SEM_BRANCH_FINI (vpc);
1429 CASE (sem, INSN_BMB1) : /* bmb1 $rs,$rt,$offset */
1431 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1432 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1433 #define FLD(f) abuf->fields.sfmt_bbi.f
1434 int UNUSED written = 0;
1435 IADDR UNUSED pc = abuf->addr;
1437 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1439 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
1442 USI opval = FLD (i_offset);
1443 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1444 written |= (1 << 3);
1445 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1450 abuf->written = written;
1451 SEM_BRANCH_FINI (vpc);
1456 CASE (sem, INSN_BMB2) : /* bmb2 $rs,$rt,$offset */
1458 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1459 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1460 #define FLD(f) abuf->fields.sfmt_bbi.f
1461 int UNUSED written = 0;
1462 IADDR UNUSED pc = abuf->addr;
1464 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1466 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
1469 USI opval = FLD (i_offset);
1470 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1471 written |= (1 << 3);
1472 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1477 abuf->written = written;
1478 SEM_BRANCH_FINI (vpc);
1483 CASE (sem, INSN_BMB3) : /* bmb3 $rs,$rt,$offset */
1485 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1486 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1487 #define FLD(f) abuf->fields.sfmt_bbi.f
1488 int UNUSED written = 0;
1489 IADDR UNUSED pc = abuf->addr;
1491 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1493 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
1496 USI opval = FLD (i_offset);
1497 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1498 written |= (1 << 3);
1499 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1504 abuf->written = written;
1505 SEM_BRANCH_FINI (vpc);
1510 CASE (sem, INSN_BNE) : /* bne $rs,$rt,$offset */
1512 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1513 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1514 #define FLD(f) abuf->fields.sfmt_bbi.f
1515 int UNUSED written = 0;
1516 IADDR UNUSED pc = abuf->addr;
1518 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1520 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1523 USI opval = FLD (i_offset);
1524 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1525 written |= (1 << 3);
1526 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1531 abuf->written = written;
1532 SEM_BRANCH_FINI (vpc);
1537 CASE (sem, INSN_BNEL) : /* bnel $rs,$rt,$offset */
1539 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1540 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1541 #define FLD(f) abuf->fields.sfmt_bbi.f
1542 int UNUSED written = 0;
1543 IADDR UNUSED pc = abuf->addr;
1545 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1547 if (NESI (GET_H_GR (FLD (f_rs)), GET_H_GR (FLD (f_rt)))) {
1550 USI opval = FLD (i_offset);
1551 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1552 written |= (1 << 3);
1553 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1558 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1561 abuf->written = written;
1562 SEM_BRANCH_FINI (vpc);
1567 CASE (sem, INSN_JALR) : /* jalr $rd,$rs */
1569 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1570 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1571 #define FLD(f) abuf->fields.sfmt_mrgb.f
1572 int UNUSED written = 0;
1573 IADDR UNUSED pc = abuf->addr;
1575 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1580 SI opval = ADDSI (pc, 8);
1581 SET_H_GR (FLD (f_rd), opval);
1582 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1585 USI opval = GET_H_GR (FLD (f_rs));
1586 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1587 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1592 SEM_BRANCH_FINI (vpc);
1597 CASE (sem, INSN_JR) : /* jr $rs */
1599 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1600 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1601 #define FLD(f) abuf->fields.sfmt_bbi.f
1602 int UNUSED written = 0;
1603 IADDR UNUSED pc = abuf->addr;
1605 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1609 USI opval = GET_H_GR (FLD (f_rs));
1610 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1611 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1615 SEM_BRANCH_FINI (vpc);
1620 CASE (sem, INSN_LB) : /* lb $rt,$lo16($base) */
1622 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1623 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1624 #define FLD(f) abuf->fields.sfmt_addi.f
1625 int UNUSED written = 0;
1626 IADDR UNUSED pc = abuf->addr;
1627 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1630 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1631 SET_H_GR (FLD (f_rt), opval);
1632 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1639 CASE (sem, INSN_LBU) : /* lbu $rt,$lo16($base) */
1641 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1642 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1643 #define FLD(f) abuf->fields.sfmt_addi.f
1644 int UNUSED written = 0;
1645 IADDR UNUSED pc = abuf->addr;
1646 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1649 SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1650 SET_H_GR (FLD (f_rt), opval);
1651 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1658 CASE (sem, INSN_LH) : /* lh $rt,$lo16($base) */
1660 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1661 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1662 #define FLD(f) abuf->fields.sfmt_addi.f
1663 int UNUSED written = 0;
1664 IADDR UNUSED pc = abuf->addr;
1665 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1668 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1669 SET_H_GR (FLD (f_rt), opval);
1670 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1677 CASE (sem, INSN_LHU) : /* lhu $rt,$lo16($base) */
1679 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1680 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1681 #define FLD(f) abuf->fields.sfmt_addi.f
1682 int UNUSED written = 0;
1683 IADDR UNUSED pc = abuf->addr;
1684 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1687 SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm))))));
1688 SET_H_GR (FLD (f_rt), opval);
1689 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1696 CASE (sem, INSN_LUI) : /* lui $rt,$hi16 */
1698 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1699 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1700 #define FLD(f) abuf->fields.sfmt_addi.f
1701 int UNUSED written = 0;
1702 IADDR UNUSED pc = abuf->addr;
1703 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1706 SI opval = SLLSI (FLD (f_imm), 16);
1707 SET_H_GR (FLD (f_rt), opval);
1708 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1715 CASE (sem, INSN_LW) : /* lw $rt,$lo16($base) */
1717 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1718 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1719 #define FLD(f) abuf->fields.sfmt_addi.f
1720 int UNUSED written = 0;
1721 IADDR UNUSED pc = abuf->addr;
1722 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1725 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))));
1726 SET_H_GR (FLD (f_rt), opval);
1727 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1734 CASE (sem, INSN_SB) : /* sb $rt,$lo16($base) */
1736 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1737 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1738 #define FLD(f) abuf->fields.sfmt_addi.f
1739 int UNUSED written = 0;
1740 IADDR UNUSED pc = abuf->addr;
1741 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1744 QI opval = ANDQI (GET_H_GR (FLD (f_rt)), 255);
1745 SETMEMQI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1746 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1753 CASE (sem, INSN_SH) : /* sh $rt,$lo16($base) */
1755 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1756 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1757 #define FLD(f) abuf->fields.sfmt_addi.f
1758 int UNUSED written = 0;
1759 IADDR UNUSED pc = abuf->addr;
1760 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1763 HI opval = ANDHI (GET_H_GR (FLD (f_rt)), 65535);
1764 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1765 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1772 CASE (sem, INSN_SW) : /* sw $rt,$lo16($base) */
1774 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1775 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1776 #define FLD(f) abuf->fields.sfmt_addi.f
1777 int UNUSED written = 0;
1778 IADDR UNUSED pc = abuf->addr;
1779 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1782 SI opval = GET_H_GR (FLD (f_rt));
1783 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GR (FLD (f_rs)), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval);
1784 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
1791 CASE (sem, INSN_BREAK) : /* break */
1793 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1794 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1795 #define FLD(f) abuf->fields.sfmt_empty.f
1796 int UNUSED written = 0;
1797 IADDR UNUSED pc = abuf->addr;
1798 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1800 do_break (current_cpu, pc);
1806 CASE (sem, INSN_SYSCALL) : /* syscall */
1808 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1809 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1810 #define FLD(f) abuf->fields.sfmt_empty.f
1811 int UNUSED written = 0;
1812 IADDR UNUSED pc = abuf->addr;
1813 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1815 do_syscall (current_cpu);
1821 CASE (sem, INSN_ANDOUI) : /* andoui $rt,$rs,$hi16 */
1823 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1824 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1825 #define FLD(f) abuf->fields.sfmt_addi.f
1826 int UNUSED written = 0;
1827 IADDR UNUSED pc = abuf->addr;
1828 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1831 SI opval = ANDSI (GET_H_GR (FLD (f_rs)), ORSI (SLLSI (FLD (f_imm), 16), 65535));
1832 SET_H_GR (FLD (f_rt), opval);
1833 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1840 CASE (sem, INSN_ORUI) : /* orui $rt,$rs,$hi16 */
1842 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1843 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1844 #define FLD(f) abuf->fields.sfmt_addi.f
1845 int UNUSED written = 0;
1846 IADDR UNUSED pc = abuf->addr;
1847 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1850 SI opval = ORSI (GET_H_GR (FLD (f_rs)), SLLSI (FLD (f_imm), 16));
1851 SET_H_GR (FLD (f_rt), opval);
1852 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
1859 CASE (sem, INSN_BGTZ) : /* bgtz $rs,$offset */
1861 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1862 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1863 #define FLD(f) abuf->fields.sfmt_bbi.f
1864 int UNUSED written = 0;
1865 IADDR UNUSED pc = abuf->addr;
1867 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1869 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1872 USI opval = FLD (i_offset);
1873 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1874 written |= (1 << 2);
1875 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1880 abuf->written = written;
1881 SEM_BRANCH_FINI (vpc);
1886 CASE (sem, INSN_BGTZL) : /* bgtzl $rs,$offset */
1888 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1889 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1890 #define FLD(f) abuf->fields.sfmt_bbi.f
1891 int UNUSED written = 0;
1892 IADDR UNUSED pc = abuf->addr;
1894 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1896 if (GTSI (GET_H_GR (FLD (f_rs)), 0)) {
1899 USI opval = FLD (i_offset);
1900 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1901 written |= (1 << 2);
1902 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1907 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1910 abuf->written = written;
1911 SEM_BRANCH_FINI (vpc);
1916 CASE (sem, INSN_BLEZ) : /* blez $rs,$offset */
1918 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1919 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1920 #define FLD(f) abuf->fields.sfmt_bbi.f
1921 int UNUSED written = 0;
1922 IADDR UNUSED pc = abuf->addr;
1924 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1926 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1929 USI opval = FLD (i_offset);
1930 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1931 written |= (1 << 2);
1932 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1937 abuf->written = written;
1938 SEM_BRANCH_FINI (vpc);
1943 CASE (sem, INSN_BLEZL) : /* blezl $rs,$offset */
1945 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1946 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1947 #define FLD(f) abuf->fields.sfmt_bbi.f
1948 int UNUSED written = 0;
1949 IADDR UNUSED pc = abuf->addr;
1951 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1953 if (LESI (GET_H_GR (FLD (f_rs)), 0)) {
1956 USI opval = FLD (i_offset);
1957 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
1958 written |= (1 << 2);
1959 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1964 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
1967 abuf->written = written;
1968 SEM_BRANCH_FINI (vpc);
1973 CASE (sem, INSN_MRGB) : /* mrgb $rd,$rs,$rt,$mask */
1975 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
1976 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1977 #define FLD(f) abuf->fields.sfmt_mrgb.f
1978 int UNUSED written = 0;
1979 IADDR UNUSED pc = abuf->addr;
1980 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1984 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 0)))) {
1985 tmp_temp = ANDSI (GET_H_GR (FLD (f_rs)), 255);
1987 tmp_temp = ANDSI (GET_H_GR (FLD (f_rt)), 255);
1989 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 1)))) {
1990 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 65280));
1992 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 65280));
1994 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 2)))) {
1995 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 16711680));
1997 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 16711680));
1999 if (NOTSI (ANDSI (FLD (f_mask), SLLSI (1, 3)))) {
2000 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000));
2002 tmp_temp = ORSI (tmp_temp, ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000));
2005 SI opval = tmp_temp;
2006 SET_H_GR (FLD (f_rd), opval);
2007 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
2015 CASE (sem, INSN_BCTXT) : /* bctxt $rs,$offset */
2017 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2018 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2019 #define FLD(f) abuf->fields.sfmt_empty.f
2020 int UNUSED written = 0;
2021 IADDR UNUSED pc = abuf->addr;
2023 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2027 SEM_BRANCH_FINI (vpc);
2032 CASE (sem, INSN_BC0F) : /* bc0f $offset */
2034 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2035 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2036 #define FLD(f) abuf->fields.sfmt_empty.f
2037 int UNUSED written = 0;
2038 IADDR UNUSED pc = abuf->addr;
2040 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2044 SEM_BRANCH_FINI (vpc);
2049 CASE (sem, INSN_BC0FL) : /* bc0fl $offset */
2051 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2052 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2053 #define FLD(f) abuf->fields.sfmt_empty.f
2054 int UNUSED written = 0;
2055 IADDR UNUSED pc = abuf->addr;
2057 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2061 SEM_BRANCH_FINI (vpc);
2066 CASE (sem, INSN_BC3F) : /* bc3f $offset */
2068 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2069 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2070 #define FLD(f) abuf->fields.sfmt_empty.f
2071 int UNUSED written = 0;
2072 IADDR UNUSED pc = abuf->addr;
2074 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2078 SEM_BRANCH_FINI (vpc);
2083 CASE (sem, INSN_BC3FL) : /* bc3fl $offset */
2085 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2086 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2087 #define FLD(f) abuf->fields.sfmt_empty.f
2088 int UNUSED written = 0;
2089 IADDR UNUSED pc = abuf->addr;
2091 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2095 SEM_BRANCH_FINI (vpc);
2100 CASE (sem, INSN_BC0T) : /* bc0t $offset */
2102 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2103 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2104 #define FLD(f) abuf->fields.sfmt_empty.f
2105 int UNUSED written = 0;
2106 IADDR UNUSED pc = abuf->addr;
2108 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2112 SEM_BRANCH_FINI (vpc);
2117 CASE (sem, INSN_BC0TL) : /* bc0tl $offset */
2119 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2120 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2121 #define FLD(f) abuf->fields.sfmt_empty.f
2122 int UNUSED written = 0;
2123 IADDR UNUSED pc = abuf->addr;
2125 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2129 SEM_BRANCH_FINI (vpc);
2134 CASE (sem, INSN_BC3T) : /* bc3t $offset */
2136 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2137 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2138 #define FLD(f) abuf->fields.sfmt_empty.f
2139 int UNUSED written = 0;
2140 IADDR UNUSED pc = abuf->addr;
2142 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2146 SEM_BRANCH_FINI (vpc);
2151 CASE (sem, INSN_BC3TL) : /* bc3tl $offset */
2153 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2154 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2155 #define FLD(f) abuf->fields.sfmt_empty.f
2156 int UNUSED written = 0;
2157 IADDR UNUSED pc = abuf->addr;
2159 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2163 SEM_BRANCH_FINI (vpc);
2168 CASE (sem, INSN_CFC0) : /* cfc0 $rt,$rd */
2170 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2171 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2172 #define FLD(f) abuf->fields.sfmt_empty.f
2173 int UNUSED written = 0;
2174 IADDR UNUSED pc = abuf->addr;
2175 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2183 CASE (sem, INSN_CFC1) : /* cfc1 $rt,$rd */
2185 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2186 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2187 #define FLD(f) abuf->fields.sfmt_empty.f
2188 int UNUSED written = 0;
2189 IADDR UNUSED pc = abuf->addr;
2190 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2198 CASE (sem, INSN_CFC2) : /* cfc2 $rt,$rd */
2200 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2201 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2202 #define FLD(f) abuf->fields.sfmt_empty.f
2203 int UNUSED written = 0;
2204 IADDR UNUSED pc = abuf->addr;
2205 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2213 CASE (sem, INSN_CFC3) : /* cfc3 $rt,$rd */
2215 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2216 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2217 #define FLD(f) abuf->fields.sfmt_empty.f
2218 int UNUSED written = 0;
2219 IADDR UNUSED pc = abuf->addr;
2220 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2228 CASE (sem, INSN_CHKHDR) : /* chkhdr $rd,$rt */
2230 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2231 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2232 #define FLD(f) abuf->fields.sfmt_empty.f
2233 int UNUSED written = 0;
2234 IADDR UNUSED pc = abuf->addr;
2235 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2243 CASE (sem, INSN_CTC0) : /* ctc0 $rt,$rd */
2245 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2246 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2247 #define FLD(f) abuf->fields.sfmt_empty.f
2248 int UNUSED written = 0;
2249 IADDR UNUSED pc = abuf->addr;
2250 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2258 CASE (sem, INSN_CTC1) : /* ctc1 $rt,$rd */
2260 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2261 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2262 #define FLD(f) abuf->fields.sfmt_empty.f
2263 int UNUSED written = 0;
2264 IADDR UNUSED pc = abuf->addr;
2265 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2273 CASE (sem, INSN_CTC2) : /* ctc2 $rt,$rd */
2275 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2276 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2277 #define FLD(f) abuf->fields.sfmt_empty.f
2278 int UNUSED written = 0;
2279 IADDR UNUSED pc = abuf->addr;
2280 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2288 CASE (sem, INSN_CTC3) : /* ctc3 $rt,$rd */
2290 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2291 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2292 #define FLD(f) abuf->fields.sfmt_empty.f
2293 int UNUSED written = 0;
2294 IADDR UNUSED pc = abuf->addr;
2295 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2303 CASE (sem, INSN_JCR) : /* jcr $rs */
2305 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2306 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2307 #define FLD(f) abuf->fields.sfmt_empty.f
2308 int UNUSED written = 0;
2309 IADDR UNUSED pc = abuf->addr;
2311 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2315 SEM_BRANCH_FINI (vpc);
2320 CASE (sem, INSN_LUC32) : /* luc32 $rt,$rd */
2322 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2323 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2324 #define FLD(f) abuf->fields.sfmt_empty.f
2325 int UNUSED written = 0;
2326 IADDR UNUSED pc = abuf->addr;
2327 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2335 CASE (sem, INSN_LUC32L) : /* luc32l $rt,$rd */
2337 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2338 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2339 #define FLD(f) abuf->fields.sfmt_empty.f
2340 int UNUSED written = 0;
2341 IADDR UNUSED pc = abuf->addr;
2342 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2350 CASE (sem, INSN_LUC64) : /* luc64 $rt,$rd */
2352 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2353 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2354 #define FLD(f) abuf->fields.sfmt_empty.f
2355 int UNUSED written = 0;
2356 IADDR UNUSED pc = abuf->addr;
2357 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2365 CASE (sem, INSN_LUC64L) : /* luc64l $rt,$rd */
2367 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2368 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2369 #define FLD(f) abuf->fields.sfmt_empty.f
2370 int UNUSED written = 0;
2371 IADDR UNUSED pc = abuf->addr;
2372 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2380 CASE (sem, INSN_LUK) : /* luk $rt,$rd */
2382 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2383 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2384 #define FLD(f) abuf->fields.sfmt_empty.f
2385 int UNUSED written = 0;
2386 IADDR UNUSED pc = abuf->addr;
2387 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2395 CASE (sem, INSN_LULCK) : /* lulck $rt */
2397 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2398 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2399 #define FLD(f) abuf->fields.sfmt_empty.f
2400 int UNUSED written = 0;
2401 IADDR UNUSED pc = abuf->addr;
2402 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2410 CASE (sem, INSN_LUM32) : /* lum32 $rt,$rd */
2412 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2413 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2414 #define FLD(f) abuf->fields.sfmt_empty.f
2415 int UNUSED written = 0;
2416 IADDR UNUSED pc = abuf->addr;
2417 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2425 CASE (sem, INSN_LUM32L) : /* lum32l $rt,$rd */
2427 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2428 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2429 #define FLD(f) abuf->fields.sfmt_empty.f
2430 int UNUSED written = 0;
2431 IADDR UNUSED pc = abuf->addr;
2432 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2440 CASE (sem, INSN_LUM64) : /* lum64 $rt,$rd */
2442 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2443 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2444 #define FLD(f) abuf->fields.sfmt_empty.f
2445 int UNUSED written = 0;
2446 IADDR UNUSED pc = abuf->addr;
2447 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2455 CASE (sem, INSN_LUM64L) : /* lum64l $rt,$rd */
2457 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2458 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2459 #define FLD(f) abuf->fields.sfmt_empty.f
2460 int UNUSED written = 0;
2461 IADDR UNUSED pc = abuf->addr;
2462 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2470 CASE (sem, INSN_LUR) : /* lur $rt,$rd */
2472 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2473 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2474 #define FLD(f) abuf->fields.sfmt_empty.f
2475 int UNUSED written = 0;
2476 IADDR UNUSED pc = abuf->addr;
2477 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2485 CASE (sem, INSN_LURL) : /* lurl $rt,$rd */
2487 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2488 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2489 #define FLD(f) abuf->fields.sfmt_empty.f
2490 int UNUSED written = 0;
2491 IADDR UNUSED pc = abuf->addr;
2492 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2500 CASE (sem, INSN_LUULCK) : /* luulck $rt */
2502 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2503 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2504 #define FLD(f) abuf->fields.sfmt_empty.f
2505 int UNUSED written = 0;
2506 IADDR UNUSED pc = abuf->addr;
2507 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2515 CASE (sem, INSN_MFC0) : /* mfc0 $rt,$rd */
2517 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2518 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2519 #define FLD(f) abuf->fields.sfmt_empty.f
2520 int UNUSED written = 0;
2521 IADDR UNUSED pc = abuf->addr;
2522 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2530 CASE (sem, INSN_MFC1) : /* mfc1 $rt,$rd */
2532 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2533 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2534 #define FLD(f) abuf->fields.sfmt_empty.f
2535 int UNUSED written = 0;
2536 IADDR UNUSED pc = abuf->addr;
2537 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2545 CASE (sem, INSN_MFC2) : /* mfc2 $rt,$rd */
2547 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2548 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2549 #define FLD(f) abuf->fields.sfmt_empty.f
2550 int UNUSED written = 0;
2551 IADDR UNUSED pc = abuf->addr;
2552 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2560 CASE (sem, INSN_MFC3) : /* mfc3 $rt,$rd */
2562 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2563 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2564 #define FLD(f) abuf->fields.sfmt_empty.f
2565 int UNUSED written = 0;
2566 IADDR UNUSED pc = abuf->addr;
2567 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2575 CASE (sem, INSN_MTC0) : /* mtc0 $rt,$rd */
2577 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2578 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2579 #define FLD(f) abuf->fields.sfmt_empty.f
2580 int UNUSED written = 0;
2581 IADDR UNUSED pc = abuf->addr;
2582 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2590 CASE (sem, INSN_MTC1) : /* mtc1 $rt,$rd */
2592 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2593 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2594 #define FLD(f) abuf->fields.sfmt_empty.f
2595 int UNUSED written = 0;
2596 IADDR UNUSED pc = abuf->addr;
2597 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2605 CASE (sem, INSN_MTC2) : /* mtc2 $rt,$rd */
2607 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2608 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2609 #define FLD(f) abuf->fields.sfmt_empty.f
2610 int UNUSED written = 0;
2611 IADDR UNUSED pc = abuf->addr;
2612 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2620 CASE (sem, INSN_MTC3) : /* mtc3 $rt,$rd */
2622 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2623 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2624 #define FLD(f) abuf->fields.sfmt_empty.f
2625 int UNUSED written = 0;
2626 IADDR UNUSED pc = abuf->addr;
2627 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2635 CASE (sem, INSN_PKRL) : /* pkrl $rd,$rt */
2637 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2638 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2639 #define FLD(f) abuf->fields.sfmt_empty.f
2640 int UNUSED written = 0;
2641 IADDR UNUSED pc = abuf->addr;
2642 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2650 CASE (sem, INSN_PKRLR1) : /* pkrlr1 $rt,$_index,$count */
2652 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2653 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2654 #define FLD(f) abuf->fields.sfmt_empty.f
2655 int UNUSED written = 0;
2656 IADDR UNUSED pc = abuf->addr;
2657 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2665 CASE (sem, INSN_PKRLR30) : /* pkrlr30 $rt,$_index,$count */
2667 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2668 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2669 #define FLD(f) abuf->fields.sfmt_empty.f
2670 int UNUSED written = 0;
2671 IADDR UNUSED pc = abuf->addr;
2672 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2680 CASE (sem, INSN_RB) : /* rb $rd,$rt */
2682 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2683 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2684 #define FLD(f) abuf->fields.sfmt_empty.f
2685 int UNUSED written = 0;
2686 IADDR UNUSED pc = abuf->addr;
2687 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2695 CASE (sem, INSN_RBR1) : /* rbr1 $rt,$_index,$count */
2697 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2698 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2699 #define FLD(f) abuf->fields.sfmt_empty.f
2700 int UNUSED written = 0;
2701 IADDR UNUSED pc = abuf->addr;
2702 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2710 CASE (sem, INSN_RBR30) : /* rbr30 $rt,$_index,$count */
2712 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2713 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2714 #define FLD(f) abuf->fields.sfmt_empty.f
2715 int UNUSED written = 0;
2716 IADDR UNUSED pc = abuf->addr;
2717 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2725 CASE (sem, INSN_RFE) : /* rfe */
2727 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2728 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2729 #define FLD(f) abuf->fields.sfmt_empty.f
2730 int UNUSED written = 0;
2731 IADDR UNUSED pc = abuf->addr;
2732 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2740 CASE (sem, INSN_RX) : /* rx $rd,$rt */
2742 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2743 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2744 #define FLD(f) abuf->fields.sfmt_empty.f
2745 int UNUSED written = 0;
2746 IADDR UNUSED pc = abuf->addr;
2747 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2755 CASE (sem, INSN_RXR1) : /* rxr1 $rt,$_index,$count */
2757 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2758 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2759 #define FLD(f) abuf->fields.sfmt_empty.f
2760 int UNUSED written = 0;
2761 IADDR UNUSED pc = abuf->addr;
2762 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2770 CASE (sem, INSN_RXR30) : /* rxr30 $rt,$_index,$count */
2772 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2773 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2774 #define FLD(f) abuf->fields.sfmt_empty.f
2775 int UNUSED written = 0;
2776 IADDR UNUSED pc = abuf->addr;
2777 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2785 CASE (sem, INSN_SLEEP) : /* sleep */
2787 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2788 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2789 #define FLD(f) abuf->fields.sfmt_empty.f
2790 int UNUSED written = 0;
2791 IADDR UNUSED pc = abuf->addr;
2792 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2800 CASE (sem, INSN_SRRD) : /* srrd $rt */
2802 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2803 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2804 #define FLD(f) abuf->fields.sfmt_empty.f
2805 int UNUSED written = 0;
2806 IADDR UNUSED pc = abuf->addr;
2807 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2815 CASE (sem, INSN_SRRDL) : /* srrdl $rt */
2817 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2818 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2819 #define FLD(f) abuf->fields.sfmt_empty.f
2820 int UNUSED written = 0;
2821 IADDR UNUSED pc = abuf->addr;
2822 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2830 CASE (sem, INSN_SRULCK) : /* srulck $rt */
2832 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2833 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2834 #define FLD(f) abuf->fields.sfmt_empty.f
2835 int UNUSED written = 0;
2836 IADDR UNUSED pc = abuf->addr;
2837 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2845 CASE (sem, INSN_SRWR) : /* srwr $rt,$rd */
2847 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2848 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2849 #define FLD(f) abuf->fields.sfmt_empty.f
2850 int UNUSED written = 0;
2851 IADDR UNUSED pc = abuf->addr;
2852 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2860 CASE (sem, INSN_SRWRU) : /* srwru $rt,$rd */
2862 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2863 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2864 #define FLD(f) abuf->fields.sfmt_empty.f
2865 int UNUSED written = 0;
2866 IADDR UNUSED pc = abuf->addr;
2867 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2875 CASE (sem, INSN_TRAPQFL) : /* trapqfl */
2877 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2878 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2879 #define FLD(f) abuf->fields.sfmt_empty.f
2880 int UNUSED written = 0;
2881 IADDR UNUSED pc = abuf->addr;
2882 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2890 CASE (sem, INSN_TRAPQNE) : /* trapqne */
2892 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2893 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2894 #define FLD(f) abuf->fields.sfmt_empty.f
2895 int UNUSED written = 0;
2896 IADDR UNUSED pc = abuf->addr;
2897 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2905 CASE (sem, INSN_TRAPREL) : /* traprel $rt */
2907 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2908 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2909 #define FLD(f) abuf->fields.sfmt_empty.f
2910 int UNUSED written = 0;
2911 IADDR UNUSED pc = abuf->addr;
2912 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2920 CASE (sem, INSN_WB) : /* wb $rd,$rt */
2922 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2923 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2924 #define FLD(f) abuf->fields.sfmt_empty.f
2925 int UNUSED written = 0;
2926 IADDR UNUSED pc = abuf->addr;
2927 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2935 CASE (sem, INSN_WBU) : /* wbu $rd,$rt */
2937 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2938 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2939 #define FLD(f) abuf->fields.sfmt_empty.f
2940 int UNUSED written = 0;
2941 IADDR UNUSED pc = abuf->addr;
2942 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2950 CASE (sem, INSN_WBR1) : /* wbr1 $rt,$_index,$count */
2952 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2953 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2954 #define FLD(f) abuf->fields.sfmt_empty.f
2955 int UNUSED written = 0;
2956 IADDR UNUSED pc = abuf->addr;
2957 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2965 CASE (sem, INSN_WBR1U) : /* wbr1u $rt,$_index,$count */
2967 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2968 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2969 #define FLD(f) abuf->fields.sfmt_empty.f
2970 int UNUSED written = 0;
2971 IADDR UNUSED pc = abuf->addr;
2972 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2980 CASE (sem, INSN_WBR30) : /* wbr30 $rt,$_index,$count */
2982 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2983 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2984 #define FLD(f) abuf->fields.sfmt_empty.f
2985 int UNUSED written = 0;
2986 IADDR UNUSED pc = abuf->addr;
2987 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2995 CASE (sem, INSN_WBR30U) : /* wbr30u $rt,$_index,$count */
2997 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
2998 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2999 #define FLD(f) abuf->fields.sfmt_empty.f
3000 int UNUSED written = 0;
3001 IADDR UNUSED pc = abuf->addr;
3002 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3010 CASE (sem, INSN_WX) : /* wx $rd,$rt */
3012 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3013 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3014 #define FLD(f) abuf->fields.sfmt_empty.f
3015 int UNUSED written = 0;
3016 IADDR UNUSED pc = abuf->addr;
3017 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3025 CASE (sem, INSN_WXU) : /* wxu $rd,$rt */
3027 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3028 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3029 #define FLD(f) abuf->fields.sfmt_empty.f
3030 int UNUSED written = 0;
3031 IADDR UNUSED pc = abuf->addr;
3032 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3040 CASE (sem, INSN_WXR1) : /* wxr1 $rt,$_index,$count */
3042 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3043 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3044 #define FLD(f) abuf->fields.sfmt_empty.f
3045 int UNUSED written = 0;
3046 IADDR UNUSED pc = abuf->addr;
3047 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3055 CASE (sem, INSN_WXR1U) : /* wxr1u $rt,$_index,$count */
3057 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3058 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3059 #define FLD(f) abuf->fields.sfmt_empty.f
3060 int UNUSED written = 0;
3061 IADDR UNUSED pc = abuf->addr;
3062 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3070 CASE (sem, INSN_WXR30) : /* wxr30 $rt,$_index,$count */
3072 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3073 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3074 #define FLD(f) abuf->fields.sfmt_empty.f
3075 int UNUSED written = 0;
3076 IADDR UNUSED pc = abuf->addr;
3077 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3085 CASE (sem, INSN_WXR30U) : /* wxr30u $rt,$_index,$count */
3087 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3088 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3089 #define FLD(f) abuf->fields.sfmt_empty.f
3090 int UNUSED written = 0;
3091 IADDR UNUSED pc = abuf->addr;
3092 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3100 CASE (sem, INSN_LDW) : /* ldw $rt,$lo16($base) */
3102 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3103 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3104 #define FLD(f) abuf->fields.sfmt_addi.f
3105 int UNUSED written = 0;
3106 IADDR UNUSED pc = abuf->addr;
3107 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3111 tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3113 SI opval = GETMEMSI (current_cpu, pc, tmp_addr);
3114 SET_H_GR (ADDSI (FLD (f_rt), 1), opval);
3115 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3118 SI opval = GETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4));
3119 SET_H_GR (FLD (f_rt), opval);
3120 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3128 CASE (sem, INSN_SDW) : /* sdw $rt,$lo16($base) */
3130 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3131 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3132 #define FLD(f) abuf->fields.sfmt_addi.f
3133 int UNUSED written = 0;
3134 IADDR UNUSED pc = abuf->addr;
3135 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3139 tmp_addr = ANDSI (ADDSI (GET_H_GR (FLD (f_rs)), FLD (f_imm)), INVSI (3));
3141 SI opval = GET_H_GR (FLD (f_rt));
3142 SETMEMSI (current_cpu, pc, ADDSI (tmp_addr, 4), opval);
3143 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3146 SI opval = GET_H_GR (ADDSI (FLD (f_rt), 1));
3147 SETMEMSI (current_cpu, pc, tmp_addr, opval);
3148 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3156 CASE (sem, INSN_J) : /* j $jmptarg */
3158 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3159 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3160 #define FLD(f) abuf->fields.sfmt_j.f
3161 int UNUSED written = 0;
3162 IADDR UNUSED pc = abuf->addr;
3164 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3168 USI opval = FLD (i_jmptarg);
3169 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3170 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3174 SEM_BRANCH_FINI (vpc);
3179 CASE (sem, INSN_JAL) : /* jal $jmptarg */
3181 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3182 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3183 #define FLD(f) abuf->fields.sfmt_j.f
3184 int UNUSED written = 0;
3185 IADDR UNUSED pc = abuf->addr;
3187 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3192 SI opval = ADDSI (pc, 8);
3193 SET_H_GR (((UINT) 31), opval);
3194 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
3197 USI opval = FLD (i_jmptarg);
3198 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3199 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3204 SEM_BRANCH_FINI (vpc);
3209 CASE (sem, INSN_BMB) : /* bmb $rs,$rt,$offset */
3211 SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
3212 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3213 #define FLD(f) abuf->fields.sfmt_bbi.f
3214 int UNUSED written = 0;
3215 IADDR UNUSED pc = abuf->addr;
3217 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3222 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 255), ANDSI (GET_H_GR (FLD (f_rt)), 255))) {
3225 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 65280), ANDSI (GET_H_GR (FLD (f_rt)), 65280))) {
3228 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 16711680), ANDSI (GET_H_GR (FLD (f_rt)), 16711680))) {
3231 if (EQSI (ANDSI (GET_H_GR (FLD (f_rs)), 0xff000000), ANDSI (GET_H_GR (FLD (f_rt)), 0xff000000))) {
3237 USI opval = FLD (i_offset);
3238 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
3239 written |= (1 << 3);
3240 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
3246 abuf->written = written;
3247 SEM_BRANCH_FINI (vpc);
3254 ENDSWITCH (sem) /* End of semantic switch. */
3256 /* At this point `vpc' contains the next insn to execute. */
3259 #undef DEFINE_SWITCH
3260 #endif /* DEFINE_SWITCH */