1 /* Simulator instruction semantics for m32rbf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2018 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 { M32RBF_INSN_X_INVALID
, && case_sem_INSN_X_INVALID
},
35 { M32RBF_INSN_X_AFTER
, && case_sem_INSN_X_AFTER
},
36 { M32RBF_INSN_X_BEFORE
, && case_sem_INSN_X_BEFORE
},
37 { M32RBF_INSN_X_CTI_CHAIN
, && case_sem_INSN_X_CTI_CHAIN
},
38 { M32RBF_INSN_X_CHAIN
, && case_sem_INSN_X_CHAIN
},
39 { M32RBF_INSN_X_BEGIN
, && case_sem_INSN_X_BEGIN
},
40 { M32RBF_INSN_ADD
, && case_sem_INSN_ADD
},
41 { M32RBF_INSN_ADD3
, && case_sem_INSN_ADD3
},
42 { M32RBF_INSN_AND
, && case_sem_INSN_AND
},
43 { M32RBF_INSN_AND3
, && case_sem_INSN_AND3
},
44 { M32RBF_INSN_OR
, && case_sem_INSN_OR
},
45 { M32RBF_INSN_OR3
, && case_sem_INSN_OR3
},
46 { M32RBF_INSN_XOR
, && case_sem_INSN_XOR
},
47 { M32RBF_INSN_XOR3
, && case_sem_INSN_XOR3
},
48 { M32RBF_INSN_ADDI
, && case_sem_INSN_ADDI
},
49 { M32RBF_INSN_ADDV
, && case_sem_INSN_ADDV
},
50 { M32RBF_INSN_ADDV3
, && case_sem_INSN_ADDV3
},
51 { M32RBF_INSN_ADDX
, && case_sem_INSN_ADDX
},
52 { M32RBF_INSN_BC8
, && case_sem_INSN_BC8
},
53 { M32RBF_INSN_BC24
, && case_sem_INSN_BC24
},
54 { M32RBF_INSN_BEQ
, && case_sem_INSN_BEQ
},
55 { M32RBF_INSN_BEQZ
, && case_sem_INSN_BEQZ
},
56 { M32RBF_INSN_BGEZ
, && case_sem_INSN_BGEZ
},
57 { M32RBF_INSN_BGTZ
, && case_sem_INSN_BGTZ
},
58 { M32RBF_INSN_BLEZ
, && case_sem_INSN_BLEZ
},
59 { M32RBF_INSN_BLTZ
, && case_sem_INSN_BLTZ
},
60 { M32RBF_INSN_BNEZ
, && case_sem_INSN_BNEZ
},
61 { M32RBF_INSN_BL8
, && case_sem_INSN_BL8
},
62 { M32RBF_INSN_BL24
, && case_sem_INSN_BL24
},
63 { M32RBF_INSN_BNC8
, && case_sem_INSN_BNC8
},
64 { M32RBF_INSN_BNC24
, && case_sem_INSN_BNC24
},
65 { M32RBF_INSN_BNE
, && case_sem_INSN_BNE
},
66 { M32RBF_INSN_BRA8
, && case_sem_INSN_BRA8
},
67 { M32RBF_INSN_BRA24
, && case_sem_INSN_BRA24
},
68 { M32RBF_INSN_CMP
, && case_sem_INSN_CMP
},
69 { M32RBF_INSN_CMPI
, && case_sem_INSN_CMPI
},
70 { M32RBF_INSN_CMPU
, && case_sem_INSN_CMPU
},
71 { M32RBF_INSN_CMPUI
, && case_sem_INSN_CMPUI
},
72 { M32RBF_INSN_DIV
, && case_sem_INSN_DIV
},
73 { M32RBF_INSN_DIVU
, && case_sem_INSN_DIVU
},
74 { M32RBF_INSN_REM
, && case_sem_INSN_REM
},
75 { M32RBF_INSN_REMU
, && case_sem_INSN_REMU
},
76 { M32RBF_INSN_JL
, && case_sem_INSN_JL
},
77 { M32RBF_INSN_JMP
, && case_sem_INSN_JMP
},
78 { M32RBF_INSN_LD
, && case_sem_INSN_LD
},
79 { M32RBF_INSN_LD_D
, && case_sem_INSN_LD_D
},
80 { M32RBF_INSN_LDB
, && case_sem_INSN_LDB
},
81 { M32RBF_INSN_LDB_D
, && case_sem_INSN_LDB_D
},
82 { M32RBF_INSN_LDH
, && case_sem_INSN_LDH
},
83 { M32RBF_INSN_LDH_D
, && case_sem_INSN_LDH_D
},
84 { M32RBF_INSN_LDUB
, && case_sem_INSN_LDUB
},
85 { M32RBF_INSN_LDUB_D
, && case_sem_INSN_LDUB_D
},
86 { M32RBF_INSN_LDUH
, && case_sem_INSN_LDUH
},
87 { M32RBF_INSN_LDUH_D
, && case_sem_INSN_LDUH_D
},
88 { M32RBF_INSN_LD_PLUS
, && case_sem_INSN_LD_PLUS
},
89 { M32RBF_INSN_LD24
, && case_sem_INSN_LD24
},
90 { M32RBF_INSN_LDI8
, && case_sem_INSN_LDI8
},
91 { M32RBF_INSN_LDI16
, && case_sem_INSN_LDI16
},
92 { M32RBF_INSN_LOCK
, && case_sem_INSN_LOCK
},
93 { M32RBF_INSN_MACHI
, && case_sem_INSN_MACHI
},
94 { M32RBF_INSN_MACLO
, && case_sem_INSN_MACLO
},
95 { M32RBF_INSN_MACWHI
, && case_sem_INSN_MACWHI
},
96 { M32RBF_INSN_MACWLO
, && case_sem_INSN_MACWLO
},
97 { M32RBF_INSN_MUL
, && case_sem_INSN_MUL
},
98 { M32RBF_INSN_MULHI
, && case_sem_INSN_MULHI
},
99 { M32RBF_INSN_MULLO
, && case_sem_INSN_MULLO
},
100 { M32RBF_INSN_MULWHI
, && case_sem_INSN_MULWHI
},
101 { M32RBF_INSN_MULWLO
, && case_sem_INSN_MULWLO
},
102 { M32RBF_INSN_MV
, && case_sem_INSN_MV
},
103 { M32RBF_INSN_MVFACHI
, && case_sem_INSN_MVFACHI
},
104 { M32RBF_INSN_MVFACLO
, && case_sem_INSN_MVFACLO
},
105 { M32RBF_INSN_MVFACMI
, && case_sem_INSN_MVFACMI
},
106 { M32RBF_INSN_MVFC
, && case_sem_INSN_MVFC
},
107 { M32RBF_INSN_MVTACHI
, && case_sem_INSN_MVTACHI
},
108 { M32RBF_INSN_MVTACLO
, && case_sem_INSN_MVTACLO
},
109 { M32RBF_INSN_MVTC
, && case_sem_INSN_MVTC
},
110 { M32RBF_INSN_NEG
, && case_sem_INSN_NEG
},
111 { M32RBF_INSN_NOP
, && case_sem_INSN_NOP
},
112 { M32RBF_INSN_NOT
, && case_sem_INSN_NOT
},
113 { M32RBF_INSN_RAC
, && case_sem_INSN_RAC
},
114 { M32RBF_INSN_RACH
, && case_sem_INSN_RACH
},
115 { M32RBF_INSN_RTE
, && case_sem_INSN_RTE
},
116 { M32RBF_INSN_SETH
, && case_sem_INSN_SETH
},
117 { M32RBF_INSN_SLL
, && case_sem_INSN_SLL
},
118 { M32RBF_INSN_SLL3
, && case_sem_INSN_SLL3
},
119 { M32RBF_INSN_SLLI
, && case_sem_INSN_SLLI
},
120 { M32RBF_INSN_SRA
, && case_sem_INSN_SRA
},
121 { M32RBF_INSN_SRA3
, && case_sem_INSN_SRA3
},
122 { M32RBF_INSN_SRAI
, && case_sem_INSN_SRAI
},
123 { M32RBF_INSN_SRL
, && case_sem_INSN_SRL
},
124 { M32RBF_INSN_SRL3
, && case_sem_INSN_SRL3
},
125 { M32RBF_INSN_SRLI
, && case_sem_INSN_SRLI
},
126 { M32RBF_INSN_ST
, && case_sem_INSN_ST
},
127 { M32RBF_INSN_ST_D
, && case_sem_INSN_ST_D
},
128 { M32RBF_INSN_STB
, && case_sem_INSN_STB
},
129 { M32RBF_INSN_STB_D
, && case_sem_INSN_STB_D
},
130 { M32RBF_INSN_STH
, && case_sem_INSN_STH
},
131 { M32RBF_INSN_STH_D
, && case_sem_INSN_STH_D
},
132 { M32RBF_INSN_ST_PLUS
, && case_sem_INSN_ST_PLUS
},
133 { M32RBF_INSN_ST_MINUS
, && case_sem_INSN_ST_MINUS
},
134 { M32RBF_INSN_SUB
, && case_sem_INSN_SUB
},
135 { M32RBF_INSN_SUBV
, && case_sem_INSN_SUBV
},
136 { M32RBF_INSN_SUBX
, && case_sem_INSN_SUBX
},
137 { M32RBF_INSN_TRAP
, && case_sem_INSN_TRAP
},
138 { M32RBF_INSN_UNLOCK
, && case_sem_INSN_UNLOCK
},
139 { M32RBF_INSN_CLRPSW
, && case_sem_INSN_CLRPSW
},
140 { M32RBF_INSN_SETPSW
, && case_sem_INSN_SETPSW
},
141 { M32RBF_INSN_BSET
, && case_sem_INSN_BSET
},
142 { M32RBF_INSN_BCLR
, && case_sem_INSN_BCLR
},
143 { M32RBF_INSN_BTST
, && case_sem_INSN_BTST
},
148 for (i
= 0; labels
[i
].label
!= 0; ++i
)
151 CPU_IDESC (current_cpu
) [labels
[i
].index
].sem_fast_lab
= labels
[i
].label
;
153 CPU_IDESC (current_cpu
) [labels
[i
].index
].sem_full_lab
= labels
[i
].label
;
158 #endif /* DEFINE_LABELS */
162 /* If hyper-fast [well not unnecessarily slow] execution is selected, turn
163 off frills like tracing and profiling. */
164 /* FIXME: A better way would be to have CGEN_TRACE_RESULT check for something
165 that can cause it to be optimized out. Another way would be to emit
166 special handlers into the instruction "stream". */
169 #undef CGEN_TRACE_RESULT
170 #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val)
174 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
180 /* Branch to next handler without going around main loop. */
181 #define NEXT(vpc) goto * SEM_ARGBUF (vpc) -> semantic.sem_case
182 SWITCH (sem
, SEM_ARGBUF (vpc
) -> semantic
.sem_case
)
184 #else /* ! WITH_SCACHE_PBB */
186 #define NEXT(vpc) BREAK (sem)
189 SWITCH (sem
, SEM_ARGBUF (sc
) -> idesc
->sem_fast_lab
)
191 SWITCH (sem
, SEM_ARGBUF (sc
) -> idesc
->sem_full_lab
)
194 SWITCH (sem
, SEM_ARGBUF (sc
) -> idesc
->num
)
197 #endif /* ! WITH_SCACHE_PBB */
201 CASE (sem
, INSN_X_INVALID
) : /* --invalid-- */
203 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
204 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
205 #define FLD(f) abuf->fields.sfmt_empty.f
206 int UNUSED written
= 0;
207 IADDR UNUSED pc
= abuf
->addr
;
208 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
211 /* Update the recorded pc in the cpu state struct.
212 Only necessary for WITH_SCACHE case, but to avoid the
213 conditional compilation .... */
215 /* Virtual insns have zero size. Overwrite vpc with address of next insn
216 using the default-insn-bitsize spec. When executing insns in parallel
217 we may want to queue the fault and continue execution. */
218 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
219 vpc
= sim_engine_invalid_insn (current_cpu
, pc
, vpc
);
226 CASE (sem
, INSN_X_AFTER
) : /* --after-- */
228 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
229 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
230 #define FLD(f) abuf->fields.sfmt_empty.f
231 int UNUSED written
= 0;
232 IADDR UNUSED pc
= abuf
->addr
;
233 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
236 #if WITH_SCACHE_PBB_M32RBF
237 m32rbf_pbb_after (current_cpu
, sem_arg
);
245 CASE (sem
, INSN_X_BEFORE
) : /* --before-- */
247 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
248 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
249 #define FLD(f) abuf->fields.sfmt_empty.f
250 int UNUSED written
= 0;
251 IADDR UNUSED pc
= abuf
->addr
;
252 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
255 #if WITH_SCACHE_PBB_M32RBF
256 m32rbf_pbb_before (current_cpu
, sem_arg
);
264 CASE (sem
, INSN_X_CTI_CHAIN
) : /* --cti-chain-- */
266 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
267 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
268 #define FLD(f) abuf->fields.sfmt_empty.f
269 int UNUSED written
= 0;
270 IADDR UNUSED pc
= abuf
->addr
;
271 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
274 #if WITH_SCACHE_PBB_M32RBF
276 vpc
= m32rbf_pbb_cti_chain (current_cpu
, sem_arg
,
277 pbb_br_type
, pbb_br_npc
);
280 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
281 vpc
= m32rbf_pbb_cti_chain (current_cpu
, sem_arg
,
282 CPU_PBB_BR_TYPE (current_cpu
),
283 CPU_PBB_BR_NPC (current_cpu
));
292 CASE (sem
, INSN_X_CHAIN
) : /* --chain-- */
294 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
295 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
296 #define FLD(f) abuf->fields.sfmt_empty.f
297 int UNUSED written
= 0;
298 IADDR UNUSED pc
= abuf
->addr
;
299 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
302 #if WITH_SCACHE_PBB_M32RBF
303 vpc
= m32rbf_pbb_chain (current_cpu
, sem_arg
);
314 CASE (sem
, INSN_X_BEGIN
) : /* --begin-- */
316 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
317 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
318 #define FLD(f) abuf->fields.sfmt_empty.f
319 int UNUSED written
= 0;
320 IADDR UNUSED pc
= abuf
->addr
;
321 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
324 #if WITH_SCACHE_PBB_M32RBF
325 #if defined DEFINE_SWITCH || defined FAST_P
326 /* In the switch case FAST_P is a constant, allowing several optimizations
327 in any called inline functions. */
328 vpc
= m32rbf_pbb_begin (current_cpu
, FAST_P
);
330 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
331 vpc
= m32rbf_pbb_begin (current_cpu
, STATE_RUN_FAST_P (CPU_STATE (current_cpu
)));
333 vpc
= m32rbf_pbb_begin (current_cpu
, 0);
343 CASE (sem
, INSN_ADD
) : /* add $dr,$sr */
345 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
346 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
347 #define FLD(f) abuf->fields.sfmt_add.f
348 int UNUSED written
= 0;
349 IADDR UNUSED pc
= abuf
->addr
;
350 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
353 SI opval
= ADDSI (* FLD (i_dr
), * FLD (i_sr
));
354 * FLD (i_dr
) = opval
;
355 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
362 CASE (sem
, INSN_ADD3
) : /* add3 $dr,$sr,$hash$slo16 */
364 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
365 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
366 #define FLD(f) abuf->fields.sfmt_add3.f
367 int UNUSED written
= 0;
368 IADDR UNUSED pc
= abuf
->addr
;
369 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
372 SI opval
= ADDSI (* FLD (i_sr
), FLD (f_simm16
));
373 * FLD (i_dr
) = opval
;
374 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
381 CASE (sem
, INSN_AND
) : /* and $dr,$sr */
383 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
384 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
385 #define FLD(f) abuf->fields.sfmt_add.f
386 int UNUSED written
= 0;
387 IADDR UNUSED pc
= abuf
->addr
;
388 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
391 SI opval
= ANDSI (* FLD (i_dr
), * FLD (i_sr
));
392 * FLD (i_dr
) = opval
;
393 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
400 CASE (sem
, INSN_AND3
) : /* and3 $dr,$sr,$uimm16 */
402 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
403 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
404 #define FLD(f) abuf->fields.sfmt_and3.f
405 int UNUSED written
= 0;
406 IADDR UNUSED pc
= abuf
->addr
;
407 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
410 SI opval
= ANDSI (* FLD (i_sr
), FLD (f_uimm16
));
411 * FLD (i_dr
) = opval
;
412 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
419 CASE (sem
, INSN_OR
) : /* or $dr,$sr */
421 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
422 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
423 #define FLD(f) abuf->fields.sfmt_add.f
424 int UNUSED written
= 0;
425 IADDR UNUSED pc
= abuf
->addr
;
426 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
429 SI opval
= ORSI (* FLD (i_dr
), * FLD (i_sr
));
430 * FLD (i_dr
) = opval
;
431 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
438 CASE (sem
, INSN_OR3
) : /* or3 $dr,$sr,$hash$ulo16 */
440 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
441 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
442 #define FLD(f) abuf->fields.sfmt_and3.f
443 int UNUSED written
= 0;
444 IADDR UNUSED pc
= abuf
->addr
;
445 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
448 SI opval
= ORSI (* FLD (i_sr
), FLD (f_uimm16
));
449 * FLD (i_dr
) = opval
;
450 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
457 CASE (sem
, INSN_XOR
) : /* xor $dr,$sr */
459 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
460 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
461 #define FLD(f) abuf->fields.sfmt_add.f
462 int UNUSED written
= 0;
463 IADDR UNUSED pc
= abuf
->addr
;
464 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
467 SI opval
= XORSI (* FLD (i_dr
), * FLD (i_sr
));
468 * FLD (i_dr
) = opval
;
469 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
476 CASE (sem
, INSN_XOR3
) : /* xor3 $dr,$sr,$uimm16 */
478 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
479 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
480 #define FLD(f) abuf->fields.sfmt_and3.f
481 int UNUSED written
= 0;
482 IADDR UNUSED pc
= abuf
->addr
;
483 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
486 SI opval
= XORSI (* FLD (i_sr
), FLD (f_uimm16
));
487 * FLD (i_dr
) = opval
;
488 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
495 CASE (sem
, INSN_ADDI
) : /* addi $dr,$simm8 */
497 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
498 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
499 #define FLD(f) abuf->fields.sfmt_addi.f
500 int UNUSED written
= 0;
501 IADDR UNUSED pc
= abuf
->addr
;
502 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
505 SI opval
= ADDSI (* FLD (i_dr
), FLD (f_simm8
));
506 * FLD (i_dr
) = opval
;
507 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
514 CASE (sem
, INSN_ADDV
) : /* addv $dr,$sr */
516 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
517 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
518 #define FLD(f) abuf->fields.sfmt_add.f
519 int UNUSED written
= 0;
520 IADDR UNUSED pc
= abuf
->addr
;
521 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
525 temp0
= ADDSI (* FLD (i_dr
), * FLD (i_sr
));
526 temp1
= ADDOFSI (* FLD (i_dr
), * FLD (i_sr
), 0);
529 * FLD (i_dr
) = opval
;
530 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
534 CPU (h_cond
) = opval
;
535 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
543 CASE (sem
, INSN_ADDV3
) : /* addv3 $dr,$sr,$simm16 */
545 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
546 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
547 #define FLD(f) abuf->fields.sfmt_add3.f
548 int UNUSED written
= 0;
549 IADDR UNUSED pc
= abuf
->addr
;
550 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
554 temp0
= ADDSI (* FLD (i_sr
), FLD (f_simm16
));
555 temp1
= ADDOFSI (* FLD (i_sr
), FLD (f_simm16
), 0);
558 * FLD (i_dr
) = opval
;
559 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
563 CPU (h_cond
) = opval
;
564 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
572 CASE (sem
, INSN_ADDX
) : /* addx $dr,$sr */
574 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
575 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
576 #define FLD(f) abuf->fields.sfmt_add.f
577 int UNUSED written
= 0;
578 IADDR UNUSED pc
= abuf
->addr
;
579 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
583 temp0
= ADDCSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
584 temp1
= ADDCFSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
587 * FLD (i_dr
) = opval
;
588 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
592 CPU (h_cond
) = opval
;
593 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
601 CASE (sem
, INSN_BC8
) : /* bc.s $disp8 */
603 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
604 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
605 #define FLD(f) abuf->fields.sfmt_bl8.f
606 int UNUSED written
= 0;
607 IADDR UNUSED pc
= abuf
->addr
;
609 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
613 USI opval
= FLD (i_disp8
);
614 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
616 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
620 abuf
->written
= written
;
621 SEM_BRANCH_FINI (vpc
);
626 CASE (sem
, INSN_BC24
) : /* bc.l $disp24 */
628 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
629 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
630 #define FLD(f) abuf->fields.sfmt_bl24.f
631 int UNUSED written
= 0;
632 IADDR UNUSED pc
= abuf
->addr
;
634 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
638 USI opval
= FLD (i_disp24
);
639 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
641 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
645 abuf
->written
= written
;
646 SEM_BRANCH_FINI (vpc
);
651 CASE (sem
, INSN_BEQ
) : /* beq $src1,$src2,$disp16 */
653 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
654 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
655 #define FLD(f) abuf->fields.sfmt_beq.f
656 int UNUSED written
= 0;
657 IADDR UNUSED pc
= abuf
->addr
;
659 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
661 if (EQSI (* FLD (i_src1
), * FLD (i_src2
))) {
663 USI opval
= FLD (i_disp16
);
664 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
666 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
670 abuf
->written
= written
;
671 SEM_BRANCH_FINI (vpc
);
676 CASE (sem
, INSN_BEQZ
) : /* beqz $src2,$disp16 */
678 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
679 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
680 #define FLD(f) abuf->fields.sfmt_beq.f
681 int UNUSED written
= 0;
682 IADDR UNUSED pc
= abuf
->addr
;
684 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
686 if (EQSI (* FLD (i_src2
), 0)) {
688 USI opval
= FLD (i_disp16
);
689 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
691 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
695 abuf
->written
= written
;
696 SEM_BRANCH_FINI (vpc
);
701 CASE (sem
, INSN_BGEZ
) : /* bgez $src2,$disp16 */
703 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
704 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
705 #define FLD(f) abuf->fields.sfmt_beq.f
706 int UNUSED written
= 0;
707 IADDR UNUSED pc
= abuf
->addr
;
709 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
711 if (GESI (* FLD (i_src2
), 0)) {
713 USI opval
= FLD (i_disp16
);
714 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
716 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
720 abuf
->written
= written
;
721 SEM_BRANCH_FINI (vpc
);
726 CASE (sem
, INSN_BGTZ
) : /* bgtz $src2,$disp16 */
728 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
729 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
730 #define FLD(f) abuf->fields.sfmt_beq.f
731 int UNUSED written
= 0;
732 IADDR UNUSED pc
= abuf
->addr
;
734 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
736 if (GTSI (* FLD (i_src2
), 0)) {
738 USI opval
= FLD (i_disp16
);
739 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
741 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
745 abuf
->written
= written
;
746 SEM_BRANCH_FINI (vpc
);
751 CASE (sem
, INSN_BLEZ
) : /* blez $src2,$disp16 */
753 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
754 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
755 #define FLD(f) abuf->fields.sfmt_beq.f
756 int UNUSED written
= 0;
757 IADDR UNUSED pc
= abuf
->addr
;
759 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
761 if (LESI (* FLD (i_src2
), 0)) {
763 USI opval
= FLD (i_disp16
);
764 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
766 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
770 abuf
->written
= written
;
771 SEM_BRANCH_FINI (vpc
);
776 CASE (sem
, INSN_BLTZ
) : /* bltz $src2,$disp16 */
778 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
779 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
780 #define FLD(f) abuf->fields.sfmt_beq.f
781 int UNUSED written
= 0;
782 IADDR UNUSED pc
= abuf
->addr
;
784 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
786 if (LTSI (* FLD (i_src2
), 0)) {
788 USI opval
= FLD (i_disp16
);
789 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
791 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
795 abuf
->written
= written
;
796 SEM_BRANCH_FINI (vpc
);
801 CASE (sem
, INSN_BNEZ
) : /* bnez $src2,$disp16 */
803 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
804 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
805 #define FLD(f) abuf->fields.sfmt_beq.f
806 int UNUSED written
= 0;
807 IADDR UNUSED pc
= abuf
->addr
;
809 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
811 if (NESI (* FLD (i_src2
), 0)) {
813 USI opval
= FLD (i_disp16
);
814 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
816 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
820 abuf
->written
= written
;
821 SEM_BRANCH_FINI (vpc
);
826 CASE (sem
, INSN_BL8
) : /* bl.s $disp8 */
828 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
829 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
830 #define FLD(f) abuf->fields.sfmt_bl8.f
831 int UNUSED written
= 0;
832 IADDR UNUSED pc
= abuf
->addr
;
834 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
838 SI opval
= ADDSI (ANDSI (pc
, -4), 4);
839 CPU (h_gr
[((UINT
) 14)]) = opval
;
840 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
843 USI opval
= FLD (i_disp8
);
844 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
845 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
849 SEM_BRANCH_FINI (vpc
);
854 CASE (sem
, INSN_BL24
) : /* bl.l $disp24 */
856 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
857 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
858 #define FLD(f) abuf->fields.sfmt_bl24.f
859 int UNUSED written
= 0;
860 IADDR UNUSED pc
= abuf
->addr
;
862 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
866 SI opval
= ADDSI (pc
, 4);
867 CPU (h_gr
[((UINT
) 14)]) = opval
;
868 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
871 USI opval
= FLD (i_disp24
);
872 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
873 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
877 SEM_BRANCH_FINI (vpc
);
882 CASE (sem
, INSN_BNC8
) : /* bnc.s $disp8 */
884 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
885 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
886 #define FLD(f) abuf->fields.sfmt_bl8.f
887 int UNUSED written
= 0;
888 IADDR UNUSED pc
= abuf
->addr
;
890 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
892 if (NOTBI (CPU (h_cond
))) {
894 USI opval
= FLD (i_disp8
);
895 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
897 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
901 abuf
->written
= written
;
902 SEM_BRANCH_FINI (vpc
);
907 CASE (sem
, INSN_BNC24
) : /* bnc.l $disp24 */
909 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
910 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
911 #define FLD(f) abuf->fields.sfmt_bl24.f
912 int UNUSED written
= 0;
913 IADDR UNUSED pc
= abuf
->addr
;
915 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
917 if (NOTBI (CPU (h_cond
))) {
919 USI opval
= FLD (i_disp24
);
920 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
922 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
926 abuf
->written
= written
;
927 SEM_BRANCH_FINI (vpc
);
932 CASE (sem
, INSN_BNE
) : /* bne $src1,$src2,$disp16 */
934 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
935 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
936 #define FLD(f) abuf->fields.sfmt_beq.f
937 int UNUSED written
= 0;
938 IADDR UNUSED pc
= abuf
->addr
;
940 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
942 if (NESI (* FLD (i_src1
), * FLD (i_src2
))) {
944 USI opval
= FLD (i_disp16
);
945 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
947 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
951 abuf
->written
= written
;
952 SEM_BRANCH_FINI (vpc
);
957 CASE (sem
, INSN_BRA8
) : /* bra.s $disp8 */
959 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
960 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
961 #define FLD(f) abuf->fields.sfmt_bl8.f
962 int UNUSED written
= 0;
963 IADDR UNUSED pc
= abuf
->addr
;
965 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
968 USI opval
= FLD (i_disp8
);
969 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
970 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
973 SEM_BRANCH_FINI (vpc
);
978 CASE (sem
, INSN_BRA24
) : /* bra.l $disp24 */
980 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
981 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
982 #define FLD(f) abuf->fields.sfmt_bl24.f
983 int UNUSED written
= 0;
984 IADDR UNUSED pc
= abuf
->addr
;
986 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
989 USI opval
= FLD (i_disp24
);
990 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
991 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
994 SEM_BRANCH_FINI (vpc
);
999 CASE (sem
, INSN_CMP
) : /* cmp $src1,$src2 */
1001 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1002 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1003 #define FLD(f) abuf->fields.sfmt_st_plus.f
1004 int UNUSED written
= 0;
1005 IADDR UNUSED pc
= abuf
->addr
;
1006 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1009 BI opval
= LTSI (* FLD (i_src1
), * FLD (i_src2
));
1010 CPU (h_cond
) = opval
;
1011 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
1018 CASE (sem
, INSN_CMPI
) : /* cmpi $src2,$simm16 */
1020 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1021 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1022 #define FLD(f) abuf->fields.sfmt_st_d.f
1023 int UNUSED written
= 0;
1024 IADDR UNUSED pc
= abuf
->addr
;
1025 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1028 BI opval
= LTSI (* FLD (i_src2
), FLD (f_simm16
));
1029 CPU (h_cond
) = opval
;
1030 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
1037 CASE (sem
, INSN_CMPU
) : /* cmpu $src1,$src2 */
1039 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1040 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1041 #define FLD(f) abuf->fields.sfmt_st_plus.f
1042 int UNUSED written
= 0;
1043 IADDR UNUSED pc
= abuf
->addr
;
1044 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1047 BI opval
= LTUSI (* FLD (i_src1
), * FLD (i_src2
));
1048 CPU (h_cond
) = opval
;
1049 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
1056 CASE (sem
, INSN_CMPUI
) : /* cmpui $src2,$simm16 */
1058 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1059 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1060 #define FLD(f) abuf->fields.sfmt_st_d.f
1061 int UNUSED written
= 0;
1062 IADDR UNUSED pc
= abuf
->addr
;
1063 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1066 BI opval
= LTUSI (* FLD (i_src2
), FLD (f_simm16
));
1067 CPU (h_cond
) = opval
;
1068 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
1075 CASE (sem
, INSN_DIV
) : /* div $dr,$sr */
1077 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1078 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1079 #define FLD(f) abuf->fields.sfmt_add.f
1080 int UNUSED written
= 0;
1081 IADDR UNUSED pc
= abuf
->addr
;
1082 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1084 if (NESI (* FLD (i_sr
), 0)) {
1086 SI opval
= DIVSI (* FLD (i_dr
), * FLD (i_sr
));
1087 * FLD (i_dr
) = opval
;
1088 written
|= (1 << 2);
1089 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1093 abuf
->written
= written
;
1098 CASE (sem
, INSN_DIVU
) : /* divu $dr,$sr */
1100 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1101 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1102 #define FLD(f) abuf->fields.sfmt_add.f
1103 int UNUSED written
= 0;
1104 IADDR UNUSED pc
= abuf
->addr
;
1105 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1107 if (NESI (* FLD (i_sr
), 0)) {
1109 SI opval
= UDIVSI (* FLD (i_dr
), * FLD (i_sr
));
1110 * FLD (i_dr
) = opval
;
1111 written
|= (1 << 2);
1112 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1116 abuf
->written
= written
;
1121 CASE (sem
, INSN_REM
) : /* rem $dr,$sr */
1123 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1124 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1125 #define FLD(f) abuf->fields.sfmt_add.f
1126 int UNUSED written
= 0;
1127 IADDR UNUSED pc
= abuf
->addr
;
1128 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1130 if (NESI (* FLD (i_sr
), 0)) {
1132 SI opval
= MODSI (* FLD (i_dr
), * FLD (i_sr
));
1133 * FLD (i_dr
) = opval
;
1134 written
|= (1 << 2);
1135 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1139 abuf
->written
= written
;
1144 CASE (sem
, INSN_REMU
) : /* remu $dr,$sr */
1146 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1147 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1148 #define FLD(f) abuf->fields.sfmt_add.f
1149 int UNUSED written
= 0;
1150 IADDR UNUSED pc
= abuf
->addr
;
1151 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1153 if (NESI (* FLD (i_sr
), 0)) {
1155 SI opval
= UMODSI (* FLD (i_dr
), * FLD (i_sr
));
1156 * FLD (i_dr
) = opval
;
1157 written
|= (1 << 2);
1158 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1162 abuf
->written
= written
;
1167 CASE (sem
, INSN_JL
) : /* jl $sr */
1169 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1170 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1171 #define FLD(f) abuf->fields.sfmt_jl.f
1172 int UNUSED written
= 0;
1173 IADDR UNUSED pc
= abuf
->addr
;
1175 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1179 temp0
= ADDSI (ANDSI (pc
, -4), 4);
1180 temp1
= ANDSI (* FLD (i_sr
), -4);
1183 CPU (h_gr
[((UINT
) 14)]) = opval
;
1184 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1188 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1189 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1193 SEM_BRANCH_FINI (vpc
);
1198 CASE (sem
, INSN_JMP
) : /* jmp $sr */
1200 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1201 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1202 #define FLD(f) abuf->fields.sfmt_jl.f
1203 int UNUSED written
= 0;
1204 IADDR UNUSED pc
= abuf
->addr
;
1206 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1209 USI opval
= ANDSI (* FLD (i_sr
), -4);
1210 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1211 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1214 SEM_BRANCH_FINI (vpc
);
1219 CASE (sem
, INSN_LD
) : /* ld $dr,@$sr */
1221 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1222 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1223 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1224 int UNUSED written
= 0;
1225 IADDR UNUSED pc
= abuf
->addr
;
1226 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1229 SI opval
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1230 * FLD (i_dr
) = opval
;
1231 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1238 CASE (sem
, INSN_LD_D
) : /* ld $dr,@($slo16,$sr) */
1240 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1241 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1242 #define FLD(f) abuf->fields.sfmt_add3.f
1243 int UNUSED written
= 0;
1244 IADDR UNUSED pc
= abuf
->addr
;
1245 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1248 SI opval
= GETMEMSI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)));
1249 * FLD (i_dr
) = opval
;
1250 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1257 CASE (sem
, INSN_LDB
) : /* ldb $dr,@$sr */
1259 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1260 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1261 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1262 int UNUSED written
= 0;
1263 IADDR UNUSED pc
= abuf
->addr
;
1264 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1267 SI opval
= EXTQISI (GETMEMQI (current_cpu
, pc
, * FLD (i_sr
)));
1268 * FLD (i_dr
) = opval
;
1269 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1276 CASE (sem
, INSN_LDB_D
) : /* ldb $dr,@($slo16,$sr) */
1278 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1279 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1280 #define FLD(f) abuf->fields.sfmt_add3.f
1281 int UNUSED written
= 0;
1282 IADDR UNUSED pc
= abuf
->addr
;
1283 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1286 SI opval
= EXTQISI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1287 * FLD (i_dr
) = opval
;
1288 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1295 CASE (sem
, INSN_LDH
) : /* ldh $dr,@$sr */
1297 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1298 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1299 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1300 int UNUSED written
= 0;
1301 IADDR UNUSED pc
= abuf
->addr
;
1302 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1305 SI opval
= EXTHISI (GETMEMHI (current_cpu
, pc
, * FLD (i_sr
)));
1306 * FLD (i_dr
) = opval
;
1307 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1314 CASE (sem
, INSN_LDH_D
) : /* ldh $dr,@($slo16,$sr) */
1316 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1317 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1318 #define FLD(f) abuf->fields.sfmt_add3.f
1319 int UNUSED written
= 0;
1320 IADDR UNUSED pc
= abuf
->addr
;
1321 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1324 SI opval
= EXTHISI (GETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1325 * FLD (i_dr
) = opval
;
1326 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1333 CASE (sem
, INSN_LDUB
) : /* ldub $dr,@$sr */
1335 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1336 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1337 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1338 int UNUSED written
= 0;
1339 IADDR UNUSED pc
= abuf
->addr
;
1340 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1343 SI opval
= ZEXTQISI (GETMEMQI (current_cpu
, pc
, * FLD (i_sr
)));
1344 * FLD (i_dr
) = opval
;
1345 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1352 CASE (sem
, INSN_LDUB_D
) : /* ldub $dr,@($slo16,$sr) */
1354 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1355 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1356 #define FLD(f) abuf->fields.sfmt_add3.f
1357 int UNUSED written
= 0;
1358 IADDR UNUSED pc
= abuf
->addr
;
1359 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1362 SI opval
= ZEXTQISI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1363 * FLD (i_dr
) = opval
;
1364 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1371 CASE (sem
, INSN_LDUH
) : /* lduh $dr,@$sr */
1373 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1374 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1375 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1376 int UNUSED written
= 0;
1377 IADDR UNUSED pc
= abuf
->addr
;
1378 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1381 SI opval
= ZEXTHISI (GETMEMHI (current_cpu
, pc
, * FLD (i_sr
)));
1382 * FLD (i_dr
) = opval
;
1383 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1390 CASE (sem
, INSN_LDUH_D
) : /* lduh $dr,@($slo16,$sr) */
1392 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1393 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1394 #define FLD(f) abuf->fields.sfmt_add3.f
1395 int UNUSED written
= 0;
1396 IADDR UNUSED pc
= abuf
->addr
;
1397 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1400 SI opval
= ZEXTHISI (GETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1401 * FLD (i_dr
) = opval
;
1402 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1409 CASE (sem
, INSN_LD_PLUS
) : /* ld $dr,@$sr+ */
1411 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1412 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1413 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1414 int UNUSED written
= 0;
1415 IADDR UNUSED pc
= abuf
->addr
;
1416 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1420 temp0
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1421 temp1
= ADDSI (* FLD (i_sr
), 4);
1424 * FLD (i_dr
) = opval
;
1425 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1429 * FLD (i_sr
) = opval
;
1430 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1438 CASE (sem
, INSN_LD24
) : /* ld24 $dr,$uimm24 */
1440 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1441 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1442 #define FLD(f) abuf->fields.sfmt_ld24.f
1443 int UNUSED written
= 0;
1444 IADDR UNUSED pc
= abuf
->addr
;
1445 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1448 SI opval
= FLD (i_uimm24
);
1449 * FLD (i_dr
) = opval
;
1450 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1457 CASE (sem
, INSN_LDI8
) : /* ldi8 $dr,$simm8 */
1459 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1460 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1461 #define FLD(f) abuf->fields.sfmt_addi.f
1462 int UNUSED written
= 0;
1463 IADDR UNUSED pc
= abuf
->addr
;
1464 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1467 SI opval
= FLD (f_simm8
);
1468 * FLD (i_dr
) = opval
;
1469 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1476 CASE (sem
, INSN_LDI16
) : /* ldi16 $dr,$hash$slo16 */
1478 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1479 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1480 #define FLD(f) abuf->fields.sfmt_add3.f
1481 int UNUSED written
= 0;
1482 IADDR UNUSED pc
= abuf
->addr
;
1483 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1486 SI opval
= FLD (f_simm16
);
1487 * FLD (i_dr
) = opval
;
1488 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1495 CASE (sem
, INSN_LOCK
) : /* lock $dr,@$sr */
1497 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1498 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1499 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1500 int UNUSED written
= 0;
1501 IADDR UNUSED pc
= abuf
->addr
;
1502 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1507 CPU (h_lock
) = opval
;
1508 CGEN_TRACE_RESULT (current_cpu
, abuf
, "lock", 'x', opval
);
1511 SI opval
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1512 * FLD (i_dr
) = opval
;
1513 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1521 CASE (sem
, INSN_MACHI
) : /* machi $src1,$src2 */
1523 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1524 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1525 #define FLD(f) abuf->fields.sfmt_st_plus.f
1526 int UNUSED written
= 0;
1527 IADDR UNUSED pc
= abuf
->addr
;
1528 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1531 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (ANDSI (* FLD (i_src1
), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16))))), 8), 8);
1532 SET_H_ACCUM (opval
);
1533 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1540 CASE (sem
, INSN_MACLO
) : /* maclo $src1,$src2 */
1542 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1543 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1544 #define FLD(f) abuf->fields.sfmt_st_plus.f
1545 int UNUSED written
= 0;
1546 IADDR UNUSED pc
= abuf
->addr
;
1547 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1550 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (SLLSI (* FLD (i_src1
), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
))))), 8), 8);
1551 SET_H_ACCUM (opval
);
1552 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1559 CASE (sem
, INSN_MACWHI
) : /* macwhi $src1,$src2 */
1561 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1562 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1563 #define FLD(f) abuf->fields.sfmt_st_plus.f
1564 int UNUSED written
= 0;
1565 IADDR UNUSED pc
= abuf
->addr
;
1566 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1569 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16))))), 8), 8);
1570 SET_H_ACCUM (opval
);
1571 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1578 CASE (sem
, INSN_MACWLO
) : /* macwlo $src1,$src2 */
1580 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1581 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1582 #define FLD(f) abuf->fields.sfmt_st_plus.f
1583 int UNUSED written
= 0;
1584 IADDR UNUSED pc
= abuf
->addr
;
1585 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1588 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
))))), 8), 8);
1589 SET_H_ACCUM (opval
);
1590 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1597 CASE (sem
, INSN_MUL
) : /* mul $dr,$sr */
1599 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1600 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1601 #define FLD(f) abuf->fields.sfmt_add.f
1602 int UNUSED written
= 0;
1603 IADDR UNUSED pc
= abuf
->addr
;
1604 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1607 SI opval
= MULSI (* FLD (i_dr
), * FLD (i_sr
));
1608 * FLD (i_dr
) = opval
;
1609 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1616 CASE (sem
, INSN_MULHI
) : /* mulhi $src1,$src2 */
1618 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1619 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1620 #define FLD(f) abuf->fields.sfmt_st_plus.f
1621 int UNUSED written
= 0;
1622 IADDR UNUSED pc
= abuf
->addr
;
1623 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1626 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (i_src1
), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16)))), 16), 16);
1627 SET_H_ACCUM (opval
);
1628 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1635 CASE (sem
, INSN_MULLO
) : /* mullo $src1,$src2 */
1637 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1638 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1639 #define FLD(f) abuf->fields.sfmt_st_plus.f
1640 int UNUSED written
= 0;
1641 IADDR UNUSED pc
= abuf
->addr
;
1642 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1645 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (i_src1
), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
)))), 16), 16);
1646 SET_H_ACCUM (opval
);
1647 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1654 CASE (sem
, INSN_MULWHI
) : /* mulwhi $src1,$src2 */
1656 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1657 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1658 #define FLD(f) abuf->fields.sfmt_st_plus.f
1659 int UNUSED written
= 0;
1660 IADDR UNUSED pc
= abuf
->addr
;
1661 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1664 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16)))), 8), 8);
1665 SET_H_ACCUM (opval
);
1666 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1673 CASE (sem
, INSN_MULWLO
) : /* mulwlo $src1,$src2 */
1675 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1676 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1677 #define FLD(f) abuf->fields.sfmt_st_plus.f
1678 int UNUSED written
= 0;
1679 IADDR UNUSED pc
= abuf
->addr
;
1680 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1683 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
)))), 8), 8);
1684 SET_H_ACCUM (opval
);
1685 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1692 CASE (sem
, INSN_MV
) : /* mv $dr,$sr */
1694 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1695 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1696 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1697 int UNUSED written
= 0;
1698 IADDR UNUSED pc
= abuf
->addr
;
1699 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1702 SI opval
= * FLD (i_sr
);
1703 * FLD (i_dr
) = opval
;
1704 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1711 CASE (sem
, INSN_MVFACHI
) : /* mvfachi $dr */
1713 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1714 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1715 #define FLD(f) abuf->fields.sfmt_seth.f
1716 int UNUSED written
= 0;
1717 IADDR UNUSED pc
= abuf
->addr
;
1718 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1721 SI opval
= TRUNCDISI (SRADI (GET_H_ACCUM (), 32));
1722 * FLD (i_dr
) = opval
;
1723 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1730 CASE (sem
, INSN_MVFACLO
) : /* mvfaclo $dr */
1732 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1733 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1734 #define FLD(f) abuf->fields.sfmt_seth.f
1735 int UNUSED written
= 0;
1736 IADDR UNUSED pc
= abuf
->addr
;
1737 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1740 SI opval
= TRUNCDISI (GET_H_ACCUM ());
1741 * FLD (i_dr
) = opval
;
1742 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1749 CASE (sem
, INSN_MVFACMI
) : /* mvfacmi $dr */
1751 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1752 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1753 #define FLD(f) abuf->fields.sfmt_seth.f
1754 int UNUSED written
= 0;
1755 IADDR UNUSED pc
= abuf
->addr
;
1756 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1759 SI opval
= TRUNCDISI (SRADI (GET_H_ACCUM (), 16));
1760 * FLD (i_dr
) = opval
;
1761 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1768 CASE (sem
, INSN_MVFC
) : /* mvfc $dr,$scr */
1770 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1771 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1772 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1773 int UNUSED written
= 0;
1774 IADDR UNUSED pc
= abuf
->addr
;
1775 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1778 SI opval
= GET_H_CR (FLD (f_r2
));
1779 * FLD (i_dr
) = opval
;
1780 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1787 CASE (sem
, INSN_MVTACHI
) : /* mvtachi $src1 */
1789 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1790 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1791 #define FLD(f) abuf->fields.sfmt_st_plus.f
1792 int UNUSED written
= 0;
1793 IADDR UNUSED pc
= abuf
->addr
;
1794 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1797 DI opval
= ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (i_src1
)), 32));
1798 SET_H_ACCUM (opval
);
1799 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1806 CASE (sem
, INSN_MVTACLO
) : /* mvtaclo $src1 */
1808 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1809 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1810 #define FLD(f) abuf->fields.sfmt_st_plus.f
1811 int UNUSED written
= 0;
1812 IADDR UNUSED pc
= abuf
->addr
;
1813 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1816 DI opval
= ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (i_src1
)));
1817 SET_H_ACCUM (opval
);
1818 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1825 CASE (sem
, INSN_MVTC
) : /* mvtc $sr,$dcr */
1827 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1828 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1829 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1830 int UNUSED written
= 0;
1831 IADDR UNUSED pc
= abuf
->addr
;
1832 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1835 USI opval
= * FLD (i_sr
);
1836 SET_H_CR (FLD (f_r1
), opval
);
1837 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
1844 CASE (sem
, INSN_NEG
) : /* neg $dr,$sr */
1846 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1847 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1848 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1849 int UNUSED written
= 0;
1850 IADDR UNUSED pc
= abuf
->addr
;
1851 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1854 SI opval
= NEGSI (* FLD (i_sr
));
1855 * FLD (i_dr
) = opval
;
1856 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1863 CASE (sem
, INSN_NOP
) : /* nop */
1865 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1866 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1867 #define FLD(f) abuf->fields.sfmt_empty.f
1868 int UNUSED written
= 0;
1869 IADDR UNUSED pc
= abuf
->addr
;
1870 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1872 PROFILE_COUNT_FILLNOPS (current_cpu
, abuf
->addr
);
1878 CASE (sem
, INSN_NOT
) : /* not $dr,$sr */
1880 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1881 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1882 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1883 int UNUSED written
= 0;
1884 IADDR UNUSED pc
= abuf
->addr
;
1885 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1888 SI opval
= INVSI (* FLD (i_sr
));
1889 * FLD (i_dr
) = opval
;
1890 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1897 CASE (sem
, INSN_RAC
) : /* rac */
1899 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1900 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1901 #define FLD(f) abuf->fields.sfmt_empty.f
1902 int UNUSED written
= 0;
1903 IADDR UNUSED pc
= abuf
->addr
;
1904 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1908 tmp_tmp1
= SLLDI (GET_H_ACCUM (), 1);
1909 tmp_tmp1
= ADDDI (tmp_tmp1
, MAKEDI (0, 32768));
1911 DI opval
= (GTDI (tmp_tmp1
, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1
, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1
, MAKEDI (0xffffffff, 0xffff0000)));
1912 SET_H_ACCUM (opval
);
1913 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1921 CASE (sem
, INSN_RACH
) : /* rach */
1923 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1924 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1925 #define FLD(f) abuf->fields.sfmt_empty.f
1926 int UNUSED written
= 0;
1927 IADDR UNUSED pc
= abuf
->addr
;
1928 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1932 tmp_tmp1
= ANDDI (GET_H_ACCUM (), MAKEDI (16777215, 0xffffffff));
1933 if (ANDIF (GEDI (tmp_tmp1
, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1
, MAKEDI (8388607, 0xffffffff)))) {
1934 tmp_tmp1
= MAKEDI (16383, 0x80000000);
1936 if (ANDIF (GEDI (tmp_tmp1
, MAKEDI (8388608, 0)), LEDI (tmp_tmp1
, MAKEDI (16760832, 0)))) {
1937 tmp_tmp1
= MAKEDI (16760832, 0);
1939 tmp_tmp1
= ANDDI (ADDDI (GET_H_ACCUM (), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
1942 tmp_tmp1
= SLLDI (tmp_tmp1
, 1);
1944 DI opval
= SRADI (SLLDI (tmp_tmp1
, 7), 7);
1945 SET_H_ACCUM (opval
);
1946 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1954 CASE (sem
, INSN_RTE
) : /* rte */
1956 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1957 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1958 #define FLD(f) abuf->fields.sfmt_empty.f
1959 int UNUSED written
= 0;
1960 IADDR UNUSED pc
= abuf
->addr
;
1962 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1966 USI opval
= ANDSI (GET_H_CR (((UINT
) 6)), -4);
1967 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1968 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1971 USI opval
= GET_H_CR (((UINT
) 14));
1972 SET_H_CR (((UINT
) 6), opval
);
1973 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
1976 UQI opval
= CPU (h_bpsw
);
1978 CGEN_TRACE_RESULT (current_cpu
, abuf
, "psw", 'x', opval
);
1981 UQI opval
= CPU (h_bbpsw
);
1982 CPU (h_bpsw
) = opval
;
1983 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bpsw", 'x', opval
);
1987 SEM_BRANCH_FINI (vpc
);
1992 CASE (sem
, INSN_SETH
) : /* seth $dr,$hash$hi16 */
1994 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
1995 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1996 #define FLD(f) abuf->fields.sfmt_seth.f
1997 int UNUSED written
= 0;
1998 IADDR UNUSED pc
= abuf
->addr
;
1999 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2002 SI opval
= SLLSI (FLD (f_hi16
), 16);
2003 * FLD (i_dr
) = opval
;
2004 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2011 CASE (sem
, INSN_SLL
) : /* sll $dr,$sr */
2013 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2014 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2015 #define FLD(f) abuf->fields.sfmt_add.f
2016 int UNUSED written
= 0;
2017 IADDR UNUSED pc
= abuf
->addr
;
2018 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2021 SI opval
= SLLSI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2022 * FLD (i_dr
) = opval
;
2023 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2030 CASE (sem
, INSN_SLL3
) : /* sll3 $dr,$sr,$simm16 */
2032 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2033 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2034 #define FLD(f) abuf->fields.sfmt_add3.f
2035 int UNUSED written
= 0;
2036 IADDR UNUSED pc
= abuf
->addr
;
2037 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2040 SI opval
= SLLSI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2041 * FLD (i_dr
) = opval
;
2042 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2049 CASE (sem
, INSN_SLLI
) : /* slli $dr,$uimm5 */
2051 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2052 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2053 #define FLD(f) abuf->fields.sfmt_slli.f
2054 int UNUSED written
= 0;
2055 IADDR UNUSED pc
= abuf
->addr
;
2056 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2059 SI opval
= SLLSI (* FLD (i_dr
), FLD (f_uimm5
));
2060 * FLD (i_dr
) = opval
;
2061 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2068 CASE (sem
, INSN_SRA
) : /* sra $dr,$sr */
2070 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2071 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2072 #define FLD(f) abuf->fields.sfmt_add.f
2073 int UNUSED written
= 0;
2074 IADDR UNUSED pc
= abuf
->addr
;
2075 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2078 SI opval
= SRASI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2079 * FLD (i_dr
) = opval
;
2080 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2087 CASE (sem
, INSN_SRA3
) : /* sra3 $dr,$sr,$simm16 */
2089 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2090 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2091 #define FLD(f) abuf->fields.sfmt_add3.f
2092 int UNUSED written
= 0;
2093 IADDR UNUSED pc
= abuf
->addr
;
2094 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2097 SI opval
= SRASI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2098 * FLD (i_dr
) = opval
;
2099 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2106 CASE (sem
, INSN_SRAI
) : /* srai $dr,$uimm5 */
2108 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2109 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2110 #define FLD(f) abuf->fields.sfmt_slli.f
2111 int UNUSED written
= 0;
2112 IADDR UNUSED pc
= abuf
->addr
;
2113 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2116 SI opval
= SRASI (* FLD (i_dr
), FLD (f_uimm5
));
2117 * FLD (i_dr
) = opval
;
2118 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2125 CASE (sem
, INSN_SRL
) : /* srl $dr,$sr */
2127 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2128 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2129 #define FLD(f) abuf->fields.sfmt_add.f
2130 int UNUSED written
= 0;
2131 IADDR UNUSED pc
= abuf
->addr
;
2132 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2135 SI opval
= SRLSI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2136 * FLD (i_dr
) = opval
;
2137 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2144 CASE (sem
, INSN_SRL3
) : /* srl3 $dr,$sr,$simm16 */
2146 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2147 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2148 #define FLD(f) abuf->fields.sfmt_add3.f
2149 int UNUSED written
= 0;
2150 IADDR UNUSED pc
= abuf
->addr
;
2151 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2154 SI opval
= SRLSI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2155 * FLD (i_dr
) = opval
;
2156 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2163 CASE (sem
, INSN_SRLI
) : /* srli $dr,$uimm5 */
2165 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2166 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2167 #define FLD(f) abuf->fields.sfmt_slli.f
2168 int UNUSED written
= 0;
2169 IADDR UNUSED pc
= abuf
->addr
;
2170 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2173 SI opval
= SRLSI (* FLD (i_dr
), FLD (f_uimm5
));
2174 * FLD (i_dr
) = opval
;
2175 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2182 CASE (sem
, INSN_ST
) : /* st $src1,@$src2 */
2184 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2185 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2186 #define FLD(f) abuf->fields.sfmt_st_plus.f
2187 int UNUSED written
= 0;
2188 IADDR UNUSED pc
= abuf
->addr
;
2189 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2192 SI opval
= * FLD (i_src1
);
2193 SETMEMSI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2194 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2201 CASE (sem
, INSN_ST_D
) : /* st $src1,@($slo16,$src2) */
2203 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2204 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2205 #define FLD(f) abuf->fields.sfmt_st_d.f
2206 int UNUSED written
= 0;
2207 IADDR UNUSED pc
= abuf
->addr
;
2208 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2211 SI opval
= * FLD (i_src1
);
2212 SETMEMSI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2213 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2220 CASE (sem
, INSN_STB
) : /* stb $src1,@$src2 */
2222 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2223 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2224 #define FLD(f) abuf->fields.sfmt_st_plus.f
2225 int UNUSED written
= 0;
2226 IADDR UNUSED pc
= abuf
->addr
;
2227 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2230 QI opval
= * FLD (i_src1
);
2231 SETMEMQI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2232 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2239 CASE (sem
, INSN_STB_D
) : /* stb $src1,@($slo16,$src2) */
2241 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2242 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2243 #define FLD(f) abuf->fields.sfmt_st_d.f
2244 int UNUSED written
= 0;
2245 IADDR UNUSED pc
= abuf
->addr
;
2246 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2249 QI opval
= * FLD (i_src1
);
2250 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2251 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2258 CASE (sem
, INSN_STH
) : /* sth $src1,@$src2 */
2260 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2261 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2262 #define FLD(f) abuf->fields.sfmt_st_plus.f
2263 int UNUSED written
= 0;
2264 IADDR UNUSED pc
= abuf
->addr
;
2265 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2268 HI opval
= * FLD (i_src1
);
2269 SETMEMHI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2270 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2277 CASE (sem
, INSN_STH_D
) : /* sth $src1,@($slo16,$src2) */
2279 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2280 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2281 #define FLD(f) abuf->fields.sfmt_st_d.f
2282 int UNUSED written
= 0;
2283 IADDR UNUSED pc
= abuf
->addr
;
2284 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2287 HI opval
= * FLD (i_src1
);
2288 SETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2289 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2296 CASE (sem
, INSN_ST_PLUS
) : /* st $src1,@+$src2 */
2298 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2299 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2300 #define FLD(f) abuf->fields.sfmt_st_plus.f
2301 int UNUSED written
= 0;
2302 IADDR UNUSED pc
= abuf
->addr
;
2303 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2307 tmp_new_src2
= ADDSI (* FLD (i_src2
), 4);
2309 SI opval
= * FLD (i_src1
);
2310 SETMEMSI (current_cpu
, pc
, tmp_new_src2
, opval
);
2311 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2314 SI opval
= tmp_new_src2
;
2315 * FLD (i_src2
) = opval
;
2316 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2324 CASE (sem
, INSN_ST_MINUS
) : /* st $src1,@-$src2 */
2326 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2327 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2328 #define FLD(f) abuf->fields.sfmt_st_plus.f
2329 int UNUSED written
= 0;
2330 IADDR UNUSED pc
= abuf
->addr
;
2331 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2335 tmp_new_src2
= SUBSI (* FLD (i_src2
), 4);
2337 SI opval
= * FLD (i_src1
);
2338 SETMEMSI (current_cpu
, pc
, tmp_new_src2
, opval
);
2339 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2342 SI opval
= tmp_new_src2
;
2343 * FLD (i_src2
) = opval
;
2344 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2352 CASE (sem
, INSN_SUB
) : /* sub $dr,$sr */
2354 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2355 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2356 #define FLD(f) abuf->fields.sfmt_add.f
2357 int UNUSED written
= 0;
2358 IADDR UNUSED pc
= abuf
->addr
;
2359 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2362 SI opval
= SUBSI (* FLD (i_dr
), * FLD (i_sr
));
2363 * FLD (i_dr
) = opval
;
2364 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2371 CASE (sem
, INSN_SUBV
) : /* subv $dr,$sr */
2373 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2374 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2375 #define FLD(f) abuf->fields.sfmt_add.f
2376 int UNUSED written
= 0;
2377 IADDR UNUSED pc
= abuf
->addr
;
2378 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2382 temp0
= SUBSI (* FLD (i_dr
), * FLD (i_sr
));
2383 temp1
= SUBOFSI (* FLD (i_dr
), * FLD (i_sr
), 0);
2386 * FLD (i_dr
) = opval
;
2387 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2391 CPU (h_cond
) = opval
;
2392 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2400 CASE (sem
, INSN_SUBX
) : /* subx $dr,$sr */
2402 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2403 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2404 #define FLD(f) abuf->fields.sfmt_add.f
2405 int UNUSED written
= 0;
2406 IADDR UNUSED pc
= abuf
->addr
;
2407 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2411 temp0
= SUBCSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
2412 temp1
= SUBCFSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
2415 * FLD (i_dr
) = opval
;
2416 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2420 CPU (h_cond
) = opval
;
2421 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2429 CASE (sem
, INSN_TRAP
) : /* trap $uimm4 */
2431 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2432 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2433 #define FLD(f) abuf->fields.sfmt_trap.f
2434 int UNUSED written
= 0;
2435 IADDR UNUSED pc
= abuf
->addr
;
2437 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2441 USI opval
= GET_H_CR (((UINT
) 6));
2442 SET_H_CR (((UINT
) 14), opval
);
2443 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2446 USI opval
= ADDSI (pc
, 4);
2447 SET_H_CR (((UINT
) 6), opval
);
2448 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2451 UQI opval
= CPU (h_bpsw
);
2452 CPU (h_bbpsw
) = opval
;
2453 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bbpsw", 'x', opval
);
2456 UQI opval
= GET_H_PSW ();
2457 CPU (h_bpsw
) = opval
;
2458 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bpsw", 'x', opval
);
2461 UQI opval
= ANDQI (GET_H_PSW (), 128);
2463 CGEN_TRACE_RESULT (current_cpu
, abuf
, "psw", 'x', opval
);
2466 SI opval
= m32r_trap (current_cpu
, pc
, FLD (f_uimm4
));
2467 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
2468 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
2472 SEM_BRANCH_FINI (vpc
);
2477 CASE (sem
, INSN_UNLOCK
) : /* unlock $src1,@$src2 */
2479 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2480 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2481 #define FLD(f) abuf->fields.sfmt_st_plus.f
2482 int UNUSED written
= 0;
2483 IADDR UNUSED pc
= abuf
->addr
;
2484 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2489 SI opval
= * FLD (i_src1
);
2490 SETMEMSI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2491 written
|= (1 << 4);
2492 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2497 CPU (h_lock
) = opval
;
2498 CGEN_TRACE_RESULT (current_cpu
, abuf
, "lock", 'x', opval
);
2502 abuf
->written
= written
;
2507 CASE (sem
, INSN_CLRPSW
) : /* clrpsw $uimm8 */
2509 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2510 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2511 #define FLD(f) abuf->fields.sfmt_clrpsw.f
2512 int UNUSED written
= 0;
2513 IADDR UNUSED pc
= abuf
->addr
;
2514 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2517 USI opval
= ANDSI (GET_H_CR (((UINT
) 0)), ORSI (ZEXTQISI (INVQI (FLD (f_uimm8
))), 65280));
2518 SET_H_CR (((UINT
) 0), opval
);
2519 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2526 CASE (sem
, INSN_SETPSW
) : /* setpsw $uimm8 */
2528 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2529 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2530 #define FLD(f) abuf->fields.sfmt_clrpsw.f
2531 int UNUSED written
= 0;
2532 IADDR UNUSED pc
= abuf
->addr
;
2533 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2536 USI opval
= FLD (f_uimm8
);
2537 SET_H_CR (((UINT
) 0), opval
);
2538 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2545 CASE (sem
, INSN_BSET
) : /* bset $uimm3,@($slo16,$sr) */
2547 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2548 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2549 #define FLD(f) abuf->fields.sfmt_bset.f
2550 int UNUSED written
= 0;
2551 IADDR UNUSED pc
= abuf
->addr
;
2552 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2555 QI opval
= ORQI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))), SLLQI (1, SUBSI (7, FLD (f_uimm3
))));
2556 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)), opval
);
2557 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2564 CASE (sem
, INSN_BCLR
) : /* bclr $uimm3,@($slo16,$sr) */
2566 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2567 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2568 #define FLD(f) abuf->fields.sfmt_bset.f
2569 int UNUSED written
= 0;
2570 IADDR UNUSED pc
= abuf
->addr
;
2571 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2574 QI opval
= ANDQI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))), INVQI (SLLQI (1, SUBSI (7, FLD (f_uimm3
)))));
2575 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)), opval
);
2576 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2583 CASE (sem
, INSN_BTST
) : /* btst $uimm3,$sr */
2585 SEM_ARG sem_arg
= SEM_SEM_ARG (vpc
, sc
);
2586 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2587 #define FLD(f) abuf->fields.sfmt_bset.f
2588 int UNUSED written
= 0;
2589 IADDR UNUSED pc
= abuf
->addr
;
2590 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2593 BI opval
= ANDQI (SRLQI (* FLD (i_sr
), SUBSI (7, FLD (f_uimm3
))), 1);
2594 CPU (h_cond
) = opval
;
2595 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2604 ENDSWITCH (sem
) /* End of semantic switch. */
2606 /* At this point `vpc' contains the next insn to execute. */
2609 #undef DEFINE_SWITCH
2610 #endif /* DEFINE_SWITCH */