Commit | Line | Data |
---|---|---|
cbb38b47 BE |
1 | /* Simulator instruction semantics for sh64. |
2 | ||
3 | THIS FILE IS MACHINE GENERATED WITH CGEN. | |
4 | ||
c5a57081 | 5 | Copyright 1996-2010, 2012 Free Software Foundation, Inc. |
cbb38b47 | 6 | |
c7e628df | 7 | This file is part of the GNU simulators. |
cbb38b47 | 8 | |
fda1c30b DE |
9 | This file is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 3, or (at your option) | |
12 | any later version. | |
cbb38b47 | 13 | |
fda1c30b DE |
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. | |
cbb38b47 | 18 | |
fda1c30b DE |
19 | You should have received a copy of the GNU General Public License along |
20 | with this program; if not, write to the Free Software Foundation, Inc., | |
21 | 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. | |
cbb38b47 BE |
22 | |
23 | */ | |
24 | ||
25 | #define WANT_CPU sh64 | |
26 | #define WANT_CPU_SH64 | |
27 | ||
28 | #include "sim-main.h" | |
29 | #include "cgen-mem.h" | |
30 | #include "cgen-ops.h" | |
31 | ||
32 | #undef GET_ATTR | |
cbb38b47 | 33 | #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr) |
cbb38b47 BE |
34 | |
35 | /* This is used so that we can compile two copies of the semantic code, | |
36 | one with full feature support and one without that runs fast(er). | |
37 | FAST_P, when desired, is defined on the command line, -DFAST_P=1. */ | |
38 | #if FAST_P | |
39 | #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn) | |
40 | #undef TRACE_RESULT | |
41 | #define TRACE_RESULT(cpu, abuf, name, type, val) | |
42 | #else | |
43 | #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn) | |
44 | #endif | |
45 | ||
46 | /* x-invalid: --invalid-- */ | |
47 | ||
48 | static SEM_PC | |
49 | SEM_FN_NAME (sh64_compact,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
50 | { | |
2310652a | 51 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
52 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
53 | int UNUSED written = 0; | |
54 | IADDR UNUSED pc = abuf->addr; | |
55 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
56 | ||
57 | { | |
58 | /* Update the recorded pc in the cpu state struct. | |
59 | Only necessary for WITH_SCACHE case, but to avoid the | |
60 | conditional compilation .... */ | |
61 | SET_H_PC (pc); | |
62 | /* Virtual insns have zero size. Overwrite vpc with address of next insn | |
63 | using the default-insn-bitsize spec. When executing insns in parallel | |
64 | we may want to queue the fault and continue execution. */ | |
65 | vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
66 | vpc = sim_engine_invalid_insn (current_cpu, pc, vpc); | |
67 | } | |
68 | ||
69 | return vpc; | |
70 | #undef FLD | |
71 | } | |
72 | ||
73 | /* x-after: --after-- */ | |
74 | ||
75 | static SEM_PC | |
76 | SEM_FN_NAME (sh64_compact,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
77 | { | |
2310652a | 78 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
79 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
80 | int UNUSED written = 0; | |
81 | IADDR UNUSED pc = abuf->addr; | |
82 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
83 | ||
84 | { | |
85 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
86 | sh64_compact_pbb_after (current_cpu, sem_arg); | |
87 | #endif | |
88 | } | |
89 | ||
90 | return vpc; | |
91 | #undef FLD | |
92 | } | |
93 | ||
94 | /* x-before: --before-- */ | |
95 | ||
96 | static SEM_PC | |
97 | SEM_FN_NAME (sh64_compact,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
98 | { | |
2310652a | 99 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
100 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
101 | int UNUSED written = 0; | |
102 | IADDR UNUSED pc = abuf->addr; | |
103 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
104 | ||
105 | { | |
106 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
107 | sh64_compact_pbb_before (current_cpu, sem_arg); | |
108 | #endif | |
109 | } | |
110 | ||
111 | return vpc; | |
112 | #undef FLD | |
113 | } | |
114 | ||
115 | /* x-cti-chain: --cti-chain-- */ | |
116 | ||
117 | static SEM_PC | |
118 | SEM_FN_NAME (sh64_compact,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
119 | { | |
2310652a | 120 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
121 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
122 | int UNUSED written = 0; | |
123 | IADDR UNUSED pc = abuf->addr; | |
124 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
125 | ||
126 | { | |
127 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
128 | #ifdef DEFINE_SWITCH | |
129 | vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg, | |
130 | pbb_br_type, pbb_br_npc); | |
131 | BREAK (sem); | |
132 | #else | |
133 | /* FIXME: Allow provision of explicit ifmt spec in insn spec. */ | |
134 | vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg, | |
135 | CPU_PBB_BR_TYPE (current_cpu), | |
136 | CPU_PBB_BR_NPC (current_cpu)); | |
137 | #endif | |
138 | #endif | |
139 | } | |
140 | ||
141 | return vpc; | |
142 | #undef FLD | |
143 | } | |
144 | ||
145 | /* x-chain: --chain-- */ | |
146 | ||
147 | static SEM_PC | |
148 | SEM_FN_NAME (sh64_compact,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
149 | { | |
2310652a | 150 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
151 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
152 | int UNUSED written = 0; | |
153 | IADDR UNUSED pc = abuf->addr; | |
154 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
155 | ||
156 | { | |
157 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
158 | vpc = sh64_compact_pbb_chain (current_cpu, sem_arg); | |
159 | #ifdef DEFINE_SWITCH | |
160 | BREAK (sem); | |
161 | #endif | |
162 | #endif | |
163 | } | |
164 | ||
165 | return vpc; | |
166 | #undef FLD | |
167 | } | |
168 | ||
169 | /* x-begin: --begin-- */ | |
170 | ||
171 | static SEM_PC | |
172 | SEM_FN_NAME (sh64_compact,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
173 | { | |
2310652a | 174 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
175 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
176 | int UNUSED written = 0; | |
177 | IADDR UNUSED pc = abuf->addr; | |
178 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
179 | ||
180 | { | |
181 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
182 | #if defined DEFINE_SWITCH || defined FAST_P | |
183 | /* In the switch case FAST_P is a constant, allowing several optimizations | |
184 | in any called inline functions. */ | |
185 | vpc = sh64_compact_pbb_begin (current_cpu, FAST_P); | |
186 | #else | |
187 | #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */ | |
188 | vpc = sh64_compact_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu))); | |
189 | #else | |
190 | vpc = sh64_compact_pbb_begin (current_cpu, 0); | |
191 | #endif | |
192 | #endif | |
193 | #endif | |
194 | } | |
195 | ||
196 | return vpc; | |
197 | #undef FLD | |
198 | } | |
199 | ||
200 | /* add-compact: add $rm, $rn */ | |
201 | ||
202 | static SEM_PC | |
203 | SEM_FN_NAME (sh64_compact,add_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
204 | { | |
c7e628df | 205 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
206 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
207 | int UNUSED written = 0; | |
208 | IADDR UNUSED pc = abuf->addr; | |
209 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
210 | ||
211 | { | |
212 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
213 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 214 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
215 | } |
216 | ||
217 | return vpc; | |
218 | #undef FLD | |
219 | } | |
220 | ||
221 | /* addi-compact: add #$imm8, $rn */ | |
222 | ||
223 | static SEM_PC | |
224 | SEM_FN_NAME (sh64_compact,addi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
225 | { | |
226 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
227 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
228 | int UNUSED written = 0; | |
229 | IADDR UNUSED pc = abuf->addr; | |
230 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
231 | ||
232 | { | |
233 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), EXTQISI (ANDQI (FLD (f_imm8), 255))); | |
234 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 235 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
236 | } |
237 | ||
238 | return vpc; | |
239 | #undef FLD | |
240 | } | |
241 | ||
242 | /* addc-compact: addc $rm, $rn */ | |
243 | ||
244 | static SEM_PC | |
245 | SEM_FN_NAME (sh64_compact,addc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
246 | { | |
c7e628df | 247 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
248 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
249 | int UNUSED written = 0; | |
250 | IADDR UNUSED pc = abuf->addr; | |
251 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
252 | ||
253 | { | |
254 | BI tmp_flag; | |
255 | tmp_flag = ADDCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
256 | { | |
257 | SI opval = ADDCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
258 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 259 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
260 | } |
261 | { | |
262 | BI opval = tmp_flag; | |
263 | SET_H_TBIT (opval); | |
264 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
265 | } | |
266 | } | |
267 | ||
268 | return vpc; | |
269 | #undef FLD | |
270 | } | |
271 | ||
272 | /* addv-compact: addv $rm, $rn */ | |
273 | ||
274 | static SEM_PC | |
275 | SEM_FN_NAME (sh64_compact,addv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
276 | { | |
c7e628df | 277 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
278 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
279 | int UNUSED written = 0; | |
280 | IADDR UNUSED pc = abuf->addr; | |
281 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
282 | ||
283 | { | |
284 | BI tmp_t; | |
285 | tmp_t = ADDOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0); | |
286 | { | |
287 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
288 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 289 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
290 | } |
291 | { | |
292 | BI opval = tmp_t; | |
293 | SET_H_TBIT (opval); | |
294 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
295 | } | |
296 | } | |
297 | ||
298 | return vpc; | |
299 | #undef FLD | |
300 | } | |
301 | ||
302 | /* and-compact: and $rm64, $rn64 */ | |
303 | ||
304 | static SEM_PC | |
305 | SEM_FN_NAME (sh64_compact,and_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
306 | { | |
c7e628df | 307 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
308 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
309 | int UNUSED written = 0; | |
310 | IADDR UNUSED pc = abuf->addr; | |
311 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
312 | ||
313 | { | |
314 | DI opval = ANDDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn))); | |
315 | SET_H_GR (FLD (f_rn), opval); | |
c7e628df | 316 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
317 | } |
318 | ||
319 | return vpc; | |
320 | #undef FLD | |
321 | } | |
322 | ||
323 | /* andi-compact: and #$uimm8, r0 */ | |
324 | ||
325 | static SEM_PC | |
326 | SEM_FN_NAME (sh64_compact,andi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
327 | { | |
328 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
329 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
330 | int UNUSED written = 0; | |
331 | IADDR UNUSED pc = abuf->addr; | |
332 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
333 | ||
334 | { | |
335 | SI opval = ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8))); | |
336 | SET_H_GRC (((UINT) 0), opval); | |
c7e628df | 337 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
338 | } |
339 | ||
340 | return vpc; | |
341 | #undef FLD | |
342 | } | |
343 | ||
344 | /* andb-compact: and.b #$imm8, @(r0, gbr) */ | |
345 | ||
346 | static SEM_PC | |
347 | SEM_FN_NAME (sh64_compact,andb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
348 | { | |
349 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
350 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
351 | int UNUSED written = 0; | |
352 | IADDR UNUSED pc = abuf->addr; | |
353 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
354 | ||
355 | { | |
356 | DI tmp_addr; | |
357 | UQI tmp_data; | |
358 | tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ()); | |
359 | tmp_data = ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)); | |
360 | { | |
361 | UQI opval = tmp_data; | |
362 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
363 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
364 | } | |
365 | } | |
366 | ||
367 | return vpc; | |
368 | #undef FLD | |
369 | } | |
370 | ||
371 | /* bf-compact: bf $disp8 */ | |
372 | ||
373 | static SEM_PC | |
374 | SEM_FN_NAME (sh64_compact,bf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
375 | { | |
376 | #define FLD(f) abuf->fields.sfmt_bf_compact.f | |
377 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
378 | int UNUSED written = 0; | |
379 | IADDR UNUSED pc = abuf->addr; | |
380 | SEM_BRANCH_INIT | |
381 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
382 | ||
383 | if (NOTBI (GET_H_TBIT ())) { | |
384 | { | |
385 | UDI opval = FLD (i_disp8); | |
386 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
387 | written |= (1 << 2); | |
388 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
389 | } | |
390 | } | |
391 | ||
392 | abuf->written = written; | |
393 | SEM_BRANCH_FINI (vpc); | |
394 | return vpc; | |
395 | #undef FLD | |
396 | } | |
397 | ||
398 | /* bfs-compact: bf/s $disp8 */ | |
399 | ||
400 | static SEM_PC | |
401 | SEM_FN_NAME (sh64_compact,bfs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
402 | { | |
403 | #define FLD(f) abuf->fields.sfmt_bf_compact.f | |
404 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
405 | int UNUSED written = 0; | |
406 | IADDR UNUSED pc = abuf->addr; | |
407 | SEM_BRANCH_INIT | |
408 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
409 | ||
410 | if (NOTBI (GET_H_TBIT ())) { | |
c7e628df DB |
411 | { |
412 | { | |
413 | UDI opval = ADDDI (pc, 2); | |
414 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
415 | written |= (1 << 3); | |
416 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
417 | } | |
418 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
419 | { |
420 | { | |
421 | UDI opval = FLD (i_disp8); | |
422 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
c7e628df | 423 | written |= (1 << 3); |
cbb38b47 BE |
424 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); |
425 | } | |
426 | } | |
c7e628df | 427 | } |
cbb38b47 BE |
428 | } |
429 | ||
430 | abuf->written = written; | |
431 | SEM_BRANCH_FINI (vpc); | |
432 | return vpc; | |
433 | #undef FLD | |
434 | } | |
435 | ||
436 | /* bra-compact: bra $disp12 */ | |
437 | ||
438 | static SEM_PC | |
439 | SEM_FN_NAME (sh64_compact,bra_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
440 | { | |
441 | #define FLD(f) abuf->fields.sfmt_bra_compact.f | |
442 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
443 | int UNUSED written = 0; | |
444 | IADDR UNUSED pc = abuf->addr; | |
445 | SEM_BRANCH_INIT | |
446 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
447 | ||
c7e628df DB |
448 | { |
449 | { | |
450 | UDI opval = ADDDI (pc, 2); | |
451 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
452 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
453 | } | |
454 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
455 | { |
456 | { | |
457 | UDI opval = FLD (i_disp12); | |
458 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
459 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
460 | } | |
c7e628df | 461 | } |
cbb38b47 BE |
462 | } |
463 | ||
464 | SEM_BRANCH_FINI (vpc); | |
465 | return vpc; | |
466 | #undef FLD | |
467 | } | |
468 | ||
469 | /* braf-compact: braf $rn */ | |
470 | ||
471 | static SEM_PC | |
472 | SEM_FN_NAME (sh64_compact,braf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
473 | { | |
474 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
475 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
476 | int UNUSED written = 0; | |
477 | IADDR UNUSED pc = abuf->addr; | |
478 | SEM_BRANCH_INIT | |
479 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
480 | ||
c7e628df DB |
481 | { |
482 | { | |
483 | UDI opval = ADDDI (pc, 2); | |
484 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
485 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
486 | } | |
487 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
488 | { |
489 | { | |
490 | UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4)); | |
491 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
492 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
493 | } | |
c7e628df | 494 | } |
cbb38b47 BE |
495 | } |
496 | ||
497 | SEM_BRANCH_FINI (vpc); | |
498 | return vpc; | |
499 | #undef FLD | |
500 | } | |
501 | ||
502 | /* brk-compact: brk */ | |
503 | ||
504 | static SEM_PC | |
505 | SEM_FN_NAME (sh64_compact,brk_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
506 | { | |
2310652a | 507 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
508 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
509 | int UNUSED written = 0; | |
510 | IADDR UNUSED pc = abuf->addr; | |
511 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
512 | ||
513 | sh64_break (current_cpu, pc); | |
514 | ||
515 | return vpc; | |
516 | #undef FLD | |
517 | } | |
518 | ||
519 | /* bsr-compact: bsr $disp12 */ | |
520 | ||
521 | static SEM_PC | |
522 | SEM_FN_NAME (sh64_compact,bsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
523 | { | |
524 | #define FLD(f) abuf->fields.sfmt_bra_compact.f | |
525 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
526 | int UNUSED written = 0; | |
527 | IADDR UNUSED pc = abuf->addr; | |
528 | SEM_BRANCH_INIT | |
529 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
530 | ||
531 | { | |
532 | { | |
533 | { | |
534 | SI opval = ADDDI (pc, 4); | |
535 | SET_H_PR (opval); | |
536 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
537 | } | |
c7e628df DB |
538 | } |
539 | { | |
540 | UDI opval = ADDDI (pc, 2); | |
541 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
542 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
543 | } | |
544 | ((void) 0); /*nop*/ | |
545 | { | |
cbb38b47 BE |
546 | { |
547 | UDI opval = FLD (i_disp12); | |
548 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
549 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
550 | } | |
551 | } | |
552 | } | |
553 | ||
554 | SEM_BRANCH_FINI (vpc); | |
555 | return vpc; | |
556 | #undef FLD | |
557 | } | |
558 | ||
559 | /* bsrf-compact: bsrf $rn */ | |
560 | ||
561 | static SEM_PC | |
562 | SEM_FN_NAME (sh64_compact,bsrf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
563 | { | |
564 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
565 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
566 | int UNUSED written = 0; | |
567 | IADDR UNUSED pc = abuf->addr; | |
568 | SEM_BRANCH_INIT | |
569 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
570 | ||
571 | { | |
572 | { | |
573 | { | |
574 | SI opval = ADDDI (pc, 4); | |
575 | SET_H_PR (opval); | |
576 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
577 | } | |
c7e628df DB |
578 | } |
579 | { | |
580 | UDI opval = ADDDI (pc, 2); | |
581 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
582 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
583 | } | |
584 | ((void) 0); /*nop*/ | |
585 | { | |
cbb38b47 BE |
586 | { |
587 | UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4)); | |
588 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
589 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
590 | } | |
591 | } | |
592 | } | |
593 | ||
594 | SEM_BRANCH_FINI (vpc); | |
595 | return vpc; | |
596 | #undef FLD | |
597 | } | |
598 | ||
599 | /* bt-compact: bt $disp8 */ | |
600 | ||
601 | static SEM_PC | |
602 | SEM_FN_NAME (sh64_compact,bt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
603 | { | |
604 | #define FLD(f) abuf->fields.sfmt_bf_compact.f | |
605 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
606 | int UNUSED written = 0; | |
607 | IADDR UNUSED pc = abuf->addr; | |
608 | SEM_BRANCH_INIT | |
609 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
610 | ||
611 | if (GET_H_TBIT ()) { | |
612 | { | |
613 | UDI opval = FLD (i_disp8); | |
614 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
615 | written |= (1 << 2); | |
616 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
617 | } | |
618 | } | |
619 | ||
620 | abuf->written = written; | |
621 | SEM_BRANCH_FINI (vpc); | |
622 | return vpc; | |
623 | #undef FLD | |
624 | } | |
625 | ||
626 | /* bts-compact: bt/s $disp8 */ | |
627 | ||
628 | static SEM_PC | |
629 | SEM_FN_NAME (sh64_compact,bts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
630 | { | |
631 | #define FLD(f) abuf->fields.sfmt_bf_compact.f | |
632 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
633 | int UNUSED written = 0; | |
634 | IADDR UNUSED pc = abuf->addr; | |
635 | SEM_BRANCH_INIT | |
636 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
637 | ||
638 | if (GET_H_TBIT ()) { | |
c7e628df DB |
639 | { |
640 | { | |
641 | UDI opval = ADDDI (pc, 2); | |
642 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
643 | written |= (1 << 3); | |
644 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
645 | } | |
646 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
647 | { |
648 | { | |
649 | UDI opval = FLD (i_disp8); | |
650 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
c7e628df | 651 | written |= (1 << 3); |
cbb38b47 BE |
652 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); |
653 | } | |
654 | } | |
c7e628df | 655 | } |
cbb38b47 BE |
656 | } |
657 | ||
658 | abuf->written = written; | |
659 | SEM_BRANCH_FINI (vpc); | |
660 | return vpc; | |
661 | #undef FLD | |
662 | } | |
663 | ||
664 | /* clrmac-compact: clrmac */ | |
665 | ||
666 | static SEM_PC | |
667 | SEM_FN_NAME (sh64_compact,clrmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
668 | { | |
2310652a | 669 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
670 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
671 | int UNUSED written = 0; | |
672 | IADDR UNUSED pc = abuf->addr; | |
673 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
674 | ||
675 | { | |
676 | { | |
677 | SI opval = 0; | |
678 | SET_H_MACL (opval); | |
679 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
680 | } | |
681 | { | |
682 | SI opval = 0; | |
683 | SET_H_MACH (opval); | |
684 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
685 | } | |
686 | } | |
687 | ||
688 | return vpc; | |
689 | #undef FLD | |
690 | } | |
691 | ||
692 | /* clrs-compact: clrs */ | |
693 | ||
694 | static SEM_PC | |
695 | SEM_FN_NAME (sh64_compact,clrs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
696 | { | |
2310652a | 697 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
698 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
699 | int UNUSED written = 0; | |
700 | IADDR UNUSED pc = abuf->addr; | |
701 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
702 | ||
703 | { | |
704 | BI opval = 0; | |
705 | SET_H_SBIT (opval); | |
706 | TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval); | |
707 | } | |
708 | ||
709 | return vpc; | |
710 | #undef FLD | |
711 | } | |
712 | ||
713 | /* clrt-compact: clrt */ | |
714 | ||
715 | static SEM_PC | |
716 | SEM_FN_NAME (sh64_compact,clrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
717 | { | |
2310652a | 718 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
719 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
720 | int UNUSED written = 0; | |
721 | IADDR UNUSED pc = abuf->addr; | |
722 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
723 | ||
724 | { | |
725 | BI opval = 0; | |
726 | SET_H_TBIT (opval); | |
727 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
728 | } | |
729 | ||
730 | return vpc; | |
731 | #undef FLD | |
732 | } | |
733 | ||
734 | /* cmpeq-compact: cmp/eq $rm, $rn */ | |
735 | ||
736 | static SEM_PC | |
737 | SEM_FN_NAME (sh64_compact,cmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
738 | { | |
c7e628df | 739 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
740 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
741 | int UNUSED written = 0; | |
742 | IADDR UNUSED pc = abuf->addr; | |
743 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
744 | ||
745 | { | |
746 | BI opval = EQSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))); | |
747 | SET_H_TBIT (opval); | |
748 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
749 | } | |
750 | ||
751 | return vpc; | |
752 | #undef FLD | |
753 | } | |
754 | ||
755 | /* cmpeqi-compact: cmp/eq #$imm8, r0 */ | |
756 | ||
757 | static SEM_PC | |
758 | SEM_FN_NAME (sh64_compact,cmpeqi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
759 | { | |
760 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
761 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
762 | int UNUSED written = 0; | |
763 | IADDR UNUSED pc = abuf->addr; | |
764 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
765 | ||
766 | { | |
767 | BI opval = EQSI (GET_H_GRC (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255))); | |
768 | SET_H_TBIT (opval); | |
769 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
770 | } | |
771 | ||
772 | return vpc; | |
773 | #undef FLD | |
774 | } | |
775 | ||
776 | /* cmpge-compact: cmp/ge $rm, $rn */ | |
777 | ||
778 | static SEM_PC | |
779 | SEM_FN_NAME (sh64_compact,cmpge_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
780 | { | |
c7e628df | 781 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
782 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
783 | int UNUSED written = 0; | |
784 | IADDR UNUSED pc = abuf->addr; | |
785 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
786 | ||
787 | { | |
788 | BI opval = GESI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
789 | SET_H_TBIT (opval); | |
790 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
791 | } | |
792 | ||
793 | return vpc; | |
794 | #undef FLD | |
795 | } | |
796 | ||
797 | /* cmpgt-compact: cmp/gt $rm, $rn */ | |
798 | ||
799 | static SEM_PC | |
800 | SEM_FN_NAME (sh64_compact,cmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
801 | { | |
c7e628df | 802 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
803 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
804 | int UNUSED written = 0; | |
805 | IADDR UNUSED pc = abuf->addr; | |
806 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
807 | ||
808 | { | |
809 | BI opval = GTSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
810 | SET_H_TBIT (opval); | |
811 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
812 | } | |
813 | ||
814 | return vpc; | |
815 | #undef FLD | |
816 | } | |
817 | ||
818 | /* cmphi-compact: cmp/hi $rm, $rn */ | |
819 | ||
820 | static SEM_PC | |
821 | SEM_FN_NAME (sh64_compact,cmphi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
822 | { | |
c7e628df | 823 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
824 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
825 | int UNUSED written = 0; | |
826 | IADDR UNUSED pc = abuf->addr; | |
827 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
828 | ||
829 | { | |
830 | BI opval = GTUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
831 | SET_H_TBIT (opval); | |
832 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
833 | } | |
834 | ||
835 | return vpc; | |
836 | #undef FLD | |
837 | } | |
838 | ||
839 | /* cmphs-compact: cmp/hs $rm, $rn */ | |
840 | ||
841 | static SEM_PC | |
842 | SEM_FN_NAME (sh64_compact,cmphs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
843 | { | |
c7e628df | 844 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
845 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
846 | int UNUSED written = 0; | |
847 | IADDR UNUSED pc = abuf->addr; | |
848 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
849 | ||
850 | { | |
851 | BI opval = GEUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
852 | SET_H_TBIT (opval); | |
853 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
854 | } | |
855 | ||
856 | return vpc; | |
857 | #undef FLD | |
858 | } | |
859 | ||
860 | /* cmppl-compact: cmp/pl $rn */ | |
861 | ||
862 | static SEM_PC | |
863 | SEM_FN_NAME (sh64_compact,cmppl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
864 | { | |
865 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
866 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
867 | int UNUSED written = 0; | |
868 | IADDR UNUSED pc = abuf->addr; | |
869 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
870 | ||
871 | { | |
872 | BI opval = GTSI (GET_H_GRC (FLD (f_rn)), 0); | |
873 | SET_H_TBIT (opval); | |
874 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
875 | } | |
876 | ||
877 | return vpc; | |
878 | #undef FLD | |
879 | } | |
880 | ||
881 | /* cmppz-compact: cmp/pz $rn */ | |
882 | ||
883 | static SEM_PC | |
884 | SEM_FN_NAME (sh64_compact,cmppz_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
885 | { | |
886 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
887 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
888 | int UNUSED written = 0; | |
889 | IADDR UNUSED pc = abuf->addr; | |
890 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
891 | ||
892 | { | |
893 | BI opval = GESI (GET_H_GRC (FLD (f_rn)), 0); | |
894 | SET_H_TBIT (opval); | |
895 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
896 | } | |
897 | ||
898 | return vpc; | |
899 | #undef FLD | |
900 | } | |
901 | ||
902 | /* cmpstr-compact: cmp/str $rm, $rn */ | |
903 | ||
904 | static SEM_PC | |
905 | SEM_FN_NAME (sh64_compact,cmpstr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
906 | { | |
c7e628df | 907 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
908 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
909 | int UNUSED written = 0; | |
910 | IADDR UNUSED pc = abuf->addr; | |
911 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
912 | ||
913 | { | |
914 | BI tmp_t; | |
915 | SI tmp_temp; | |
916 | tmp_temp = XORSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))); | |
917 | tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0); | |
918 | tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t); | |
919 | tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t); | |
920 | tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t); | |
921 | { | |
922 | BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0)); | |
923 | SET_H_TBIT (opval); | |
924 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
925 | } | |
926 | } | |
927 | ||
928 | return vpc; | |
929 | #undef FLD | |
930 | } | |
931 | ||
932 | /* div0s-compact: div0s $rm, $rn */ | |
933 | ||
934 | static SEM_PC | |
935 | SEM_FN_NAME (sh64_compact,div0s_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
936 | { | |
c7e628df | 937 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
938 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
939 | int UNUSED written = 0; | |
940 | IADDR UNUSED pc = abuf->addr; | |
941 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
942 | ||
943 | { | |
944 | { | |
945 | BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
946 | SET_H_QBIT (opval); | |
947 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
948 | } | |
949 | { | |
950 | BI opval = SRLSI (GET_H_GRC (FLD (f_rm)), 31); | |
951 | SET_H_MBIT (opval); | |
952 | TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval); | |
953 | } | |
954 | { | |
955 | BI opval = ((EQSI (SRLSI (GET_H_GRC (FLD (f_rm)), 31), SRLSI (GET_H_GRC (FLD (f_rn)), 31))) ? (0) : (1)); | |
956 | SET_H_TBIT (opval); | |
957 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
958 | } | |
959 | } | |
960 | ||
961 | return vpc; | |
962 | #undef FLD | |
963 | } | |
964 | ||
965 | /* div0u-compact: div0u */ | |
966 | ||
967 | static SEM_PC | |
968 | SEM_FN_NAME (sh64_compact,div0u_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
969 | { | |
2310652a | 970 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
971 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
972 | int UNUSED written = 0; | |
973 | IADDR UNUSED pc = abuf->addr; | |
974 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
975 | ||
976 | { | |
977 | { | |
978 | BI opval = 0; | |
979 | SET_H_TBIT (opval); | |
980 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
981 | } | |
982 | { | |
983 | BI opval = 0; | |
984 | SET_H_QBIT (opval); | |
985 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
986 | } | |
987 | { | |
988 | BI opval = 0; | |
989 | SET_H_MBIT (opval); | |
990 | TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval); | |
991 | } | |
992 | } | |
993 | ||
994 | return vpc; | |
995 | #undef FLD | |
996 | } | |
997 | ||
998 | /* div1-compact: div1 $rm, $rn */ | |
999 | ||
1000 | static SEM_PC | |
1001 | SEM_FN_NAME (sh64_compact,div1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1002 | { | |
c7e628df | 1003 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1004 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1005 | int UNUSED written = 0; | |
1006 | IADDR UNUSED pc = abuf->addr; | |
1007 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1008 | ||
1009 | { | |
1010 | BI tmp_oldq; | |
1011 | SI tmp_tmp0; | |
1012 | UQI tmp_tmp1; | |
1013 | tmp_oldq = GET_H_QBIT (); | |
1014 | { | |
1015 | BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
1016 | SET_H_QBIT (opval); | |
1017 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1018 | } | |
1019 | { | |
1020 | SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), ZEXTBISI (GET_H_TBIT ())); | |
1021 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1022 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1023 | } |
1024 | if (NOTBI (tmp_oldq)) { | |
1025 | if (NOTBI (GET_H_MBIT ())) { | |
1026 | { | |
1027 | tmp_tmp0 = GET_H_GRC (FLD (f_rn)); | |
1028 | { | |
1029 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
1030 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1031 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1032 | } |
1033 | tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0); | |
1034 | if (NOTBI (GET_H_QBIT ())) { | |
1035 | { | |
1036 | BI opval = ((tmp_tmp1) ? (1) : (0)); | |
1037 | SET_H_QBIT (opval); | |
1038 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1039 | } | |
1040 | } else { | |
1041 | { | |
1042 | BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0)); | |
1043 | SET_H_QBIT (opval); | |
1044 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1045 | } | |
1046 | } | |
1047 | } | |
1048 | } else { | |
1049 | { | |
1050 | tmp_tmp0 = GET_H_GRC (FLD (f_rn)); | |
1051 | { | |
1052 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
1053 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1054 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1055 | } |
1056 | tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0); | |
1057 | if (NOTBI (GET_H_QBIT ())) { | |
1058 | { | |
1059 | BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0)); | |
1060 | SET_H_QBIT (opval); | |
1061 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1062 | } | |
1063 | } else { | |
1064 | { | |
1065 | BI opval = ((tmp_tmp1) ? (1) : (0)); | |
1066 | SET_H_QBIT (opval); | |
1067 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1068 | } | |
1069 | } | |
1070 | } | |
1071 | } | |
1072 | } else { | |
1073 | if (NOTBI (GET_H_MBIT ())) { | |
1074 | { | |
1075 | tmp_tmp0 = GET_H_GRC (FLD (f_rn)); | |
1076 | { | |
1077 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))); | |
1078 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1079 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1080 | } |
1081 | tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0); | |
1082 | if (NOTBI (GET_H_QBIT ())) { | |
1083 | { | |
1084 | BI opval = ((tmp_tmp1) ? (1) : (0)); | |
1085 | SET_H_QBIT (opval); | |
1086 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1087 | } | |
1088 | } else { | |
1089 | { | |
1090 | BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0)); | |
1091 | SET_H_QBIT (opval); | |
1092 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1093 | } | |
1094 | } | |
1095 | } | |
1096 | } else { | |
1097 | { | |
1098 | tmp_tmp0 = GET_H_GRC (FLD (f_rn)); | |
1099 | { | |
1100 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
1101 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1102 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1103 | } |
1104 | tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0); | |
1105 | if (NOTBI (GET_H_QBIT ())) { | |
1106 | { | |
1107 | BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0)); | |
1108 | SET_H_QBIT (opval); | |
1109 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1110 | } | |
1111 | } else { | |
1112 | { | |
1113 | BI opval = ((tmp_tmp1) ? (1) : (0)); | |
1114 | SET_H_QBIT (opval); | |
1115 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1116 | } | |
1117 | } | |
1118 | } | |
1119 | } | |
1120 | } | |
1121 | { | |
1122 | BI opval = ((EQBI (GET_H_QBIT (), GET_H_MBIT ())) ? (1) : (0)); | |
1123 | SET_H_TBIT (opval); | |
1124 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
1125 | } | |
1126 | } | |
1127 | ||
1128 | return vpc; | |
1129 | #undef FLD | |
1130 | } | |
1131 | ||
c7e628df DB |
1132 | /* divu-compact: divu r0, $rn */ |
1133 | ||
1134 | static SEM_PC | |
1135 | SEM_FN_NAME (sh64_compact,divu_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1136 | { | |
1137 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1138 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1139 | int UNUSED written = 0; | |
1140 | IADDR UNUSED pc = abuf->addr; | |
1141 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1142 | ||
1143 | { | |
1144 | SI opval = UDIVSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (((UINT) 0))); | |
1145 | SET_H_GRC (FLD (f_rn), opval); | |
1146 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
1147 | } | |
1148 | ||
1149 | return vpc; | |
1150 | #undef FLD | |
1151 | } | |
1152 | ||
1153 | /* mulr-compact: mulr r0, $rn */ | |
1154 | ||
1155 | static SEM_PC | |
1156 | SEM_FN_NAME (sh64_compact,mulr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1157 | { | |
1158 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1159 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1160 | int UNUSED written = 0; | |
1161 | IADDR UNUSED pc = abuf->addr; | |
1162 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1163 | ||
1164 | { | |
1165 | SI opval = MULSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (((UINT) 0))); | |
1166 | SET_H_GRC (FLD (f_rn), opval); | |
1167 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
1168 | } | |
1169 | ||
1170 | return vpc; | |
1171 | #undef FLD | |
1172 | } | |
1173 | ||
cbb38b47 BE |
1174 | /* dmulsl-compact: dmuls.l $rm, $rn */ |
1175 | ||
1176 | static SEM_PC | |
1177 | SEM_FN_NAME (sh64_compact,dmulsl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1178 | { | |
c7e628df | 1179 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1180 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1181 | int UNUSED written = 0; | |
1182 | IADDR UNUSED pc = abuf->addr; | |
1183 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1184 | ||
1185 | { | |
1186 | DI tmp_result; | |
1187 | tmp_result = MULDI (EXTSIDI (GET_H_GRC (FLD (f_rm))), EXTSIDI (GET_H_GRC (FLD (f_rn)))); | |
1188 | { | |
1189 | SI opval = SUBWORDDISI (tmp_result, 0); | |
1190 | SET_H_MACH (opval); | |
1191 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
1192 | } | |
1193 | { | |
1194 | SI opval = SUBWORDDISI (tmp_result, 1); | |
1195 | SET_H_MACL (opval); | |
1196 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
1197 | } | |
1198 | } | |
1199 | ||
1200 | return vpc; | |
1201 | #undef FLD | |
1202 | } | |
1203 | ||
1204 | /* dmulul-compact: dmulu.l $rm, $rn */ | |
1205 | ||
1206 | static SEM_PC | |
1207 | SEM_FN_NAME (sh64_compact,dmulul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1208 | { | |
c7e628df | 1209 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1210 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1211 | int UNUSED written = 0; | |
1212 | IADDR UNUSED pc = abuf->addr; | |
1213 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1214 | ||
1215 | { | |
1216 | DI tmp_result; | |
1217 | tmp_result = MULDI (ZEXTSIDI (GET_H_GRC (FLD (f_rm))), ZEXTSIDI (GET_H_GRC (FLD (f_rn)))); | |
1218 | { | |
1219 | SI opval = SUBWORDDISI (tmp_result, 0); | |
1220 | SET_H_MACH (opval); | |
1221 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
1222 | } | |
1223 | { | |
1224 | SI opval = SUBWORDDISI (tmp_result, 1); | |
1225 | SET_H_MACL (opval); | |
1226 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
1227 | } | |
1228 | } | |
1229 | ||
1230 | return vpc; | |
1231 | #undef FLD | |
1232 | } | |
1233 | ||
1234 | /* dt-compact: dt $rn */ | |
1235 | ||
1236 | static SEM_PC | |
1237 | SEM_FN_NAME (sh64_compact,dt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1238 | { | |
1239 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1240 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1241 | int UNUSED written = 0; | |
1242 | IADDR UNUSED pc = abuf->addr; | |
1243 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1244 | ||
1245 | { | |
1246 | { | |
1247 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 1); | |
1248 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1249 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1250 | } |
1251 | { | |
1252 | BI opval = EQSI (GET_H_GRC (FLD (f_rn)), 0); | |
1253 | SET_H_TBIT (opval); | |
1254 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
1255 | } | |
1256 | } | |
1257 | ||
1258 | return vpc; | |
1259 | #undef FLD | |
1260 | } | |
1261 | ||
1262 | /* extsb-compact: exts.b $rm, $rn */ | |
1263 | ||
1264 | static SEM_PC | |
1265 | SEM_FN_NAME (sh64_compact,extsb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1266 | { | |
c7e628df | 1267 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1268 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1269 | int UNUSED written = 0; | |
1270 | IADDR UNUSED pc = abuf->addr; | |
1271 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1272 | ||
1273 | { | |
1274 | SI opval = EXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3)); | |
1275 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1276 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1277 | } |
1278 | ||
1279 | return vpc; | |
1280 | #undef FLD | |
1281 | } | |
1282 | ||
1283 | /* extsw-compact: exts.w $rm, $rn */ | |
1284 | ||
1285 | static SEM_PC | |
1286 | SEM_FN_NAME (sh64_compact,extsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1287 | { | |
c7e628df | 1288 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1289 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1290 | int UNUSED written = 0; | |
1291 | IADDR UNUSED pc = abuf->addr; | |
1292 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1293 | ||
1294 | { | |
1295 | SI opval = EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)); | |
1296 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1297 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1298 | } |
1299 | ||
1300 | return vpc; | |
1301 | #undef FLD | |
1302 | } | |
1303 | ||
1304 | /* extub-compact: extu.b $rm, $rn */ | |
1305 | ||
1306 | static SEM_PC | |
1307 | SEM_FN_NAME (sh64_compact,extub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1308 | { | |
c7e628df | 1309 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1310 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1311 | int UNUSED written = 0; | |
1312 | IADDR UNUSED pc = abuf->addr; | |
1313 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1314 | ||
1315 | { | |
1316 | SI opval = ZEXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3)); | |
1317 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1318 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1319 | } |
1320 | ||
1321 | return vpc; | |
1322 | #undef FLD | |
1323 | } | |
1324 | ||
1325 | /* extuw-compact: extu.w $rm, $rn */ | |
1326 | ||
1327 | static SEM_PC | |
1328 | SEM_FN_NAME (sh64_compact,extuw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1329 | { | |
c7e628df | 1330 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1331 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1332 | int UNUSED written = 0; | |
1333 | IADDR UNUSED pc = abuf->addr; | |
1334 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1335 | ||
1336 | { | |
1337 | SI opval = ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)); | |
1338 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 1339 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
1340 | } |
1341 | ||
1342 | return vpc; | |
1343 | #undef FLD | |
1344 | } | |
1345 | ||
1346 | /* fabs-compact: fabs $fsdn */ | |
1347 | ||
1348 | static SEM_PC | |
1349 | SEM_FN_NAME (sh64_compact,fabs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1350 | { | |
1351 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1352 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1353 | int UNUSED written = 0; | |
1354 | IADDR UNUSED pc = abuf->addr; | |
1355 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1356 | ||
1357 | if (GET_H_PRBIT ()) { | |
1358 | { | |
c7e628df DB |
1359 | DF opval = sh64_fabsd (current_cpu, GET_H_FSD (FLD (f_rn))); |
1360 | SET_H_FSD (FLD (f_rn), opval); | |
1361 | written |= (1 << 2); | |
1362 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1363 | } |
1364 | } else { | |
1365 | { | |
c7e628df DB |
1366 | DF opval = sh64_fabss (current_cpu, GET_H_FSD (FLD (f_rn))); |
1367 | SET_H_FSD (FLD (f_rn), opval); | |
1368 | written |= (1 << 2); | |
1369 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1370 | } |
1371 | } | |
1372 | ||
1373 | abuf->written = written; | |
1374 | return vpc; | |
1375 | #undef FLD | |
1376 | } | |
1377 | ||
1378 | /* fadd-compact: fadd $fsdm, $fsdn */ | |
1379 | ||
1380 | static SEM_PC | |
1381 | SEM_FN_NAME (sh64_compact,fadd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1382 | { | |
c7e628df | 1383 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1384 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1385 | int UNUSED written = 0; | |
1386 | IADDR UNUSED pc = abuf->addr; | |
1387 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1388 | ||
1389 | if (GET_H_PRBIT ()) { | |
1390 | { | |
c7e628df DB |
1391 | DF opval = sh64_faddd (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn))); |
1392 | SET_H_FSD (FLD (f_rn), opval); | |
1393 | written |= (1 << 3); | |
1394 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1395 | } |
1396 | } else { | |
1397 | { | |
c7e628df DB |
1398 | DF opval = sh64_fadds (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn))); |
1399 | SET_H_FSD (FLD (f_rn), opval); | |
1400 | written |= (1 << 3); | |
1401 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1402 | } |
1403 | } | |
1404 | ||
1405 | abuf->written = written; | |
1406 | return vpc; | |
1407 | #undef FLD | |
1408 | } | |
1409 | ||
1410 | /* fcmpeq-compact: fcmp/eq $fsdm, $fsdn */ | |
1411 | ||
1412 | static SEM_PC | |
1413 | SEM_FN_NAME (sh64_compact,fcmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1414 | { | |
c7e628df | 1415 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1416 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1417 | int UNUSED written = 0; | |
1418 | IADDR UNUSED pc = abuf->addr; | |
1419 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1420 | ||
1421 | if (GET_H_PRBIT ()) { | |
1422 | { | |
c7e628df | 1423 | BI opval = sh64_fcmpeqd (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn))); |
cbb38b47 | 1424 | SET_H_TBIT (opval); |
c7e628df | 1425 | written |= (1 << 3); |
cbb38b47 BE |
1426 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); |
1427 | } | |
1428 | } else { | |
1429 | { | |
c7e628df | 1430 | BI opval = sh64_fcmpeqs (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn))); |
cbb38b47 | 1431 | SET_H_TBIT (opval); |
c7e628df | 1432 | written |= (1 << 3); |
cbb38b47 BE |
1433 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); |
1434 | } | |
1435 | } | |
1436 | ||
1437 | abuf->written = written; | |
1438 | return vpc; | |
1439 | #undef FLD | |
1440 | } | |
1441 | ||
1442 | /* fcmpgt-compact: fcmp/gt $fsdm, $fsdn */ | |
1443 | ||
1444 | static SEM_PC | |
1445 | SEM_FN_NAME (sh64_compact,fcmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1446 | { | |
c7e628df | 1447 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1448 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1449 | int UNUSED written = 0; | |
1450 | IADDR UNUSED pc = abuf->addr; | |
1451 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1452 | ||
1453 | if (GET_H_PRBIT ()) { | |
1454 | { | |
c7e628df | 1455 | BI opval = sh64_fcmpgtd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm))); |
cbb38b47 | 1456 | SET_H_TBIT (opval); |
c7e628df | 1457 | written |= (1 << 3); |
cbb38b47 BE |
1458 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); |
1459 | } | |
1460 | } else { | |
1461 | { | |
c7e628df | 1462 | BI opval = sh64_fcmpgts (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm))); |
cbb38b47 | 1463 | SET_H_TBIT (opval); |
c7e628df | 1464 | written |= (1 << 3); |
cbb38b47 BE |
1465 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); |
1466 | } | |
1467 | } | |
1468 | ||
1469 | abuf->written = written; | |
1470 | return vpc; | |
1471 | #undef FLD | |
1472 | } | |
1473 | ||
1474 | /* fcnvds-compact: fcnvds $drn, fpul */ | |
1475 | ||
1476 | static SEM_PC | |
1477 | SEM_FN_NAME (sh64_compact,fcnvds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1478 | { | |
c7e628df | 1479 | #define FLD(f) abuf->fields.sfmt_fmov8_compact.f |
cbb38b47 BE |
1480 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1481 | int UNUSED written = 0; | |
1482 | IADDR UNUSED pc = abuf->addr; | |
1483 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1484 | ||
1485 | { | |
1486 | SF opval = sh64_fcnvds (current_cpu, GET_H_DRC (FLD (f_dn))); | |
1487 | CPU (h_fr[((UINT) 32)]) = opval; | |
c7e628df | 1488 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1489 | } |
1490 | ||
1491 | return vpc; | |
1492 | #undef FLD | |
1493 | } | |
1494 | ||
1495 | /* fcnvsd-compact: fcnvsd fpul, $drn */ | |
1496 | ||
1497 | static SEM_PC | |
1498 | SEM_FN_NAME (sh64_compact,fcnvsd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1499 | { | |
c7e628df | 1500 | #define FLD(f) abuf->fields.sfmt_fmov8_compact.f |
cbb38b47 BE |
1501 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1502 | int UNUSED written = 0; | |
1503 | IADDR UNUSED pc = abuf->addr; | |
1504 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1505 | ||
1506 | { | |
1507 | DF opval = sh64_fcnvsd (current_cpu, CPU (h_fr[((UINT) 32)])); | |
1508 | SET_H_DRC (FLD (f_dn), opval); | |
c7e628df | 1509 | TRACE_RESULT (current_cpu, abuf, "drc", 'f', opval); |
cbb38b47 BE |
1510 | } |
1511 | ||
1512 | return vpc; | |
1513 | #undef FLD | |
1514 | } | |
1515 | ||
1516 | /* fdiv-compact: fdiv $fsdm, $fsdn */ | |
1517 | ||
1518 | static SEM_PC | |
1519 | SEM_FN_NAME (sh64_compact,fdiv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1520 | { | |
c7e628df | 1521 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1522 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1523 | int UNUSED written = 0; | |
1524 | IADDR UNUSED pc = abuf->addr; | |
1525 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1526 | ||
1527 | if (GET_H_PRBIT ()) { | |
1528 | { | |
c7e628df DB |
1529 | DF opval = sh64_fdivd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm))); |
1530 | SET_H_FSD (FLD (f_rn), opval); | |
1531 | written |= (1 << 3); | |
1532 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1533 | } |
1534 | } else { | |
1535 | { | |
c7e628df DB |
1536 | DF opval = sh64_fdivs (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm))); |
1537 | SET_H_FSD (FLD (f_rn), opval); | |
1538 | written |= (1 << 3); | |
1539 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1540 | } |
1541 | } | |
1542 | ||
1543 | abuf->written = written; | |
1544 | return vpc; | |
1545 | #undef FLD | |
1546 | } | |
1547 | ||
1548 | /* fipr-compact: fipr $fvm, $fvn */ | |
1549 | ||
1550 | static SEM_PC | |
1551 | SEM_FN_NAME (sh64_compact,fipr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1552 | { | |
1553 | #define FLD(f) abuf->fields.sfmt_fipr_compact.f | |
1554 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1555 | int UNUSED written = 0; | |
1556 | IADDR UNUSED pc = abuf->addr; | |
1557 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1558 | ||
c7e628df | 1559 | sh64_fipr (current_cpu, FLD (f_vm), FLD (f_vn)); |
cbb38b47 BE |
1560 | |
1561 | return vpc; | |
1562 | #undef FLD | |
1563 | } | |
1564 | ||
c7e628df | 1565 | /* flds-compact: flds $frn, fpul */ |
cbb38b47 BE |
1566 | |
1567 | static SEM_PC | |
1568 | SEM_FN_NAME (sh64_compact,flds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1569 | { | |
1570 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1571 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1572 | int UNUSED written = 0; | |
1573 | IADDR UNUSED pc = abuf->addr; | |
1574 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1575 | ||
1576 | { | |
1577 | SF opval = GET_H_FRC (FLD (f_rn)); | |
1578 | CPU (h_fr[((UINT) 32)]) = opval; | |
c7e628df | 1579 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1580 | } |
1581 | ||
1582 | return vpc; | |
1583 | #undef FLD | |
1584 | } | |
1585 | ||
1586 | /* fldi0-compact: fldi0 $frn */ | |
1587 | ||
1588 | static SEM_PC | |
1589 | SEM_FN_NAME (sh64_compact,fldi0_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1590 | { | |
1591 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1592 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1593 | int UNUSED written = 0; | |
1594 | IADDR UNUSED pc = abuf->addr; | |
1595 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1596 | ||
1597 | { | |
1598 | SF opval = sh64_fldi0 (current_cpu); | |
1599 | SET_H_FRC (FLD (f_rn), opval); | |
c7e628df | 1600 | TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval); |
cbb38b47 BE |
1601 | } |
1602 | ||
1603 | return vpc; | |
1604 | #undef FLD | |
1605 | } | |
1606 | ||
1607 | /* fldi1-compact: fldi1 $frn */ | |
1608 | ||
1609 | static SEM_PC | |
1610 | SEM_FN_NAME (sh64_compact,fldi1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1611 | { | |
1612 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1613 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1614 | int UNUSED written = 0; | |
1615 | IADDR UNUSED pc = abuf->addr; | |
1616 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1617 | ||
1618 | { | |
1619 | SF opval = sh64_fldi1 (current_cpu); | |
1620 | SET_H_FRC (FLD (f_rn), opval); | |
c7e628df | 1621 | TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval); |
cbb38b47 BE |
1622 | } |
1623 | ||
1624 | return vpc; | |
1625 | #undef FLD | |
1626 | } | |
1627 | ||
1628 | /* float-compact: float fpul, $fsdn */ | |
1629 | ||
1630 | static SEM_PC | |
1631 | SEM_FN_NAME (sh64_compact,float_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1632 | { | |
1633 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1634 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1635 | int UNUSED written = 0; | |
1636 | IADDR UNUSED pc = abuf->addr; | |
1637 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1638 | ||
1639 | if (GET_H_PRBIT ()) { | |
1640 | { | |
1641 | DF opval = sh64_floatld (current_cpu, CPU (h_fr[((UINT) 32)])); | |
c7e628df DB |
1642 | SET_H_FSD (FLD (f_rn), opval); |
1643 | written |= (1 << 2); | |
1644 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1645 | } |
1646 | } else { | |
1647 | { | |
c7e628df DB |
1648 | DF opval = sh64_floatls (current_cpu, CPU (h_fr[((UINT) 32)])); |
1649 | SET_H_FSD (FLD (f_rn), opval); | |
1650 | written |= (1 << 2); | |
1651 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1652 | } |
1653 | } | |
1654 | ||
1655 | abuf->written = written; | |
1656 | return vpc; | |
1657 | #undef FLD | |
1658 | } | |
1659 | ||
1660 | /* fmac-compact: fmac fr0, $frm, $frn */ | |
1661 | ||
1662 | static SEM_PC | |
1663 | SEM_FN_NAME (sh64_compact,fmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1664 | { | |
c7e628df | 1665 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1666 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1667 | int UNUSED written = 0; | |
1668 | IADDR UNUSED pc = abuf->addr; | |
1669 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1670 | ||
1671 | { | |
1672 | SF opval = sh64_fmacs (current_cpu, GET_H_FRC (((UINT) 0)), GET_H_FRC (FLD (f_rm)), GET_H_FRC (FLD (f_rn))); | |
1673 | SET_H_FRC (FLD (f_rn), opval); | |
c7e628df | 1674 | TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval); |
cbb38b47 BE |
1675 | } |
1676 | ||
1677 | return vpc; | |
1678 | #undef FLD | |
1679 | } | |
1680 | ||
c7e628df | 1681 | /* fmov1-compact: fmov $fmovm, $fmovn */ |
cbb38b47 BE |
1682 | |
1683 | static SEM_PC | |
1684 | SEM_FN_NAME (sh64_compact,fmov1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1685 | { | |
c7e628df | 1686 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1687 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1688 | int UNUSED written = 0; | |
1689 | IADDR UNUSED pc = abuf->addr; | |
1690 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1691 | ||
cbb38b47 | 1692 | { |
c7e628df DB |
1693 | DF opval = GET_H_FMOV (FLD (f_rm)); |
1694 | SET_H_FMOV (FLD (f_rn), opval); | |
1695 | TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval); | |
cbb38b47 | 1696 | } |
cbb38b47 | 1697 | |
cbb38b47 BE |
1698 | return vpc; |
1699 | #undef FLD | |
1700 | } | |
1701 | ||
c7e628df | 1702 | /* fmov2-compact: fmov @$rm, $fmovn */ |
cbb38b47 BE |
1703 | |
1704 | static SEM_PC | |
1705 | SEM_FN_NAME (sh64_compact,fmov2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1706 | { | |
c7e628df | 1707 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1708 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1709 | int UNUSED written = 0; | |
1710 | IADDR UNUSED pc = abuf->addr; | |
1711 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1712 | ||
1713 | if (NOTBI (GET_H_SZBIT ())) { | |
1714 | { | |
c7e628df DB |
1715 | DF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); |
1716 | SET_H_FMOV (FLD (f_rn), opval); | |
1717 | written |= (1 << 4); | |
1718 | TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval); | |
cbb38b47 BE |
1719 | } |
1720 | } else { | |
1721 | { | |
1722 | DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
c7e628df DB |
1723 | SET_H_FMOV (FLD (f_rn), opval); |
1724 | written |= (1 << 4); | |
1725 | TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval); | |
cbb38b47 | 1726 | } |
cbb38b47 BE |
1727 | } |
1728 | ||
1729 | abuf->written = written; | |
1730 | return vpc; | |
1731 | #undef FLD | |
1732 | } | |
1733 | ||
c7e628df | 1734 | /* fmov3-compact: fmov @${rm}+, fmovn */ |
cbb38b47 BE |
1735 | |
1736 | static SEM_PC | |
1737 | SEM_FN_NAME (sh64_compact,fmov3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1738 | { | |
c7e628df | 1739 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1740 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1741 | int UNUSED written = 0; | |
1742 | IADDR UNUSED pc = abuf->addr; | |
1743 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1744 | ||
1745 | if (NOTBI (GET_H_SZBIT ())) { | |
1746 | { | |
1747 | { | |
c7e628df DB |
1748 | DF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); |
1749 | SET_H_FMOV (FLD (f_rn), opval); | |
1750 | written |= (1 << 4); | |
1751 | TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval); | |
cbb38b47 BE |
1752 | } |
1753 | { | |
1754 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4); | |
1755 | SET_H_GRC (FLD (f_rm), opval); | |
c7e628df DB |
1756 | written |= (1 << 5); |
1757 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
1758 | } |
1759 | } | |
1760 | } else { | |
1761 | { | |
cbb38b47 BE |
1762 | { |
1763 | DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
c7e628df DB |
1764 | SET_H_FMOV (FLD (f_rn), opval); |
1765 | written |= (1 << 4); | |
1766 | TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval); | |
cbb38b47 | 1767 | } |
cbb38b47 BE |
1768 | { |
1769 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 8); | |
1770 | SET_H_GRC (FLD (f_rm), opval); | |
c7e628df DB |
1771 | written |= (1 << 5); |
1772 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
1773 | } |
1774 | } | |
1775 | } | |
1776 | ||
1777 | abuf->written = written; | |
1778 | return vpc; | |
1779 | #undef FLD | |
1780 | } | |
1781 | ||
c7e628df | 1782 | /* fmov4-compact: fmov @(r0, $rm), $fmovn */ |
cbb38b47 BE |
1783 | |
1784 | static SEM_PC | |
1785 | SEM_FN_NAME (sh64_compact,fmov4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1786 | { | |
c7e628df | 1787 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1788 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1789 | int UNUSED written = 0; | |
1790 | IADDR UNUSED pc = abuf->addr; | |
1791 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1792 | ||
1793 | if (NOTBI (GET_H_SZBIT ())) { | |
1794 | { | |
c7e628df DB |
1795 | DF opval = GETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))); |
1796 | SET_H_FMOV (FLD (f_rn), opval); | |
1797 | written |= (1 << 5); | |
1798 | TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval); | |
cbb38b47 BE |
1799 | } |
1800 | } else { | |
1801 | { | |
1802 | DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))); | |
c7e628df DB |
1803 | SET_H_FMOV (FLD (f_rn), opval); |
1804 | written |= (1 << 5); | |
1805 | TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval); | |
cbb38b47 | 1806 | } |
cbb38b47 BE |
1807 | } |
1808 | ||
1809 | abuf->written = written; | |
1810 | return vpc; | |
1811 | #undef FLD | |
1812 | } | |
1813 | ||
c7e628df | 1814 | /* fmov5-compact: fmov $fmovm, @$rn */ |
cbb38b47 BE |
1815 | |
1816 | static SEM_PC | |
1817 | SEM_FN_NAME (sh64_compact,fmov5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1818 | { | |
c7e628df | 1819 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1820 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1821 | int UNUSED written = 0; | |
1822 | IADDR UNUSED pc = abuf->addr; | |
1823 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1824 | ||
1825 | if (NOTBI (GET_H_SZBIT ())) { | |
1826 | { | |
c7e628df | 1827 | SF opval = GET_H_FMOV (FLD (f_rm)); |
cbb38b47 | 1828 | SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); |
c7e628df | 1829 | written |= (1 << 4); |
cbb38b47 BE |
1830 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); |
1831 | } | |
1832 | } else { | |
1833 | { | |
c7e628df | 1834 | DF opval = GET_H_FMOV (FLD (f_rm)); |
cbb38b47 | 1835 | SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); |
c7e628df | 1836 | written |= (1 << 3); |
cbb38b47 BE |
1837 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); |
1838 | } | |
cbb38b47 BE |
1839 | } |
1840 | ||
1841 | abuf->written = written; | |
1842 | return vpc; | |
1843 | #undef FLD | |
1844 | } | |
1845 | ||
c7e628df | 1846 | /* fmov6-compact: fmov $fmovm, @-$rn */ |
cbb38b47 BE |
1847 | |
1848 | static SEM_PC | |
1849 | SEM_FN_NAME (sh64_compact,fmov6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1850 | { | |
c7e628df | 1851 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1852 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1853 | int UNUSED written = 0; | |
1854 | IADDR UNUSED pc = abuf->addr; | |
1855 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1856 | ||
1857 | if (NOTBI (GET_H_SZBIT ())) { | |
1858 | { | |
1859 | { | |
1860 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
1861 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
1862 | written |= (1 << 5); |
1863 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
1864 | } |
1865 | { | |
c7e628df | 1866 | SF opval = GET_H_FMOV (FLD (f_rm)); |
cbb38b47 | 1867 | SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); |
c7e628df | 1868 | written |= (1 << 4); |
cbb38b47 BE |
1869 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); |
1870 | } | |
1871 | } | |
1872 | } else { | |
1873 | { | |
1874 | { | |
1875 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 8); | |
1876 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
1877 | written |= (1 << 5); |
1878 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 | 1879 | } |
cbb38b47 | 1880 | { |
c7e628df | 1881 | DF opval = GET_H_FMOV (FLD (f_rm)); |
cbb38b47 | 1882 | SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); |
c7e628df | 1883 | written |= (1 << 3); |
cbb38b47 BE |
1884 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); |
1885 | } | |
1886 | } | |
cbb38b47 BE |
1887 | } |
1888 | ||
1889 | abuf->written = written; | |
1890 | return vpc; | |
1891 | #undef FLD | |
1892 | } | |
1893 | ||
c7e628df | 1894 | /* fmov7-compact: fmov $fmovm, @(r0, $rn) */ |
cbb38b47 BE |
1895 | |
1896 | static SEM_PC | |
1897 | SEM_FN_NAME (sh64_compact,fmov7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1898 | { | |
c7e628df | 1899 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1900 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1901 | int UNUSED written = 0; | |
1902 | IADDR UNUSED pc = abuf->addr; | |
1903 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1904 | ||
1905 | if (NOTBI (GET_H_SZBIT ())) { | |
1906 | { | |
c7e628df | 1907 | SF opval = GET_H_FMOV (FLD (f_rm)); |
cbb38b47 | 1908 | SETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); |
c7e628df | 1909 | written |= (1 << 5); |
cbb38b47 BE |
1910 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); |
1911 | } | |
1912 | } else { | |
cbb38b47 | 1913 | { |
c7e628df | 1914 | DF opval = GET_H_FMOV (FLD (f_rm)); |
cbb38b47 | 1915 | SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); |
c7e628df | 1916 | written |= (1 << 4); |
cbb38b47 BE |
1917 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); |
1918 | } | |
c7e628df DB |
1919 | } |
1920 | ||
1921 | abuf->written = written; | |
1922 | return vpc; | |
1923 | #undef FLD | |
1924 | } | |
1925 | ||
1926 | /* fmov8-compact: fmov.d @($imm12x8, $rm), $drn */ | |
1927 | ||
1928 | static SEM_PC | |
1929 | SEM_FN_NAME (sh64_compact,fmov8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1930 | { | |
1931 | #define FLD(f) abuf->fields.sfmt_fmov8_compact.f | |
1932 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1933 | int UNUSED written = 0; | |
1934 | IADDR UNUSED pc = abuf->addr; | |
1935 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1936 | ||
cbb38b47 | 1937 | { |
c7e628df DB |
1938 | DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm12x8))); |
1939 | SET_H_DRC (FLD (f_dn), opval); | |
1940 | TRACE_RESULT (current_cpu, abuf, "drc", 'f', opval); | |
cbb38b47 | 1941 | } |
c7e628df DB |
1942 | |
1943 | return vpc; | |
1944 | #undef FLD | |
cbb38b47 BE |
1945 | } |
1946 | ||
c7e628df DB |
1947 | /* fmov9-compact: mov.l $drm, @($imm12x8, $rn) */ |
1948 | ||
1949 | static SEM_PC | |
1950 | SEM_FN_NAME (sh64_compact,fmov9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1951 | { | |
1952 | #define FLD(f) abuf->fields.sfmt_fmov9_compact.f | |
1953 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1954 | int UNUSED written = 0; | |
1955 | IADDR UNUSED pc = abuf->addr; | |
1956 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1957 | ||
1958 | { | |
1959 | DF opval = GET_H_DRC (FLD (f_dm)); | |
1960 | SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm12x8)), opval); | |
1961 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1962 | } | |
1963 | ||
cbb38b47 BE |
1964 | return vpc; |
1965 | #undef FLD | |
1966 | } | |
1967 | ||
1968 | /* fmul-compact: fmul $fsdm, $fsdn */ | |
1969 | ||
1970 | static SEM_PC | |
1971 | SEM_FN_NAME (sh64_compact,fmul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1972 | { | |
c7e628df | 1973 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
1974 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1975 | int UNUSED written = 0; | |
1976 | IADDR UNUSED pc = abuf->addr; | |
1977 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1978 | ||
1979 | if (GET_H_PRBIT ()) { | |
1980 | { | |
c7e628df DB |
1981 | DF opval = sh64_fmuld (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn))); |
1982 | SET_H_FSD (FLD (f_rn), opval); | |
1983 | written |= (1 << 3); | |
1984 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1985 | } |
1986 | } else { | |
1987 | { | |
c7e628df DB |
1988 | DF opval = sh64_fmuls (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn))); |
1989 | SET_H_FSD (FLD (f_rn), opval); | |
1990 | written |= (1 << 3); | |
1991 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
1992 | } |
1993 | } | |
1994 | ||
1995 | abuf->written = written; | |
1996 | return vpc; | |
1997 | #undef FLD | |
1998 | } | |
1999 | ||
2000 | /* fneg-compact: fneg $fsdn */ | |
2001 | ||
2002 | static SEM_PC | |
2003 | SEM_FN_NAME (sh64_compact,fneg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2004 | { | |
2005 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2006 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2007 | int UNUSED written = 0; | |
2008 | IADDR UNUSED pc = abuf->addr; | |
2009 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2010 | ||
2011 | if (GET_H_PRBIT ()) { | |
2012 | { | |
c7e628df DB |
2013 | DF opval = sh64_fnegd (current_cpu, GET_H_FSD (FLD (f_rn))); |
2014 | SET_H_FSD (FLD (f_rn), opval); | |
2015 | written |= (1 << 2); | |
2016 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
2017 | } |
2018 | } else { | |
2019 | { | |
c7e628df DB |
2020 | DF opval = sh64_fnegs (current_cpu, GET_H_FSD (FLD (f_rn))); |
2021 | SET_H_FSD (FLD (f_rn), opval); | |
2022 | written |= (1 << 2); | |
2023 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
2024 | } |
2025 | } | |
2026 | ||
2027 | abuf->written = written; | |
2028 | return vpc; | |
2029 | #undef FLD | |
2030 | } | |
2031 | ||
2032 | /* frchg-compact: frchg */ | |
2033 | ||
2034 | static SEM_PC | |
2035 | SEM_FN_NAME (sh64_compact,frchg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2036 | { | |
2310652a | 2037 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
2038 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2039 | int UNUSED written = 0; | |
2040 | IADDR UNUSED pc = abuf->addr; | |
2041 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2042 | ||
2043 | { | |
2044 | BI opval = NOTBI (GET_H_FRBIT ()); | |
2045 | SET_H_FRBIT (opval); | |
2046 | TRACE_RESULT (current_cpu, abuf, "frbit", 'x', opval); | |
2047 | } | |
2048 | ||
2049 | return vpc; | |
2050 | #undef FLD | |
2051 | } | |
2052 | ||
2053 | /* fschg-compact: fschg */ | |
2054 | ||
2055 | static SEM_PC | |
2056 | SEM_FN_NAME (sh64_compact,fschg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2057 | { | |
2310652a | 2058 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
2059 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2060 | int UNUSED written = 0; | |
2061 | IADDR UNUSED pc = abuf->addr; | |
2062 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2063 | ||
2064 | { | |
2065 | BI opval = NOTBI (GET_H_SZBIT ()); | |
2066 | SET_H_SZBIT (opval); | |
2067 | TRACE_RESULT (current_cpu, abuf, "szbit", 'x', opval); | |
2068 | } | |
2069 | ||
2070 | return vpc; | |
2071 | #undef FLD | |
2072 | } | |
2073 | ||
2074 | /* fsqrt-compact: fsqrt $fsdn */ | |
2075 | ||
2076 | static SEM_PC | |
2077 | SEM_FN_NAME (sh64_compact,fsqrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2078 | { | |
2079 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2080 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2081 | int UNUSED written = 0; | |
2082 | IADDR UNUSED pc = abuf->addr; | |
2083 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2084 | ||
2085 | if (GET_H_PRBIT ()) { | |
2086 | { | |
c7e628df DB |
2087 | DF opval = sh64_fsqrtd (current_cpu, GET_H_FSD (FLD (f_rn))); |
2088 | SET_H_FSD (FLD (f_rn), opval); | |
2089 | written |= (1 << 2); | |
2090 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
2091 | } |
2092 | } else { | |
2093 | { | |
c7e628df DB |
2094 | DF opval = sh64_fsqrts (current_cpu, GET_H_FSD (FLD (f_rn))); |
2095 | SET_H_FSD (FLD (f_rn), opval); | |
2096 | written |= (1 << 2); | |
2097 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
2098 | } |
2099 | } | |
2100 | ||
2101 | abuf->written = written; | |
2102 | return vpc; | |
2103 | #undef FLD | |
2104 | } | |
2105 | ||
2106 | /* fsts-compact: fsts fpul, $frn */ | |
2107 | ||
2108 | static SEM_PC | |
2109 | SEM_FN_NAME (sh64_compact,fsts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2110 | { | |
2111 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2112 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2113 | int UNUSED written = 0; | |
2114 | IADDR UNUSED pc = abuf->addr; | |
2115 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2116 | ||
2117 | { | |
2118 | SF opval = CPU (h_fr[((UINT) 32)]); | |
2119 | SET_H_FRC (FLD (f_rn), opval); | |
c7e628df | 2120 | TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval); |
cbb38b47 BE |
2121 | } |
2122 | ||
2123 | return vpc; | |
2124 | #undef FLD | |
2125 | } | |
2126 | ||
2127 | /* fsub-compact: fsub $fsdm, $fsdn */ | |
2128 | ||
2129 | static SEM_PC | |
2130 | SEM_FN_NAME (sh64_compact,fsub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2131 | { | |
c7e628df | 2132 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
2133 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2134 | int UNUSED written = 0; | |
2135 | IADDR UNUSED pc = abuf->addr; | |
2136 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2137 | ||
2138 | if (GET_H_PRBIT ()) { | |
2139 | { | |
c7e628df DB |
2140 | DF opval = sh64_fsubd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm))); |
2141 | SET_H_FSD (FLD (f_rn), opval); | |
2142 | written |= (1 << 3); | |
2143 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
2144 | } |
2145 | } else { | |
2146 | { | |
c7e628df DB |
2147 | DF opval = sh64_fsubs (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm))); |
2148 | SET_H_FSD (FLD (f_rn), opval); | |
2149 | written |= (1 << 3); | |
2150 | TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval); | |
cbb38b47 BE |
2151 | } |
2152 | } | |
2153 | ||
2154 | abuf->written = written; | |
2155 | return vpc; | |
2156 | #undef FLD | |
2157 | } | |
2158 | ||
2159 | /* ftrc-compact: ftrc $fsdn, fpul */ | |
2160 | ||
2161 | static SEM_PC | |
2162 | SEM_FN_NAME (sh64_compact,ftrc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2163 | { | |
2164 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2165 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2166 | int UNUSED written = 0; | |
2167 | IADDR UNUSED pc = abuf->addr; | |
2168 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2169 | ||
2170 | { | |
c7e628df | 2171 | SF opval = ((GET_H_PRBIT ()) ? (sh64_ftrcdl (current_cpu, GET_H_FSD (FLD (f_rn)))) : (sh64_ftrcsl (current_cpu, GET_H_FSD (FLD (f_rn))))); |
cbb38b47 | 2172 | CPU (h_fr[((UINT) 32)]) = opval; |
c7e628df | 2173 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
2174 | } |
2175 | ||
2176 | return vpc; | |
2177 | #undef FLD | |
2178 | } | |
2179 | ||
2180 | /* ftrv-compact: ftrv xmtrx, $fvn */ | |
2181 | ||
2182 | static SEM_PC | |
2183 | SEM_FN_NAME (sh64_compact,ftrv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2184 | { | |
2185 | #define FLD(f) abuf->fields.sfmt_fipr_compact.f | |
2186 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2187 | int UNUSED written = 0; | |
2188 | IADDR UNUSED pc = abuf->addr; | |
2189 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2190 | ||
c7e628df | 2191 | sh64_ftrv (current_cpu, FLD (f_vn)); |
cbb38b47 BE |
2192 | |
2193 | return vpc; | |
2194 | #undef FLD | |
2195 | } | |
2196 | ||
2197 | /* jmp-compact: jmp @$rn */ | |
2198 | ||
2199 | static SEM_PC | |
2200 | SEM_FN_NAME (sh64_compact,jmp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2201 | { | |
2202 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2203 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2204 | int UNUSED written = 0; | |
2205 | IADDR UNUSED pc = abuf->addr; | |
2206 | SEM_BRANCH_INIT | |
2207 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2208 | ||
c7e628df DB |
2209 | { |
2210 | { | |
2211 | UDI opval = ADDDI (pc, 2); | |
2212 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
2213 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
2214 | } | |
2215 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
2216 | { |
2217 | { | |
2218 | UDI opval = GET_H_GRC (FLD (f_rn)); | |
2219 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
2220 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
2221 | } | |
c7e628df DB |
2222 | } |
2223 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
2224 | } |
2225 | ||
2226 | SEM_BRANCH_FINI (vpc); | |
2227 | return vpc; | |
2228 | #undef FLD | |
2229 | } | |
2230 | ||
2231 | /* jsr-compact: jsr @$rn */ | |
2232 | ||
2233 | static SEM_PC | |
2234 | SEM_FN_NAME (sh64_compact,jsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2235 | { | |
2236 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2237 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2238 | int UNUSED written = 0; | |
2239 | IADDR UNUSED pc = abuf->addr; | |
2240 | SEM_BRANCH_INIT | |
2241 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2242 | ||
2243 | { | |
2244 | { | |
2245 | { | |
2246 | SI opval = ADDDI (pc, 4); | |
2247 | SET_H_PR (opval); | |
2248 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
2249 | } | |
c7e628df DB |
2250 | } |
2251 | { | |
2252 | UDI opval = ADDDI (pc, 2); | |
2253 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
2254 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
2255 | } | |
2256 | ((void) 0); /*nop*/ | |
2257 | { | |
2258 | { | |
2259 | UDI opval = GET_H_GRC (FLD (f_rn)); | |
2260 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
2261 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
2262 | } | |
2263 | } | |
2264 | ((void) 0); /*nop*/ | |
2265 | } | |
2266 | ||
2267 | SEM_BRANCH_FINI (vpc); | |
2268 | return vpc; | |
2269 | #undef FLD | |
2270 | } | |
2271 | ||
2272 | /* ldc-gbr-compact: ldc $rn, gbr */ | |
2273 | ||
2274 | static SEM_PC | |
2275 | SEM_FN_NAME (sh64_compact,ldc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2276 | { | |
2277 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2278 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2279 | int UNUSED written = 0; | |
2280 | IADDR UNUSED pc = abuf->addr; | |
2281 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2282 | ||
2283 | { | |
2284 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2285 | SET_H_GBR (opval); | |
2286 | TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval); | |
2287 | } | |
2288 | ||
2289 | return vpc; | |
2290 | #undef FLD | |
2291 | } | |
2292 | ||
2293 | /* ldc-vbr-compact: ldc $rn, vbr */ | |
2294 | ||
2295 | static SEM_PC | |
2296 | SEM_FN_NAME (sh64_compact,ldc_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2297 | { | |
2298 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2299 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2300 | int UNUSED written = 0; | |
2301 | IADDR UNUSED pc = abuf->addr; | |
2302 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2303 | ||
2304 | { | |
2305 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2306 | SET_H_VBR (opval); | |
2307 | TRACE_RESULT (current_cpu, abuf, "vbr", 'x', opval); | |
2308 | } | |
2309 | ||
2310 | return vpc; | |
2311 | #undef FLD | |
2312 | } | |
2313 | ||
2314 | /* ldc-sr-compact: ldc $rn, sr */ | |
2315 | ||
2316 | static SEM_PC | |
2317 | SEM_FN_NAME (sh64_compact,ldc_sr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2318 | { | |
2319 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2320 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2321 | int UNUSED written = 0; | |
2322 | IADDR UNUSED pc = abuf->addr; | |
2323 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2324 | ||
cbb38b47 | 2325 | { |
c7e628df DB |
2326 | SI opval = GET_H_GRC (FLD (f_rn)); |
2327 | CPU (h_sr) = opval; | |
2328 | TRACE_RESULT (current_cpu, abuf, "sr", 'x', opval); | |
cbb38b47 | 2329 | } |
cbb38b47 | 2330 | |
cbb38b47 BE |
2331 | return vpc; |
2332 | #undef FLD | |
2333 | } | |
2334 | ||
c7e628df | 2335 | /* ldcl-gbr-compact: ldc.l @${rn}+, gbr */ |
cbb38b47 BE |
2336 | |
2337 | static SEM_PC | |
c7e628df | 2338 | SEM_FN_NAME (sh64_compact,ldcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
cbb38b47 BE |
2339 | { |
2340 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2341 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2342 | int UNUSED written = 0; | |
2343 | IADDR UNUSED pc = abuf->addr; | |
2344 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2345 | ||
c7e628df | 2346 | { |
cbb38b47 | 2347 | { |
c7e628df | 2348 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); |
cbb38b47 BE |
2349 | SET_H_GBR (opval); |
2350 | TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval); | |
2351 | } | |
c7e628df DB |
2352 | { |
2353 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2354 | SET_H_GRC (FLD (f_rn), opval); | |
2355 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
2356 | } | |
2357 | } | |
cbb38b47 BE |
2358 | |
2359 | return vpc; | |
2360 | #undef FLD | |
2361 | } | |
2362 | ||
c7e628df | 2363 | /* ldcl-vbr-compact: ldc.l @${rn}+, vbr */ |
cbb38b47 BE |
2364 | |
2365 | static SEM_PC | |
c7e628df | 2366 | SEM_FN_NAME (sh64_compact,ldcl_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
cbb38b47 BE |
2367 | { |
2368 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2369 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2370 | int UNUSED written = 0; | |
2371 | IADDR UNUSED pc = abuf->addr; | |
2372 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2373 | ||
2374 | { | |
2375 | { | |
2376 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
c7e628df DB |
2377 | SET_H_VBR (opval); |
2378 | TRACE_RESULT (current_cpu, abuf, "vbr", 'x', opval); | |
cbb38b47 BE |
2379 | } |
2380 | { | |
2381 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2382 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2383 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2384 | } |
2385 | } | |
2386 | ||
2387 | return vpc; | |
2388 | #undef FLD | |
2389 | } | |
2390 | ||
2391 | /* lds-fpscr-compact: lds $rn, fpscr */ | |
2392 | ||
2393 | static SEM_PC | |
2394 | SEM_FN_NAME (sh64_compact,lds_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2395 | { | |
2396 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2397 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2398 | int UNUSED written = 0; | |
2399 | IADDR UNUSED pc = abuf->addr; | |
2400 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2401 | ||
2402 | { | |
2403 | SI opval = GET_H_GRC (FLD (f_rn)); | |
c7e628df | 2404 | CPU (h_fpscr) = opval; |
cbb38b47 BE |
2405 | TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval); |
2406 | } | |
2407 | ||
2408 | return vpc; | |
2409 | #undef FLD | |
2410 | } | |
2411 | ||
2412 | /* ldsl-fpscr-compact: lds.l @${rn}+, fpscr */ | |
2413 | ||
2414 | static SEM_PC | |
2415 | SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2416 | { | |
2417 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2418 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2419 | int UNUSED written = 0; | |
2420 | IADDR UNUSED pc = abuf->addr; | |
2421 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2422 | ||
2423 | { | |
2424 | { | |
2425 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
c7e628df | 2426 | CPU (h_fpscr) = opval; |
cbb38b47 BE |
2427 | TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval); |
2428 | } | |
2429 | { | |
2430 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2431 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2432 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2433 | } |
2434 | } | |
2435 | ||
2436 | return vpc; | |
2437 | #undef FLD | |
2438 | } | |
2439 | ||
2440 | /* lds-fpul-compact: lds $rn, fpul */ | |
2441 | ||
2442 | static SEM_PC | |
2443 | SEM_FN_NAME (sh64_compact,lds_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2444 | { | |
2445 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2446 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2447 | int UNUSED written = 0; | |
2448 | IADDR UNUSED pc = abuf->addr; | |
2449 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2450 | ||
2451 | { | |
2452 | SF opval = SUBWORDSISF (GET_H_GRC (FLD (f_rn))); | |
2453 | CPU (h_fr[((UINT) 32)]) = opval; | |
c7e628df | 2454 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
2455 | } |
2456 | ||
2457 | return vpc; | |
2458 | #undef FLD | |
2459 | } | |
2460 | ||
2461 | /* ldsl-fpul-compact: lds.l @${rn}+, fpul */ | |
2462 | ||
2463 | static SEM_PC | |
2464 | SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2465 | { | |
2466 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2467 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2468 | int UNUSED written = 0; | |
2469 | IADDR UNUSED pc = abuf->addr; | |
2470 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2471 | ||
2472 | { | |
2473 | { | |
2474 | SF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2475 | CPU (h_fr[((UINT) 32)]) = opval; | |
c7e628df | 2476 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
2477 | } |
2478 | { | |
2479 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2480 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2481 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2482 | } |
2483 | } | |
2484 | ||
2485 | return vpc; | |
2486 | #undef FLD | |
2487 | } | |
2488 | ||
2489 | /* lds-mach-compact: lds $rn, mach */ | |
2490 | ||
2491 | static SEM_PC | |
2492 | SEM_FN_NAME (sh64_compact,lds_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2493 | { | |
2494 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2495 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2496 | int UNUSED written = 0; | |
2497 | IADDR UNUSED pc = abuf->addr; | |
2498 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2499 | ||
2500 | { | |
2501 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2502 | SET_H_MACH (opval); | |
2503 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2504 | } | |
2505 | ||
2506 | return vpc; | |
2507 | #undef FLD | |
2508 | } | |
2509 | ||
2510 | /* ldsl-mach-compact: lds.l @${rn}+, mach */ | |
2511 | ||
2512 | static SEM_PC | |
2513 | SEM_FN_NAME (sh64_compact,ldsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2514 | { | |
2515 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2516 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2517 | int UNUSED written = 0; | |
2518 | IADDR UNUSED pc = abuf->addr; | |
2519 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2520 | ||
2521 | { | |
2522 | { | |
2523 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2524 | SET_H_MACH (opval); | |
2525 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2526 | } | |
2527 | { | |
2528 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2529 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2530 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2531 | } |
2532 | } | |
2533 | ||
2534 | return vpc; | |
2535 | #undef FLD | |
2536 | } | |
2537 | ||
2538 | /* lds-macl-compact: lds $rn, macl */ | |
2539 | ||
2540 | static SEM_PC | |
2541 | SEM_FN_NAME (sh64_compact,lds_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2542 | { | |
2543 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2544 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2545 | int UNUSED written = 0; | |
2546 | IADDR UNUSED pc = abuf->addr; | |
2547 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2548 | ||
2549 | { | |
2550 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2551 | SET_H_MACL (opval); | |
2552 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2553 | } | |
2554 | ||
2555 | return vpc; | |
2556 | #undef FLD | |
2557 | } | |
2558 | ||
2559 | /* ldsl-macl-compact: lds.l @${rn}+, macl */ | |
2560 | ||
2561 | static SEM_PC | |
2562 | SEM_FN_NAME (sh64_compact,ldsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2563 | { | |
2564 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2565 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2566 | int UNUSED written = 0; | |
2567 | IADDR UNUSED pc = abuf->addr; | |
2568 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2569 | ||
2570 | { | |
2571 | { | |
2572 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2573 | SET_H_MACL (opval); | |
2574 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2575 | } | |
2576 | { | |
2577 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2578 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2579 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2580 | } |
2581 | } | |
2582 | ||
2583 | return vpc; | |
2584 | #undef FLD | |
2585 | } | |
2586 | ||
2587 | /* lds-pr-compact: lds $rn, pr */ | |
2588 | ||
2589 | static SEM_PC | |
2590 | SEM_FN_NAME (sh64_compact,lds_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2591 | { | |
2592 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2593 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2594 | int UNUSED written = 0; | |
2595 | IADDR UNUSED pc = abuf->addr; | |
2596 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2597 | ||
2598 | { | |
2599 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2600 | SET_H_PR (opval); | |
2601 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
2602 | } | |
2603 | ||
2604 | return vpc; | |
2605 | #undef FLD | |
2606 | } | |
2607 | ||
2608 | /* ldsl-pr-compact: lds.l @${rn}+, pr */ | |
2609 | ||
2610 | static SEM_PC | |
2611 | SEM_FN_NAME (sh64_compact,ldsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2612 | { | |
2613 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2614 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2615 | int UNUSED written = 0; | |
2616 | IADDR UNUSED pc = abuf->addr; | |
2617 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2618 | ||
2619 | { | |
2620 | { | |
2621 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2622 | SET_H_PR (opval); | |
2623 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
2624 | } | |
2625 | { | |
2626 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2627 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2628 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2629 | } |
2630 | } | |
2631 | ||
2632 | return vpc; | |
2633 | #undef FLD | |
2634 | } | |
2635 | ||
2636 | /* macl-compact: mac.l @${rm}+, @${rn}+ */ | |
2637 | ||
2638 | static SEM_PC | |
2639 | SEM_FN_NAME (sh64_compact,macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2640 | { | |
c7e628df | 2641 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
2642 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2643 | int UNUSED written = 0; | |
2644 | IADDR UNUSED pc = abuf->addr; | |
2645 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2646 | ||
2647 | { | |
2648 | DI tmp_tmpry; | |
2649 | DI tmp_mac; | |
2650 | DI tmp_result; | |
2651 | SI tmp_x; | |
2652 | SI tmp_y; | |
2653 | tmp_x = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2654 | { | |
2655 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2656 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2657 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2658 | } |
2659 | if (EQSI (FLD (f_rn), FLD (f_rm))) { | |
2660 | { | |
2661 | { | |
2662 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2663 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2664 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2665 | } |
2666 | { | |
2667 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4); | |
2668 | SET_H_GRC (FLD (f_rm), opval); | |
2669 | written |= (1 << 11); | |
c7e628df | 2670 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2671 | } |
2672 | } | |
2673 | } | |
2674 | tmp_y = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
2675 | { | |
2676 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4); | |
2677 | SET_H_GRC (FLD (f_rm), opval); | |
2678 | written |= (1 << 11); | |
c7e628df | 2679 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2680 | } |
2681 | tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y)); | |
2682 | tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ())); | |
2683 | tmp_result = ADDDI (tmp_mac, tmp_tmpry); | |
2684 | { | |
2685 | if (GET_H_SBIT ()) { | |
2686 | { | |
2687 | SI tmp_min; | |
2688 | SI tmp_max; | |
2689 | tmp_max = SRLDI (INVDI (0), 16); | |
2690 | tmp_min = SRLDI (INVDI (0), 15); | |
2691 | if (GTDI (tmp_result, tmp_max)) { | |
2692 | tmp_result = tmp_max; | |
2693 | } else { | |
2694 | if (LTDI (tmp_result, tmp_min)) { | |
2695 | tmp_result = tmp_min; | |
2696 | } | |
2697 | } | |
2698 | } | |
2699 | } | |
2700 | { | |
2701 | SI opval = SUBWORDDISI (tmp_result, 0); | |
2702 | SET_H_MACH (opval); | |
2703 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2704 | } | |
2705 | { | |
2706 | SI opval = SUBWORDDISI (tmp_result, 1); | |
2707 | SET_H_MACL (opval); | |
2708 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2709 | } | |
2710 | } | |
2711 | } | |
2712 | ||
2713 | abuf->written = written; | |
2714 | return vpc; | |
2715 | #undef FLD | |
2716 | } | |
2717 | ||
2718 | /* macw-compact: mac.w @${rm}+, @${rn}+ */ | |
2719 | ||
2720 | static SEM_PC | |
2721 | SEM_FN_NAME (sh64_compact,macw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2722 | { | |
c7e628df | 2723 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
2724 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2725 | int UNUSED written = 0; | |
2726 | IADDR UNUSED pc = abuf->addr; | |
2727 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2728 | ||
2729 | { | |
2730 | SI tmp_tmpry; | |
2731 | DI tmp_mac; | |
2732 | DI tmp_result; | |
2733 | HI tmp_x; | |
2734 | HI tmp_y; | |
2735 | tmp_x = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2736 | { | |
2737 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2); | |
2738 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2739 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2740 | } |
2741 | if (EQSI (FLD (f_rn), FLD (f_rm))) { | |
2742 | { | |
2743 | { | |
2744 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2); | |
2745 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2746 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2747 | } |
2748 | { | |
2749 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2); | |
2750 | SET_H_GRC (FLD (f_rm), opval); | |
2751 | written |= (1 << 11); | |
c7e628df | 2752 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2753 | } |
2754 | } | |
2755 | } | |
2756 | tmp_y = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
2757 | { | |
2758 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2); | |
2759 | SET_H_GRC (FLD (f_rm), opval); | |
2760 | written |= (1 << 11); | |
c7e628df | 2761 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2762 | } |
2763 | tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y)); | |
2764 | if (GET_H_SBIT ()) { | |
2765 | { | |
2766 | if (ADDOFSI (tmp_tmpry, GET_H_MACL (), 0)) { | |
2767 | { | |
2768 | SI opval = 1; | |
2769 | SET_H_MACH (opval); | |
2770 | written |= (1 << 9); | |
2771 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2772 | } | |
2773 | } | |
2774 | { | |
2775 | SI opval = ADDSI (tmp_tmpry, GET_H_MACL ()); | |
2776 | SET_H_MACL (opval); | |
2777 | written |= (1 << 10); | |
2778 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2779 | } | |
2780 | } | |
2781 | } else { | |
2782 | { | |
2783 | tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ())); | |
2784 | tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry)); | |
2785 | { | |
2786 | SI opval = SUBWORDDISI (tmp_result, 0); | |
2787 | SET_H_MACH (opval); | |
2788 | written |= (1 << 9); | |
2789 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2790 | } | |
2791 | { | |
2792 | SI opval = SUBWORDDISI (tmp_result, 1); | |
2793 | SET_H_MACL (opval); | |
2794 | written |= (1 << 10); | |
2795 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2796 | } | |
2797 | } | |
2798 | } | |
2799 | } | |
2800 | ||
2801 | abuf->written = written; | |
2802 | return vpc; | |
2803 | #undef FLD | |
2804 | } | |
2805 | ||
2806 | /* mov-compact: mov $rm64, $rn64 */ | |
2807 | ||
2808 | static SEM_PC | |
2809 | SEM_FN_NAME (sh64_compact,mov_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2810 | { | |
c7e628df | 2811 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
2812 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2813 | int UNUSED written = 0; | |
2814 | IADDR UNUSED pc = abuf->addr; | |
2815 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2816 | ||
2817 | { | |
2818 | DI opval = GET_H_GR (FLD (f_rm)); | |
2819 | SET_H_GR (FLD (f_rn), opval); | |
c7e628df | 2820 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2821 | } |
2822 | ||
2823 | return vpc; | |
2824 | #undef FLD | |
2825 | } | |
2826 | ||
2827 | /* movi-compact: mov #$imm8, $rn */ | |
2828 | ||
2829 | static SEM_PC | |
2830 | SEM_FN_NAME (sh64_compact,movi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2831 | { | |
2832 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
2833 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2834 | int UNUSED written = 0; | |
2835 | IADDR UNUSED pc = abuf->addr; | |
2836 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2837 | ||
2838 | { | |
2839 | SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255)); | |
2840 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
2841 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
2842 | } | |
2843 | ||
2844 | return vpc; | |
2845 | #undef FLD | |
2846 | } | |
2847 | ||
2848 | /* movi20-compact: movi20 #$imm20, $rn */ | |
2849 | ||
2850 | static SEM_PC | |
2851 | SEM_FN_NAME (sh64_compact,movi20_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2852 | { | |
2853 | #define FLD(f) abuf->fields.sfmt_movi20_compact.f | |
2854 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2855 | int UNUSED written = 0; | |
2856 | IADDR UNUSED pc = abuf->addr; | |
2857 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2858 | ||
2859 | { | |
2860 | SI opval = FLD (f_imm20); | |
2861 | SET_H_GRC (FLD (f_rn), opval); | |
2862 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
2863 | } |
2864 | ||
2865 | return vpc; | |
2866 | #undef FLD | |
2867 | } | |
2868 | ||
2869 | /* movb1-compact: mov.b $rm, @$rn */ | |
2870 | ||
2871 | static SEM_PC | |
2872 | SEM_FN_NAME (sh64_compact,movb1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2873 | { | |
c7e628df | 2874 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
2875 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2876 | int UNUSED written = 0; | |
2877 | IADDR UNUSED pc = abuf->addr; | |
2878 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2879 | ||
2880 | { | |
2881 | UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3); | |
2882 | SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
2883 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2884 | } | |
2885 | ||
2886 | return vpc; | |
2887 | #undef FLD | |
2888 | } | |
2889 | ||
2890 | /* movb2-compact: mov.b $rm, @-$rn */ | |
2891 | ||
2892 | static SEM_PC | |
2893 | SEM_FN_NAME (sh64_compact,movb2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2894 | { | |
c7e628df | 2895 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
2896 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2897 | int UNUSED written = 0; | |
2898 | IADDR UNUSED pc = abuf->addr; | |
2899 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2900 | ||
2901 | { | |
2902 | DI tmp_addr; | |
2903 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 1); | |
2904 | { | |
2905 | UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3); | |
2906 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
2907 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2908 | } | |
2909 | { | |
2910 | SI opval = tmp_addr; | |
2911 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 2912 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
2913 | } |
2914 | } | |
2915 | ||
2916 | return vpc; | |
2917 | #undef FLD | |
2918 | } | |
2919 | ||
2920 | /* movb3-compact: mov.b $rm, @(r0,$rn) */ | |
2921 | ||
2922 | static SEM_PC | |
2923 | SEM_FN_NAME (sh64_compact,movb3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2924 | { | |
c7e628df | 2925 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
2926 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2927 | int UNUSED written = 0; | |
2928 | IADDR UNUSED pc = abuf->addr; | |
2929 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2930 | ||
2931 | { | |
2932 | UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3); | |
2933 | SETMEMUQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
2934 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2935 | } | |
2936 | ||
2937 | return vpc; | |
2938 | #undef FLD | |
2939 | } | |
2940 | ||
2941 | /* movb4-compact: mov.b r0, @($imm8, gbr) */ | |
2942 | ||
2943 | static SEM_PC | |
2944 | SEM_FN_NAME (sh64_compact,movb4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2945 | { | |
2946 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
2947 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2948 | int UNUSED written = 0; | |
2949 | IADDR UNUSED pc = abuf->addr; | |
2950 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2951 | ||
2952 | { | |
2953 | DI tmp_addr; | |
2954 | tmp_addr = ADDSI (GET_H_GBR (), FLD (f_imm8)); | |
2955 | { | |
2956 | UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3); | |
2957 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
2958 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2959 | } | |
2960 | } | |
2961 | ||
2962 | return vpc; | |
2963 | #undef FLD | |
2964 | } | |
2965 | ||
2966 | /* movb5-compact: mov.b r0, @($imm4, $rm) */ | |
2967 | ||
2968 | static SEM_PC | |
2969 | SEM_FN_NAME (sh64_compact,movb5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2970 | { | |
2971 | #define FLD(f) abuf->fields.sfmt_movb5_compact.f | |
2972 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2973 | int UNUSED written = 0; | |
2974 | IADDR UNUSED pc = abuf->addr; | |
2975 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2976 | ||
2977 | { | |
2978 | DI tmp_addr; | |
2979 | tmp_addr = ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4)); | |
2980 | { | |
2981 | UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3); | |
2982 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
2983 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2984 | } | |
2985 | } | |
2986 | ||
2987 | return vpc; | |
2988 | #undef FLD | |
2989 | } | |
2990 | ||
2991 | /* movb6-compact: mov.b @$rm, $rn */ | |
2992 | ||
2993 | static SEM_PC | |
2994 | SEM_FN_NAME (sh64_compact,movb6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2995 | { | |
c7e628df | 2996 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
2997 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2998 | int UNUSED written = 0; | |
2999 | IADDR UNUSED pc = abuf->addr; | |
3000 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3001 | ||
3002 | { | |
3003 | SI opval = EXTQISI (GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm)))); | |
3004 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3005 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3006 | } |
3007 | ||
3008 | return vpc; | |
3009 | #undef FLD | |
3010 | } | |
3011 | ||
3012 | /* movb7-compact: mov.b @${rm}+, $rn */ | |
3013 | ||
3014 | static SEM_PC | |
3015 | SEM_FN_NAME (sh64_compact,movb7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3016 | { | |
c7e628df | 3017 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3018 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3019 | int UNUSED written = 0; | |
3020 | IADDR UNUSED pc = abuf->addr; | |
3021 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3022 | ||
3023 | { | |
3024 | QI tmp_data; | |
3025 | tmp_data = GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
3026 | if (EQSI (FLD (f_rm), FLD (f_rn))) { | |
3027 | { | |
3028 | SI opval = EXTQISI (tmp_data); | |
3029 | SET_H_GRC (FLD (f_rm), opval); | |
3030 | written |= (1 << 4); | |
c7e628df | 3031 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3032 | } |
3033 | } else { | |
3034 | { | |
3035 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 1); | |
3036 | SET_H_GRC (FLD (f_rm), opval); | |
3037 | written |= (1 << 4); | |
c7e628df | 3038 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3039 | } |
3040 | } | |
3041 | { | |
3042 | SI opval = EXTQISI (tmp_data); | |
3043 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3044 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3045 | } |
3046 | } | |
3047 | ||
3048 | abuf->written = written; | |
3049 | return vpc; | |
3050 | #undef FLD | |
3051 | } | |
3052 | ||
3053 | /* movb8-compact: mov.b @(r0, $rm), $rn */ | |
3054 | ||
3055 | static SEM_PC | |
3056 | SEM_FN_NAME (sh64_compact,movb8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3057 | { | |
c7e628df | 3058 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3059 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3060 | int UNUSED written = 0; | |
3061 | IADDR UNUSED pc = abuf->addr; | |
3062 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3063 | ||
3064 | { | |
3065 | SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))))); | |
3066 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3067 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3068 | } |
3069 | ||
3070 | return vpc; | |
3071 | #undef FLD | |
3072 | } | |
3073 | ||
3074 | /* movb9-compact: mov.b @($imm8, gbr), r0 */ | |
3075 | ||
3076 | static SEM_PC | |
3077 | SEM_FN_NAME (sh64_compact,movb9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3078 | { | |
3079 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
3080 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3081 | int UNUSED written = 0; | |
3082 | IADDR UNUSED pc = abuf->addr; | |
3083 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3084 | ||
3085 | { | |
3086 | SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8)))); | |
3087 | SET_H_GRC (((UINT) 0), opval); | |
c7e628df | 3088 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3089 | } |
3090 | ||
3091 | return vpc; | |
3092 | #undef FLD | |
3093 | } | |
3094 | ||
3095 | /* movb10-compact: mov.b @($imm4, $rm), r0 */ | |
3096 | ||
3097 | static SEM_PC | |
3098 | SEM_FN_NAME (sh64_compact,movb10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3099 | { | |
3100 | #define FLD(f) abuf->fields.sfmt_movb5_compact.f | |
3101 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3102 | int UNUSED written = 0; | |
3103 | IADDR UNUSED pc = abuf->addr; | |
3104 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3105 | ||
3106 | { | |
3107 | SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4)))); | |
3108 | SET_H_GRC (((UINT) 0), opval); | |
c7e628df | 3109 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3110 | } |
3111 | ||
3112 | return vpc; | |
3113 | #undef FLD | |
3114 | } | |
3115 | ||
3116 | /* movl1-compact: mov.l $rm, @$rn */ | |
3117 | ||
3118 | static SEM_PC | |
3119 | SEM_FN_NAME (sh64_compact,movl1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3120 | { | |
c7e628df | 3121 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3122 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3123 | int UNUSED written = 0; | |
3124 | IADDR UNUSED pc = abuf->addr; | |
3125 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3126 | ||
3127 | { | |
3128 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3129 | SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
3130 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3131 | } | |
3132 | ||
3133 | return vpc; | |
3134 | #undef FLD | |
3135 | } | |
3136 | ||
3137 | /* movl2-compact: mov.l $rm, @-$rn */ | |
3138 | ||
3139 | static SEM_PC | |
3140 | SEM_FN_NAME (sh64_compact,movl2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3141 | { | |
c7e628df | 3142 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3143 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3144 | int UNUSED written = 0; | |
3145 | IADDR UNUSED pc = abuf->addr; | |
3146 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3147 | ||
3148 | { | |
3149 | SI tmp_addr; | |
3150 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
3151 | { | |
3152 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3153 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
3154 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3155 | } | |
3156 | { | |
3157 | SI opval = tmp_addr; | |
3158 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3159 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3160 | } |
3161 | } | |
3162 | ||
3163 | return vpc; | |
3164 | #undef FLD | |
3165 | } | |
3166 | ||
3167 | /* movl3-compact: mov.l $rm, @(r0, $rn) */ | |
3168 | ||
3169 | static SEM_PC | |
3170 | SEM_FN_NAME (sh64_compact,movl3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3171 | { | |
c7e628df | 3172 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3173 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3174 | int UNUSED written = 0; | |
3175 | IADDR UNUSED pc = abuf->addr; | |
3176 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3177 | ||
3178 | { | |
3179 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3180 | SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
3181 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3182 | } | |
3183 | ||
3184 | return vpc; | |
3185 | #undef FLD | |
3186 | } | |
3187 | ||
3188 | /* movl4-compact: mov.l r0, @($imm8x4, gbr) */ | |
3189 | ||
3190 | static SEM_PC | |
3191 | SEM_FN_NAME (sh64_compact,movl4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3192 | { | |
3193 | #define FLD(f) abuf->fields.sfmt_movl10_compact.f | |
3194 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3195 | int UNUSED written = 0; | |
3196 | IADDR UNUSED pc = abuf->addr; | |
3197 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3198 | ||
3199 | { | |
3200 | SI opval = GET_H_GRC (((UINT) 0)); | |
3201 | SETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4)), opval); | |
3202 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3203 | } | |
3204 | ||
3205 | return vpc; | |
3206 | #undef FLD | |
3207 | } | |
3208 | ||
3209 | /* movl5-compact: mov.l $rm, @($imm4x4, $rn) */ | |
3210 | ||
3211 | static SEM_PC | |
3212 | SEM_FN_NAME (sh64_compact,movl5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3213 | { | |
3214 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3215 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3216 | int UNUSED written = 0; | |
3217 | IADDR UNUSED pc = abuf->addr; | |
3218 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3219 | ||
3220 | { | |
3221 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3222 | SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm4x4)), opval); | |
3223 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3224 | } | |
3225 | ||
3226 | return vpc; | |
3227 | #undef FLD | |
3228 | } | |
3229 | ||
3230 | /* movl6-compact: mov.l @$rm, $rn */ | |
3231 | ||
3232 | static SEM_PC | |
3233 | SEM_FN_NAME (sh64_compact,movl6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3234 | { | |
c7e628df | 3235 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3236 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3237 | int UNUSED written = 0; | |
3238 | IADDR UNUSED pc = abuf->addr; | |
3239 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3240 | ||
3241 | { | |
3242 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
3243 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3244 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3245 | } |
3246 | ||
3247 | return vpc; | |
3248 | #undef FLD | |
3249 | } | |
3250 | ||
3251 | /* movl7-compact: mov.l @${rm}+, $rn */ | |
3252 | ||
3253 | static SEM_PC | |
3254 | SEM_FN_NAME (sh64_compact,movl7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3255 | { | |
c7e628df | 3256 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3257 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3258 | int UNUSED written = 0; | |
3259 | IADDR UNUSED pc = abuf->addr; | |
3260 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3261 | ||
3262 | { | |
3263 | { | |
3264 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
3265 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3266 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3267 | } |
3268 | if (EQSI (FLD (f_rm), FLD (f_rn))) { | |
3269 | { | |
3270 | SI opval = GET_H_GRC (FLD (f_rn)); | |
3271 | SET_H_GRC (FLD (f_rm), opval); | |
3272 | written |= (1 << 5); | |
c7e628df | 3273 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3274 | } |
3275 | } else { | |
3276 | { | |
3277 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4); | |
3278 | SET_H_GRC (FLD (f_rm), opval); | |
3279 | written |= (1 << 5); | |
c7e628df | 3280 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3281 | } |
3282 | } | |
3283 | } | |
3284 | ||
3285 | abuf->written = written; | |
3286 | return vpc; | |
3287 | #undef FLD | |
3288 | } | |
3289 | ||
3290 | /* movl8-compact: mov.l @(r0, $rm), $rn */ | |
3291 | ||
3292 | static SEM_PC | |
3293 | SEM_FN_NAME (sh64_compact,movl8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3294 | { | |
c7e628df | 3295 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3296 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3297 | int UNUSED written = 0; | |
3298 | IADDR UNUSED pc = abuf->addr; | |
3299 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3300 | ||
3301 | { | |
3302 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))); | |
3303 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3304 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3305 | } |
3306 | ||
3307 | return vpc; | |
3308 | #undef FLD | |
3309 | } | |
3310 | ||
3311 | /* movl9-compact: mov.l @($imm8x4, gbr), r0 */ | |
3312 | ||
3313 | static SEM_PC | |
3314 | SEM_FN_NAME (sh64_compact,movl9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3315 | { | |
3316 | #define FLD(f) abuf->fields.sfmt_movl10_compact.f | |
3317 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3318 | int UNUSED written = 0; | |
3319 | IADDR UNUSED pc = abuf->addr; | |
3320 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3321 | ||
3322 | { | |
3323 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4))); | |
3324 | SET_H_GRC (((UINT) 0), opval); | |
c7e628df | 3325 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3326 | } |
3327 | ||
3328 | return vpc; | |
3329 | #undef FLD | |
3330 | } | |
3331 | ||
3332 | /* movl10-compact: mov.l @($imm8x4, pc), $rn */ | |
3333 | ||
3334 | static SEM_PC | |
3335 | SEM_FN_NAME (sh64_compact,movl10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3336 | { | |
3337 | #define FLD(f) abuf->fields.sfmt_movl10_compact.f | |
3338 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3339 | int UNUSED written = 0; | |
3340 | IADDR UNUSED pc = abuf->addr; | |
3341 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3342 | ||
3343 | { | |
3344 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3)))); | |
3345 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3346 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3347 | } |
3348 | ||
3349 | return vpc; | |
3350 | #undef FLD | |
3351 | } | |
3352 | ||
3353 | /* movl11-compact: mov.l @($imm4x4, $rm), $rn */ | |
3354 | ||
3355 | static SEM_PC | |
3356 | SEM_FN_NAME (sh64_compact,movl11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3357 | { | |
3358 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3359 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3360 | int UNUSED written = 0; | |
3361 | IADDR UNUSED pc = abuf->addr; | |
3362 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3363 | ||
3364 | { | |
3365 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x4))); | |
3366 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
3367 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
3368 | } | |
3369 | ||
3370 | return vpc; | |
3371 | #undef FLD | |
3372 | } | |
3373 | ||
3374 | /* movl12-compact: mov.l @($imm12x4, $rm), $rn */ | |
3375 | ||
3376 | static SEM_PC | |
3377 | SEM_FN_NAME (sh64_compact,movl12_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3378 | { | |
3379 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f | |
3380 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3381 | int UNUSED written = 0; | |
3382 | IADDR UNUSED pc = abuf->addr; | |
3383 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3384 | ||
3385 | { | |
3386 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm12x4))); | |
3387 | SET_H_GRC (FLD (f_rn), opval); | |
3388 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
3389 | } | |
3390 | ||
3391 | return vpc; | |
3392 | #undef FLD | |
3393 | } | |
3394 | ||
3395 | /* movl13-compact: mov.l $rm, @($imm12x4, $rn) */ | |
3396 | ||
3397 | static SEM_PC | |
3398 | SEM_FN_NAME (sh64_compact,movl13_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3399 | { | |
3400 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f | |
3401 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3402 | int UNUSED written = 0; | |
3403 | IADDR UNUSED pc = abuf->addr; | |
3404 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3405 | ||
3406 | { | |
3407 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3408 | SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm12x4)), opval); | |
3409 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
cbb38b47 BE |
3410 | } |
3411 | ||
3412 | return vpc; | |
3413 | #undef FLD | |
3414 | } | |
3415 | ||
3416 | /* movw1-compact: mov.w $rm, @$rn */ | |
3417 | ||
3418 | static SEM_PC | |
3419 | SEM_FN_NAME (sh64_compact,movw1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3420 | { | |
c7e628df | 3421 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3422 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3423 | int UNUSED written = 0; | |
3424 | IADDR UNUSED pc = abuf->addr; | |
3425 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3426 | ||
3427 | { | |
3428 | HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1); | |
3429 | SETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
3430 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3431 | } | |
3432 | ||
3433 | return vpc; | |
3434 | #undef FLD | |
3435 | } | |
3436 | ||
3437 | /* movw2-compact: mov.w $rm, @-$rn */ | |
3438 | ||
3439 | static SEM_PC | |
3440 | SEM_FN_NAME (sh64_compact,movw2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3441 | { | |
c7e628df | 3442 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3443 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3444 | int UNUSED written = 0; | |
3445 | IADDR UNUSED pc = abuf->addr; | |
3446 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3447 | ||
3448 | { | |
3449 | DI tmp_addr; | |
3450 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 2); | |
3451 | { | |
3452 | HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1); | |
3453 | SETMEMHI (current_cpu, pc, tmp_addr, opval); | |
3454 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3455 | } | |
3456 | { | |
3457 | SI opval = tmp_addr; | |
3458 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3459 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3460 | } |
3461 | } | |
3462 | ||
3463 | return vpc; | |
3464 | #undef FLD | |
3465 | } | |
3466 | ||
3467 | /* movw3-compact: mov.w $rm, @(r0, $rn) */ | |
3468 | ||
3469 | static SEM_PC | |
3470 | SEM_FN_NAME (sh64_compact,movw3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3471 | { | |
c7e628df | 3472 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3473 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3474 | int UNUSED written = 0; | |
3475 | IADDR UNUSED pc = abuf->addr; | |
3476 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3477 | ||
3478 | { | |
3479 | HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1); | |
3480 | SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
3481 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3482 | } | |
3483 | ||
3484 | return vpc; | |
3485 | #undef FLD | |
3486 | } | |
3487 | ||
3488 | /* movw4-compact: mov.w r0, @($imm8x2, gbr) */ | |
3489 | ||
3490 | static SEM_PC | |
3491 | SEM_FN_NAME (sh64_compact,movw4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3492 | { | |
3493 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3494 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3495 | int UNUSED written = 0; | |
3496 | IADDR UNUSED pc = abuf->addr; | |
3497 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3498 | ||
3499 | { | |
3500 | HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1); | |
3501 | SETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2)), opval); | |
3502 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3503 | } | |
3504 | ||
3505 | return vpc; | |
3506 | #undef FLD | |
3507 | } | |
3508 | ||
c7e628df | 3509 | /* movw5-compact: mov.w r0, @($imm4x2, $rm) */ |
cbb38b47 BE |
3510 | |
3511 | static SEM_PC | |
3512 | SEM_FN_NAME (sh64_compact,movw5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3513 | { | |
3514 | #define FLD(f) abuf->fields.sfmt_movw5_compact.f | |
3515 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3516 | int UNUSED written = 0; | |
3517 | IADDR UNUSED pc = abuf->addr; | |
3518 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3519 | ||
3520 | { | |
3521 | HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1); | |
c7e628df | 3522 | SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2)), opval); |
cbb38b47 BE |
3523 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
3524 | } | |
3525 | ||
3526 | return vpc; | |
3527 | #undef FLD | |
3528 | } | |
3529 | ||
3530 | /* movw6-compact: mov.w @$rm, $rn */ | |
3531 | ||
3532 | static SEM_PC | |
3533 | SEM_FN_NAME (sh64_compact,movw6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3534 | { | |
c7e628df | 3535 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3536 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3537 | int UNUSED written = 0; | |
3538 | IADDR UNUSED pc = abuf->addr; | |
3539 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3540 | ||
3541 | { | |
3542 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm)))); | |
3543 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3544 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3545 | } |
3546 | ||
3547 | return vpc; | |
3548 | #undef FLD | |
3549 | } | |
3550 | ||
3551 | /* movw7-compact: mov.w @${rm}+, $rn */ | |
3552 | ||
3553 | static SEM_PC | |
3554 | SEM_FN_NAME (sh64_compact,movw7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3555 | { | |
c7e628df | 3556 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3557 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3558 | int UNUSED written = 0; | |
3559 | IADDR UNUSED pc = abuf->addr; | |
3560 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3561 | ||
3562 | { | |
3563 | HI tmp_data; | |
3564 | tmp_data = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
3565 | if (EQSI (FLD (f_rm), FLD (f_rn))) { | |
3566 | { | |
3567 | SI opval = EXTHISI (tmp_data); | |
3568 | SET_H_GRC (FLD (f_rm), opval); | |
3569 | written |= (1 << 4); | |
c7e628df | 3570 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3571 | } |
3572 | } else { | |
3573 | { | |
3574 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2); | |
3575 | SET_H_GRC (FLD (f_rm), opval); | |
3576 | written |= (1 << 4); | |
c7e628df | 3577 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3578 | } |
3579 | } | |
3580 | { | |
3581 | SI opval = EXTHISI (tmp_data); | |
3582 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3583 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3584 | } |
3585 | } | |
3586 | ||
3587 | abuf->written = written; | |
3588 | return vpc; | |
3589 | #undef FLD | |
3590 | } | |
3591 | ||
3592 | /* movw8-compact: mov.w @(r0, $rm), $rn */ | |
3593 | ||
3594 | static SEM_PC | |
3595 | SEM_FN_NAME (sh64_compact,movw8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3596 | { | |
c7e628df | 3597 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3598 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3599 | int UNUSED written = 0; | |
3600 | IADDR UNUSED pc = abuf->addr; | |
3601 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3602 | ||
3603 | { | |
3604 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))))); | |
3605 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3606 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3607 | } |
3608 | ||
3609 | return vpc; | |
3610 | #undef FLD | |
3611 | } | |
3612 | ||
3613 | /* movw9-compact: mov.w @($imm8x2, gbr), r0 */ | |
3614 | ||
3615 | static SEM_PC | |
3616 | SEM_FN_NAME (sh64_compact,movw9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3617 | { | |
3618 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3619 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3620 | int UNUSED written = 0; | |
3621 | IADDR UNUSED pc = abuf->addr; | |
3622 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3623 | ||
3624 | { | |
3625 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2)))); | |
3626 | SET_H_GRC (((UINT) 0), opval); | |
c7e628df | 3627 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3628 | } |
3629 | ||
3630 | return vpc; | |
3631 | #undef FLD | |
3632 | } | |
3633 | ||
3634 | /* movw10-compact: mov.w @($imm8x2, pc), $rn */ | |
3635 | ||
3636 | static SEM_PC | |
3637 | SEM_FN_NAME (sh64_compact,movw10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3638 | { | |
3639 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3640 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3641 | int UNUSED written = 0; | |
3642 | IADDR UNUSED pc = abuf->addr; | |
3643 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3644 | ||
3645 | { | |
3646 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2)))); | |
3647 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3648 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3649 | } |
3650 | ||
3651 | return vpc; | |
3652 | #undef FLD | |
3653 | } | |
3654 | ||
3655 | /* movw11-compact: mov.w @($imm4x2, $rm), r0 */ | |
3656 | ||
3657 | static SEM_PC | |
3658 | SEM_FN_NAME (sh64_compact,movw11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3659 | { | |
c7e628df | 3660 | #define FLD(f) abuf->fields.sfmt_movw5_compact.f |
cbb38b47 BE |
3661 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3662 | int UNUSED written = 0; | |
3663 | IADDR UNUSED pc = abuf->addr; | |
3664 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3665 | ||
3666 | { | |
3667 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2)))); | |
3668 | SET_H_GRC (((UINT) 0), opval); | |
c7e628df | 3669 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3670 | } |
3671 | ||
3672 | return vpc; | |
3673 | #undef FLD | |
3674 | } | |
3675 | ||
3676 | /* mova-compact: mova @($imm8x4, pc), r0 */ | |
3677 | ||
3678 | static SEM_PC | |
3679 | SEM_FN_NAME (sh64_compact,mova_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3680 | { | |
3681 | #define FLD(f) abuf->fields.sfmt_movl10_compact.f | |
3682 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3683 | int UNUSED written = 0; | |
3684 | IADDR UNUSED pc = abuf->addr; | |
3685 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3686 | ||
3687 | { | |
3688 | SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4)); | |
3689 | SET_H_GRC (((UINT) 0), opval); | |
c7e628df | 3690 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3691 | } |
3692 | ||
3693 | return vpc; | |
3694 | #undef FLD | |
3695 | } | |
3696 | ||
3697 | /* movcal-compact: movca.l r0, @$rn */ | |
3698 | ||
3699 | static SEM_PC | |
3700 | SEM_FN_NAME (sh64_compact,movcal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3701 | { | |
3702 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3703 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3704 | int UNUSED written = 0; | |
3705 | IADDR UNUSED pc = abuf->addr; | |
3706 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3707 | ||
3708 | { | |
3709 | SI opval = GET_H_GRC (((UINT) 0)); | |
3710 | SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
3711 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3712 | } | |
3713 | ||
3714 | return vpc; | |
3715 | #undef FLD | |
3716 | } | |
3717 | ||
c7e628df DB |
3718 | /* movcol-compact: movco.l r0, @$rn */ |
3719 | ||
3720 | static SEM_PC | |
3721 | SEM_FN_NAME (sh64_compact,movcol_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3722 | { | |
3723 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3724 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3725 | int UNUSED written = 0; | |
3726 | IADDR UNUSED pc = abuf->addr; | |
3727 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3728 | ||
3729 | { | |
3730 | SI opval = GET_H_GRC (FLD (f_rn)); | |
3731 | SET_H_GRC (FLD (f_rn), opval); | |
3732 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
3733 | } | |
3734 | ||
3735 | return vpc; | |
3736 | #undef FLD | |
3737 | } | |
3738 | ||
cbb38b47 BE |
3739 | /* movt-compact: movt $rn */ |
3740 | ||
3741 | static SEM_PC | |
3742 | SEM_FN_NAME (sh64_compact,movt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3743 | { | |
3744 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3745 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3746 | int UNUSED written = 0; | |
3747 | IADDR UNUSED pc = abuf->addr; | |
3748 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3749 | ||
3750 | { | |
3751 | SI opval = ZEXTBISI (GET_H_TBIT ()); | |
3752 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
3753 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
3754 | } | |
3755 | ||
3756 | return vpc; | |
3757 | #undef FLD | |
3758 | } | |
3759 | ||
3760 | /* movual-compact: movua.l @$rn, r0 */ | |
3761 | ||
3762 | static SEM_PC | |
3763 | SEM_FN_NAME (sh64_compact,movual_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3764 | { | |
3765 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3766 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3767 | int UNUSED written = 0; | |
3768 | IADDR UNUSED pc = abuf->addr; | |
3769 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3770 | ||
3771 | { | |
3772 | SI opval = sh64_movua (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
3773 | SET_H_GRC (((UINT) 0), opval); | |
3774 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
3775 | } | |
3776 | ||
3777 | return vpc; | |
3778 | #undef FLD | |
3779 | } | |
3780 | ||
3781 | /* movual2-compact: movua.l @$rn+, r0 */ | |
3782 | ||
3783 | static SEM_PC | |
3784 | SEM_FN_NAME (sh64_compact,movual2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3785 | { | |
3786 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3787 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3788 | int UNUSED written = 0; | |
3789 | IADDR UNUSED pc = abuf->addr; | |
3790 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3791 | ||
3792 | { | |
3793 | { | |
3794 | SI opval = sh64_movua (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
3795 | SET_H_GRC (((UINT) 0), opval); | |
3796 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
3797 | } | |
3798 | { | |
3799 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
3800 | SET_H_GRC (FLD (f_rn), opval); | |
3801 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 | 3802 | } |
c7e628df | 3803 | } |
cbb38b47 BE |
3804 | |
3805 | return vpc; | |
3806 | #undef FLD | |
3807 | } | |
3808 | ||
3809 | /* mull-compact: mul.l $rm, $rn */ | |
3810 | ||
3811 | static SEM_PC | |
3812 | SEM_FN_NAME (sh64_compact,mull_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3813 | { | |
c7e628df | 3814 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3815 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3816 | int UNUSED written = 0; | |
3817 | IADDR UNUSED pc = abuf->addr; | |
3818 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3819 | ||
3820 | { | |
3821 | SI opval = MULSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))); | |
3822 | SET_H_MACL (opval); | |
3823 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
3824 | } | |
3825 | ||
3826 | return vpc; | |
3827 | #undef FLD | |
3828 | } | |
3829 | ||
3830 | /* mulsw-compact: muls.w $rm, $rn */ | |
3831 | ||
3832 | static SEM_PC | |
3833 | SEM_FN_NAME (sh64_compact,mulsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3834 | { | |
c7e628df | 3835 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3836 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3837 | int UNUSED written = 0; | |
3838 | IADDR UNUSED pc = abuf->addr; | |
3839 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3840 | ||
3841 | { | |
3842 | SI opval = MULSI (EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1))); | |
3843 | SET_H_MACL (opval); | |
3844 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
3845 | } | |
3846 | ||
3847 | return vpc; | |
3848 | #undef FLD | |
3849 | } | |
3850 | ||
3851 | /* muluw-compact: mulu.w $rm, $rn */ | |
3852 | ||
3853 | static SEM_PC | |
3854 | SEM_FN_NAME (sh64_compact,muluw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3855 | { | |
c7e628df | 3856 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3857 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3858 | int UNUSED written = 0; | |
3859 | IADDR UNUSED pc = abuf->addr; | |
3860 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3861 | ||
3862 | { | |
3863 | SI opval = MULSI (ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1))); | |
3864 | SET_H_MACL (opval); | |
3865 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
3866 | } | |
3867 | ||
3868 | return vpc; | |
3869 | #undef FLD | |
3870 | } | |
3871 | ||
3872 | /* neg-compact: neg $rm, $rn */ | |
3873 | ||
3874 | static SEM_PC | |
3875 | SEM_FN_NAME (sh64_compact,neg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3876 | { | |
c7e628df | 3877 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3878 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3879 | int UNUSED written = 0; | |
3880 | IADDR UNUSED pc = abuf->addr; | |
3881 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3882 | ||
3883 | { | |
3884 | SI opval = NEGSI (GET_H_GRC (FLD (f_rm))); | |
3885 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3886 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3887 | } |
3888 | ||
3889 | return vpc; | |
3890 | #undef FLD | |
3891 | } | |
3892 | ||
3893 | /* negc-compact: negc $rm, $rn */ | |
3894 | ||
3895 | static SEM_PC | |
3896 | SEM_FN_NAME (sh64_compact,negc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3897 | { | |
c7e628df | 3898 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3899 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3900 | int UNUSED written = 0; | |
3901 | IADDR UNUSED pc = abuf->addr; | |
3902 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3903 | ||
3904 | { | |
3905 | BI tmp_flag; | |
3906 | tmp_flag = SUBCFSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
3907 | { | |
3908 | SI opval = SUBCSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
3909 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 3910 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
3911 | } |
3912 | { | |
3913 | BI opval = tmp_flag; | |
3914 | SET_H_TBIT (opval); | |
3915 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
3916 | } | |
3917 | } | |
3918 | ||
3919 | return vpc; | |
3920 | #undef FLD | |
3921 | } | |
3922 | ||
3923 | /* nop-compact: nop */ | |
3924 | ||
3925 | static SEM_PC | |
3926 | SEM_FN_NAME (sh64_compact,nop_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3927 | { | |
2310652a | 3928 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
3929 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3930 | int UNUSED written = 0; | |
3931 | IADDR UNUSED pc = abuf->addr; | |
3932 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3933 | ||
3934 | ((void) 0); /*nop*/ | |
3935 | ||
3936 | return vpc; | |
3937 | #undef FLD | |
3938 | } | |
3939 | ||
3940 | /* not-compact: not $rm64, $rn64 */ | |
3941 | ||
3942 | static SEM_PC | |
3943 | SEM_FN_NAME (sh64_compact,not_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3944 | { | |
c7e628df | 3945 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
3946 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3947 | int UNUSED written = 0; | |
3948 | IADDR UNUSED pc = abuf->addr; | |
3949 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3950 | ||
3951 | { | |
3952 | DI opval = INVDI (GET_H_GR (FLD (f_rm))); | |
3953 | SET_H_GR (FLD (f_rn), opval); | |
c7e628df | 3954 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3955 | } |
3956 | ||
3957 | return vpc; | |
3958 | #undef FLD | |
3959 | } | |
3960 | ||
3961 | /* ocbi-compact: ocbi @$rn */ | |
3962 | ||
3963 | static SEM_PC | |
3964 | SEM_FN_NAME (sh64_compact,ocbi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3965 | { | |
c7e628df | 3966 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f |
cbb38b47 BE |
3967 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3968 | int UNUSED written = 0; | |
3969 | IADDR UNUSED pc = abuf->addr; | |
3970 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3971 | ||
c7e628df DB |
3972 | { |
3973 | { | |
3974 | SI opval = GET_H_GRC (FLD (f_rn)); | |
3975 | SET_H_GRC (FLD (f_rn), opval); | |
3976 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
3977 | } | |
cbb38b47 | 3978 | ((void) 0); /*nop*/ |
c7e628df | 3979 | } |
cbb38b47 BE |
3980 | |
3981 | return vpc; | |
3982 | #undef FLD | |
3983 | } | |
3984 | ||
3985 | /* ocbp-compact: ocbp @$rn */ | |
3986 | ||
3987 | static SEM_PC | |
3988 | SEM_FN_NAME (sh64_compact,ocbp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3989 | { | |
c7e628df | 3990 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f |
cbb38b47 BE |
3991 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
3992 | int UNUSED written = 0; | |
3993 | IADDR UNUSED pc = abuf->addr; | |
3994 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3995 | ||
c7e628df DB |
3996 | { |
3997 | { | |
3998 | SI opval = GET_H_GRC (FLD (f_rn)); | |
3999 | SET_H_GRC (FLD (f_rn), opval); | |
4000 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
4001 | } | |
cbb38b47 | 4002 | ((void) 0); /*nop*/ |
c7e628df | 4003 | } |
cbb38b47 BE |
4004 | |
4005 | return vpc; | |
4006 | #undef FLD | |
4007 | } | |
4008 | ||
4009 | /* ocbwb-compact: ocbwb @$rn */ | |
4010 | ||
4011 | static SEM_PC | |
4012 | SEM_FN_NAME (sh64_compact,ocbwb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4013 | { | |
c7e628df | 4014 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f |
cbb38b47 BE |
4015 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4016 | int UNUSED written = 0; | |
4017 | IADDR UNUSED pc = abuf->addr; | |
4018 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4019 | ||
c7e628df DB |
4020 | { |
4021 | { | |
4022 | SI opval = GET_H_GRC (FLD (f_rn)); | |
4023 | SET_H_GRC (FLD (f_rn), opval); | |
4024 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
4025 | } | |
cbb38b47 | 4026 | ((void) 0); /*nop*/ |
c7e628df | 4027 | } |
cbb38b47 BE |
4028 | |
4029 | return vpc; | |
4030 | #undef FLD | |
4031 | } | |
4032 | ||
4033 | /* or-compact: or $rm64, $rn64 */ | |
4034 | ||
4035 | static SEM_PC | |
4036 | SEM_FN_NAME (sh64_compact,or_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4037 | { | |
c7e628df | 4038 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
4039 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4040 | int UNUSED written = 0; | |
4041 | IADDR UNUSED pc = abuf->addr; | |
4042 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4043 | ||
4044 | { | |
4045 | DI opval = ORDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn))); | |
4046 | SET_H_GR (FLD (f_rn), opval); | |
c7e628df | 4047 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4048 | } |
4049 | ||
4050 | return vpc; | |
4051 | #undef FLD | |
4052 | } | |
4053 | ||
4054 | /* ori-compact: or #$uimm8, r0 */ | |
4055 | ||
4056 | static SEM_PC | |
4057 | SEM_FN_NAME (sh64_compact,ori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4058 | { | |
4059 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
4060 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4061 | int UNUSED written = 0; | |
4062 | IADDR UNUSED pc = abuf->addr; | |
4063 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4064 | ||
4065 | { | |
4066 | SI opval = ORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8))); | |
4067 | SET_H_GRC (((UINT) 0), opval); | |
c7e628df | 4068 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4069 | } |
4070 | ||
4071 | return vpc; | |
4072 | #undef FLD | |
4073 | } | |
4074 | ||
4075 | /* orb-compact: or.b #$imm8, @(r0, gbr) */ | |
4076 | ||
4077 | static SEM_PC | |
4078 | SEM_FN_NAME (sh64_compact,orb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4079 | { | |
4080 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
4081 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4082 | int UNUSED written = 0; | |
4083 | IADDR UNUSED pc = abuf->addr; | |
4084 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4085 | ||
4086 | { | |
4087 | DI tmp_addr; | |
4088 | UQI tmp_data; | |
4089 | tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ()); | |
4090 | tmp_data = ORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)); | |
4091 | { | |
4092 | UQI opval = tmp_data; | |
4093 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
4094 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4095 | } | |
4096 | } | |
4097 | ||
4098 | return vpc; | |
4099 | #undef FLD | |
4100 | } | |
4101 | ||
4102 | /* pref-compact: pref @$rn */ | |
4103 | ||
4104 | static SEM_PC | |
4105 | SEM_FN_NAME (sh64_compact,pref_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4106 | { | |
c7e628df | 4107 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f |
cbb38b47 BE |
4108 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4109 | int UNUSED written = 0; | |
4110 | IADDR UNUSED pc = abuf->addr; | |
4111 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4112 | ||
c7e628df | 4113 | sh64_pref (current_cpu, GET_H_GRC (FLD (f_rn))); |
cbb38b47 BE |
4114 | |
4115 | return vpc; | |
4116 | #undef FLD | |
4117 | } | |
4118 | ||
4119 | /* rotcl-compact: rotcl $rn */ | |
4120 | ||
4121 | static SEM_PC | |
4122 | SEM_FN_NAME (sh64_compact,rotcl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4123 | { | |
4124 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4125 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4126 | int UNUSED written = 0; | |
4127 | IADDR UNUSED pc = abuf->addr; | |
4128 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4129 | ||
4130 | { | |
4131 | BI tmp_temp; | |
4132 | tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
4133 | { | |
4134 | SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), GET_H_TBIT ()); | |
4135 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4136 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4137 | } |
4138 | { | |
4139 | BI opval = ((tmp_temp) ? (1) : (0)); | |
4140 | SET_H_TBIT (opval); | |
4141 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4142 | } | |
4143 | } | |
4144 | ||
4145 | return vpc; | |
4146 | #undef FLD | |
4147 | } | |
4148 | ||
4149 | /* rotcr-compact: rotcr $rn */ | |
4150 | ||
4151 | static SEM_PC | |
4152 | SEM_FN_NAME (sh64_compact,rotcr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4153 | { | |
4154 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4155 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4156 | int UNUSED written = 0; | |
4157 | IADDR UNUSED pc = abuf->addr; | |
4158 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4159 | ||
4160 | { | |
4161 | BI tmp_lsbit; | |
4162 | SI tmp_temp; | |
4163 | tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1)); | |
4164 | tmp_temp = GET_H_TBIT (); | |
4165 | { | |
4166 | SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31)); | |
4167 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4168 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4169 | } |
4170 | { | |
4171 | BI opval = ((tmp_lsbit) ? (1) : (0)); | |
4172 | SET_H_TBIT (opval); | |
4173 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4174 | } | |
4175 | } | |
4176 | ||
4177 | return vpc; | |
4178 | #undef FLD | |
4179 | } | |
4180 | ||
4181 | /* rotl-compact: rotl $rn */ | |
4182 | ||
4183 | static SEM_PC | |
4184 | SEM_FN_NAME (sh64_compact,rotl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4185 | { | |
4186 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4187 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4188 | int UNUSED written = 0; | |
4189 | IADDR UNUSED pc = abuf->addr; | |
4190 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4191 | ||
4192 | { | |
4193 | BI tmp_temp; | |
4194 | tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
4195 | { | |
4196 | SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), tmp_temp); | |
4197 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4198 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4199 | } |
4200 | { | |
4201 | BI opval = ((tmp_temp) ? (1) : (0)); | |
4202 | SET_H_TBIT (opval); | |
4203 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4204 | } | |
4205 | } | |
4206 | ||
4207 | return vpc; | |
4208 | #undef FLD | |
4209 | } | |
4210 | ||
4211 | /* rotr-compact: rotr $rn */ | |
4212 | ||
4213 | static SEM_PC | |
4214 | SEM_FN_NAME (sh64_compact,rotr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4215 | { | |
4216 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4217 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4218 | int UNUSED written = 0; | |
4219 | IADDR UNUSED pc = abuf->addr; | |
4220 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4221 | ||
4222 | { | |
4223 | BI tmp_lsbit; | |
4224 | SI tmp_temp; | |
4225 | tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1)); | |
4226 | tmp_temp = tmp_lsbit; | |
4227 | { | |
4228 | SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31)); | |
4229 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4230 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4231 | } |
4232 | { | |
4233 | BI opval = ((tmp_lsbit) ? (1) : (0)); | |
4234 | SET_H_TBIT (opval); | |
4235 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4236 | } | |
4237 | } | |
4238 | ||
4239 | return vpc; | |
4240 | #undef FLD | |
4241 | } | |
4242 | ||
4243 | /* rts-compact: rts */ | |
4244 | ||
4245 | static SEM_PC | |
4246 | SEM_FN_NAME (sh64_compact,rts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4247 | { | |
2310652a | 4248 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
4249 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4250 | int UNUSED written = 0; | |
4251 | IADDR UNUSED pc = abuf->addr; | |
4252 | SEM_BRANCH_INIT | |
4253 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4254 | ||
c7e628df DB |
4255 | { |
4256 | { | |
4257 | UDI opval = ADDDI (pc, 2); | |
4258 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
4259 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
4260 | } | |
4261 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
4262 | { |
4263 | { | |
4264 | UDI opval = GET_H_PR (); | |
4265 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
4266 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
4267 | } | |
c7e628df DB |
4268 | } |
4269 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
4270 | } |
4271 | ||
4272 | SEM_BRANCH_FINI (vpc); | |
4273 | return vpc; | |
4274 | #undef FLD | |
4275 | } | |
4276 | ||
4277 | /* sets-compact: sets */ | |
4278 | ||
4279 | static SEM_PC | |
4280 | SEM_FN_NAME (sh64_compact,sets_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4281 | { | |
2310652a | 4282 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
4283 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4284 | int UNUSED written = 0; | |
4285 | IADDR UNUSED pc = abuf->addr; | |
4286 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4287 | ||
4288 | { | |
4289 | BI opval = 1; | |
4290 | SET_H_SBIT (opval); | |
4291 | TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval); | |
4292 | } | |
4293 | ||
4294 | return vpc; | |
4295 | #undef FLD | |
4296 | } | |
4297 | ||
4298 | /* sett-compact: sett */ | |
4299 | ||
4300 | static SEM_PC | |
4301 | SEM_FN_NAME (sh64_compact,sett_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4302 | { | |
2310652a | 4303 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
4304 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4305 | int UNUSED written = 0; | |
4306 | IADDR UNUSED pc = abuf->addr; | |
4307 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4308 | ||
4309 | { | |
4310 | BI opval = 1; | |
4311 | SET_H_TBIT (opval); | |
4312 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4313 | } | |
4314 | ||
4315 | return vpc; | |
4316 | #undef FLD | |
4317 | } | |
4318 | ||
4319 | /* shad-compact: shad $rm, $rn */ | |
4320 | ||
4321 | static SEM_PC | |
4322 | SEM_FN_NAME (sh64_compact,shad_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4323 | { | |
c7e628df | 4324 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
4325 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4326 | int UNUSED written = 0; | |
4327 | IADDR UNUSED pc = abuf->addr; | |
4328 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4329 | ||
4330 | { | |
c7e628df DB |
4331 | SI tmp_shamt; |
4332 | tmp_shamt = ANDSI (GET_H_GRC (FLD (f_rm)), 31); | |
cbb38b47 BE |
4333 | if (GESI (GET_H_GRC (FLD (f_rm)), 0)) { |
4334 | { | |
4335 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt); | |
4336 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4337 | written |= (1 << 2); |
4338 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4339 | } |
4340 | } else { | |
c7e628df | 4341 | if (NESI (tmp_shamt, 0)) { |
cbb38b47 BE |
4342 | { |
4343 | SI opval = SRASI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt)); | |
4344 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4345 | written |= (1 << 2); |
4346 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4347 | } |
4348 | } else { | |
4349 | if (LTSI (GET_H_GRC (FLD (f_rn)), 0)) { | |
4350 | { | |
4351 | SI opval = NEGSI (1); | |
4352 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4353 | written |= (1 << 2); |
4354 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4355 | } |
4356 | } else { | |
4357 | { | |
4358 | SI opval = 0; | |
4359 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4360 | written |= (1 << 2); |
4361 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4362 | } |
4363 | } | |
4364 | } | |
4365 | } | |
4366 | } | |
4367 | ||
4368 | abuf->written = written; | |
4369 | return vpc; | |
4370 | #undef FLD | |
4371 | } | |
4372 | ||
4373 | /* shal-compact: shal $rn */ | |
4374 | ||
4375 | static SEM_PC | |
4376 | SEM_FN_NAME (sh64_compact,shal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4377 | { | |
4378 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4379 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4380 | int UNUSED written = 0; | |
4381 | IADDR UNUSED pc = abuf->addr; | |
4382 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4383 | ||
4384 | { | |
4385 | BI tmp_t; | |
4386 | tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
4387 | { | |
4388 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1); | |
4389 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4390 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4391 | } |
4392 | { | |
4393 | BI opval = ((tmp_t) ? (1) : (0)); | |
4394 | SET_H_TBIT (opval); | |
4395 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4396 | } | |
4397 | } | |
4398 | ||
4399 | return vpc; | |
4400 | #undef FLD | |
4401 | } | |
4402 | ||
4403 | /* shar-compact: shar $rn */ | |
4404 | ||
4405 | static SEM_PC | |
4406 | SEM_FN_NAME (sh64_compact,shar_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4407 | { | |
4408 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4409 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4410 | int UNUSED written = 0; | |
4411 | IADDR UNUSED pc = abuf->addr; | |
4412 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4413 | ||
4414 | { | |
4415 | BI tmp_t; | |
4416 | tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1); | |
4417 | { | |
4418 | SI opval = SRASI (GET_H_GRC (FLD (f_rn)), 1); | |
4419 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4420 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4421 | } |
4422 | { | |
4423 | BI opval = ((tmp_t) ? (1) : (0)); | |
4424 | SET_H_TBIT (opval); | |
4425 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4426 | } | |
4427 | } | |
4428 | ||
4429 | return vpc; | |
4430 | #undef FLD | |
4431 | } | |
4432 | ||
4433 | /* shld-compact: shld $rm, $rn */ | |
4434 | ||
4435 | static SEM_PC | |
4436 | SEM_FN_NAME (sh64_compact,shld_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4437 | { | |
c7e628df | 4438 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
4439 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4440 | int UNUSED written = 0; | |
4441 | IADDR UNUSED pc = abuf->addr; | |
4442 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4443 | ||
4444 | { | |
c7e628df DB |
4445 | SI tmp_shamt; |
4446 | tmp_shamt = ANDSI (GET_H_GRC (FLD (f_rm)), 31); | |
cbb38b47 BE |
4447 | if (GESI (GET_H_GRC (FLD (f_rm)), 0)) { |
4448 | { | |
4449 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt); | |
4450 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4451 | written |= (1 << 2); |
4452 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4453 | } |
4454 | } else { | |
c7e628df | 4455 | if (NESI (tmp_shamt, 0)) { |
cbb38b47 BE |
4456 | { |
4457 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt)); | |
4458 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4459 | written |= (1 << 2); |
4460 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4461 | } |
4462 | } else { | |
4463 | { | |
4464 | SI opval = 0; | |
4465 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4466 | written |= (1 << 2); |
4467 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4468 | } |
4469 | } | |
4470 | } | |
4471 | } | |
4472 | ||
4473 | abuf->written = written; | |
4474 | return vpc; | |
4475 | #undef FLD | |
4476 | } | |
4477 | ||
4478 | /* shll-compact: shll $rn */ | |
4479 | ||
4480 | static SEM_PC | |
4481 | SEM_FN_NAME (sh64_compact,shll_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4482 | { | |
4483 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4484 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4485 | int UNUSED written = 0; | |
4486 | IADDR UNUSED pc = abuf->addr; | |
4487 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4488 | ||
4489 | { | |
4490 | BI tmp_t; | |
4491 | tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
4492 | { | |
4493 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1); | |
4494 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4495 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4496 | } |
4497 | { | |
4498 | BI opval = ((tmp_t) ? (1) : (0)); | |
4499 | SET_H_TBIT (opval); | |
4500 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4501 | } | |
4502 | } | |
4503 | ||
4504 | return vpc; | |
4505 | #undef FLD | |
4506 | } | |
4507 | ||
4508 | /* shll2-compact: shll2 $rn */ | |
4509 | ||
4510 | static SEM_PC | |
4511 | SEM_FN_NAME (sh64_compact,shll2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4512 | { | |
4513 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4514 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4515 | int UNUSED written = 0; | |
4516 | IADDR UNUSED pc = abuf->addr; | |
4517 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4518 | ||
4519 | { | |
4520 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 2); | |
4521 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4522 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4523 | } |
4524 | ||
4525 | return vpc; | |
4526 | #undef FLD | |
4527 | } | |
4528 | ||
4529 | /* shll8-compact: shll8 $rn */ | |
4530 | ||
4531 | static SEM_PC | |
4532 | SEM_FN_NAME (sh64_compact,shll8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4533 | { | |
4534 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4535 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4536 | int UNUSED written = 0; | |
4537 | IADDR UNUSED pc = abuf->addr; | |
4538 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4539 | ||
4540 | { | |
4541 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 8); | |
4542 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4543 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4544 | } |
4545 | ||
4546 | return vpc; | |
4547 | #undef FLD | |
4548 | } | |
4549 | ||
4550 | /* shll16-compact: shll16 $rn */ | |
4551 | ||
4552 | static SEM_PC | |
4553 | SEM_FN_NAME (sh64_compact,shll16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4554 | { | |
4555 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4556 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4557 | int UNUSED written = 0; | |
4558 | IADDR UNUSED pc = abuf->addr; | |
4559 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4560 | ||
4561 | { | |
4562 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 16); | |
4563 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4564 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4565 | } |
4566 | ||
4567 | return vpc; | |
4568 | #undef FLD | |
4569 | } | |
4570 | ||
4571 | /* shlr-compact: shlr $rn */ | |
4572 | ||
4573 | static SEM_PC | |
4574 | SEM_FN_NAME (sh64_compact,shlr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4575 | { | |
4576 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4577 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4578 | int UNUSED written = 0; | |
4579 | IADDR UNUSED pc = abuf->addr; | |
4580 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4581 | ||
4582 | { | |
4583 | BI tmp_t; | |
4584 | tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1); | |
4585 | { | |
4586 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 1); | |
4587 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4588 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4589 | } |
4590 | { | |
4591 | BI opval = ((tmp_t) ? (1) : (0)); | |
4592 | SET_H_TBIT (opval); | |
4593 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4594 | } | |
4595 | } | |
4596 | ||
4597 | return vpc; | |
4598 | #undef FLD | |
4599 | } | |
4600 | ||
4601 | /* shlr2-compact: shlr2 $rn */ | |
4602 | ||
4603 | static SEM_PC | |
4604 | SEM_FN_NAME (sh64_compact,shlr2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4605 | { | |
4606 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4607 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4608 | int UNUSED written = 0; | |
4609 | IADDR UNUSED pc = abuf->addr; | |
4610 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4611 | ||
4612 | { | |
4613 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 2); | |
4614 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4615 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4616 | } |
4617 | ||
4618 | return vpc; | |
4619 | #undef FLD | |
4620 | } | |
4621 | ||
4622 | /* shlr8-compact: shlr8 $rn */ | |
4623 | ||
4624 | static SEM_PC | |
4625 | SEM_FN_NAME (sh64_compact,shlr8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4626 | { | |
4627 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4628 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4629 | int UNUSED written = 0; | |
4630 | IADDR UNUSED pc = abuf->addr; | |
4631 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4632 | ||
4633 | { | |
4634 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 8); | |
4635 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4636 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4637 | } |
4638 | ||
4639 | return vpc; | |
4640 | #undef FLD | |
4641 | } | |
4642 | ||
4643 | /* shlr16-compact: shlr16 $rn */ | |
4644 | ||
4645 | static SEM_PC | |
4646 | SEM_FN_NAME (sh64_compact,shlr16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4647 | { | |
4648 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4649 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4650 | int UNUSED written = 0; | |
4651 | IADDR UNUSED pc = abuf->addr; | |
4652 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4653 | ||
4654 | { | |
4655 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 16); | |
4656 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4657 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4658 | } |
4659 | ||
4660 | return vpc; | |
4661 | #undef FLD | |
4662 | } | |
4663 | ||
4664 | /* stc-gbr-compact: stc gbr, $rn */ | |
4665 | ||
4666 | static SEM_PC | |
4667 | SEM_FN_NAME (sh64_compact,stc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4668 | { | |
4669 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4670 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4671 | int UNUSED written = 0; | |
4672 | IADDR UNUSED pc = abuf->addr; | |
4673 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4674 | ||
4675 | { | |
4676 | SI opval = GET_H_GBR (); | |
4677 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4678 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
4679 | } | |
4680 | ||
4681 | return vpc; | |
4682 | #undef FLD | |
4683 | } | |
4684 | ||
4685 | /* stc-vbr-compact: stc vbr, $rn */ | |
4686 | ||
4687 | static SEM_PC | |
4688 | SEM_FN_NAME (sh64_compact,stc_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4689 | { | |
4690 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4691 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4692 | int UNUSED written = 0; | |
4693 | IADDR UNUSED pc = abuf->addr; | |
4694 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4695 | ||
4696 | { | |
4697 | SI opval = GET_H_VBR (); | |
4698 | SET_H_GRC (FLD (f_rn), opval); | |
4699 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4700 | } |
4701 | ||
4702 | return vpc; | |
4703 | #undef FLD | |
4704 | } | |
4705 | ||
4706 | /* stcl-gbr-compact: stc.l gbr, @-$rn */ | |
4707 | ||
4708 | static SEM_PC | |
4709 | SEM_FN_NAME (sh64_compact,stcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4710 | { | |
4711 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4712 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4713 | int UNUSED written = 0; | |
4714 | IADDR UNUSED pc = abuf->addr; | |
4715 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4716 | ||
4717 | { | |
4718 | DI tmp_addr; | |
4719 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4720 | { | |
4721 | SI opval = GET_H_GBR (); | |
4722 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4723 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4724 | } | |
4725 | { | |
4726 | SI opval = tmp_addr; | |
4727 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df DB |
4728 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
4729 | } | |
4730 | } | |
4731 | ||
4732 | return vpc; | |
4733 | #undef FLD | |
4734 | } | |
4735 | ||
4736 | /* stcl-vbr-compact: stc.l vbr, @-$rn */ | |
4737 | ||
4738 | static SEM_PC | |
4739 | SEM_FN_NAME (sh64_compact,stcl_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4740 | { | |
4741 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4742 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4743 | int UNUSED written = 0; | |
4744 | IADDR UNUSED pc = abuf->addr; | |
4745 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4746 | ||
4747 | { | |
4748 | DI tmp_addr; | |
4749 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4750 | { | |
4751 | SI opval = GET_H_VBR (); | |
4752 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4753 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4754 | } | |
4755 | { | |
4756 | SI opval = tmp_addr; | |
4757 | SET_H_GRC (FLD (f_rn), opval); | |
4758 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
4759 | } |
4760 | } | |
4761 | ||
4762 | return vpc; | |
4763 | #undef FLD | |
4764 | } | |
4765 | ||
4766 | /* sts-fpscr-compact: sts fpscr, $rn */ | |
4767 | ||
4768 | static SEM_PC | |
4769 | SEM_FN_NAME (sh64_compact,sts_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4770 | { | |
4771 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4772 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4773 | int UNUSED written = 0; | |
4774 | IADDR UNUSED pc = abuf->addr; | |
4775 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4776 | ||
4777 | { | |
c7e628df | 4778 | SI opval = CPU (h_fpscr); |
cbb38b47 | 4779 | SET_H_GRC (FLD (f_rn), opval); |
c7e628df | 4780 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4781 | } |
4782 | ||
4783 | return vpc; | |
4784 | #undef FLD | |
4785 | } | |
4786 | ||
4787 | /* stsl-fpscr-compact: sts.l fpscr, @-$rn */ | |
4788 | ||
4789 | static SEM_PC | |
4790 | SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4791 | { | |
4792 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4793 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4794 | int UNUSED written = 0; | |
4795 | IADDR UNUSED pc = abuf->addr; | |
4796 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4797 | ||
4798 | { | |
4799 | DI tmp_addr; | |
4800 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4801 | { | |
c7e628df | 4802 | SI opval = CPU (h_fpscr); |
cbb38b47 BE |
4803 | SETMEMSI (current_cpu, pc, tmp_addr, opval); |
4804 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4805 | } | |
4806 | { | |
4807 | SI opval = tmp_addr; | |
4808 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4809 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4810 | } |
4811 | } | |
4812 | ||
4813 | return vpc; | |
4814 | #undef FLD | |
4815 | } | |
4816 | ||
4817 | /* sts-fpul-compact: sts fpul, $rn */ | |
4818 | ||
4819 | static SEM_PC | |
4820 | SEM_FN_NAME (sh64_compact,sts_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4821 | { | |
4822 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4823 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4824 | int UNUSED written = 0; | |
4825 | IADDR UNUSED pc = abuf->addr; | |
4826 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4827 | ||
4828 | { | |
4829 | SI opval = SUBWORDSFSI (CPU (h_fr[((UINT) 32)])); | |
4830 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4831 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4832 | } |
4833 | ||
4834 | return vpc; | |
4835 | #undef FLD | |
4836 | } | |
4837 | ||
4838 | /* stsl-fpul-compact: sts.l fpul, @-$rn */ | |
4839 | ||
4840 | static SEM_PC | |
4841 | SEM_FN_NAME (sh64_compact,stsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4842 | { | |
4843 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4844 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4845 | int UNUSED written = 0; | |
4846 | IADDR UNUSED pc = abuf->addr; | |
4847 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4848 | ||
4849 | { | |
4850 | DI tmp_addr; | |
4851 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4852 | { | |
4853 | SF opval = CPU (h_fr[((UINT) 32)]); | |
4854 | SETMEMSF (current_cpu, pc, tmp_addr, opval); | |
4855 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
4856 | } | |
4857 | { | |
4858 | SI opval = tmp_addr; | |
4859 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4860 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4861 | } |
4862 | } | |
4863 | ||
4864 | return vpc; | |
4865 | #undef FLD | |
4866 | } | |
4867 | ||
4868 | /* sts-mach-compact: sts mach, $rn */ | |
4869 | ||
4870 | static SEM_PC | |
4871 | SEM_FN_NAME (sh64_compact,sts_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4872 | { | |
4873 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4874 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4875 | int UNUSED written = 0; | |
4876 | IADDR UNUSED pc = abuf->addr; | |
4877 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4878 | ||
4879 | { | |
4880 | SI opval = GET_H_MACH (); | |
4881 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4882 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4883 | } |
4884 | ||
4885 | return vpc; | |
4886 | #undef FLD | |
4887 | } | |
4888 | ||
4889 | /* stsl-mach-compact: sts.l mach, @-$rn */ | |
4890 | ||
4891 | static SEM_PC | |
4892 | SEM_FN_NAME (sh64_compact,stsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4893 | { | |
4894 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4895 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4896 | int UNUSED written = 0; | |
4897 | IADDR UNUSED pc = abuf->addr; | |
4898 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4899 | ||
4900 | { | |
4901 | DI tmp_addr; | |
4902 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4903 | { | |
4904 | SI opval = GET_H_MACH (); | |
4905 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4906 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4907 | } | |
4908 | { | |
4909 | SI opval = tmp_addr; | |
4910 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4911 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4912 | } |
4913 | } | |
4914 | ||
4915 | return vpc; | |
4916 | #undef FLD | |
4917 | } | |
4918 | ||
4919 | /* sts-macl-compact: sts macl, $rn */ | |
4920 | ||
4921 | static SEM_PC | |
4922 | SEM_FN_NAME (sh64_compact,sts_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4923 | { | |
4924 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4925 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4926 | int UNUSED written = 0; | |
4927 | IADDR UNUSED pc = abuf->addr; | |
4928 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4929 | ||
4930 | { | |
4931 | SI opval = GET_H_MACL (); | |
4932 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4933 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4934 | } |
4935 | ||
4936 | return vpc; | |
4937 | #undef FLD | |
4938 | } | |
4939 | ||
4940 | /* stsl-macl-compact: sts.l macl, @-$rn */ | |
4941 | ||
4942 | static SEM_PC | |
4943 | SEM_FN_NAME (sh64_compact,stsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4944 | { | |
4945 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4946 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4947 | int UNUSED written = 0; | |
4948 | IADDR UNUSED pc = abuf->addr; | |
4949 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4950 | ||
4951 | { | |
4952 | DI tmp_addr; | |
4953 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4954 | { | |
4955 | SI opval = GET_H_MACL (); | |
4956 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4957 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4958 | } | |
4959 | { | |
4960 | SI opval = tmp_addr; | |
4961 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4962 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4963 | } |
4964 | } | |
4965 | ||
4966 | return vpc; | |
4967 | #undef FLD | |
4968 | } | |
4969 | ||
4970 | /* sts-pr-compact: sts pr, $rn */ | |
4971 | ||
4972 | static SEM_PC | |
4973 | SEM_FN_NAME (sh64_compact,sts_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4974 | { | |
4975 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4976 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4977 | int UNUSED written = 0; | |
4978 | IADDR UNUSED pc = abuf->addr; | |
4979 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4980 | ||
4981 | { | |
4982 | SI opval = GET_H_PR (); | |
4983 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 4984 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
4985 | } |
4986 | ||
4987 | return vpc; | |
4988 | #undef FLD | |
4989 | } | |
4990 | ||
4991 | /* stsl-pr-compact: sts.l pr, @-$rn */ | |
4992 | ||
4993 | static SEM_PC | |
4994 | SEM_FN_NAME (sh64_compact,stsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4995 | { | |
4996 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4997 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4998 | int UNUSED written = 0; | |
4999 | IADDR UNUSED pc = abuf->addr; | |
5000 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5001 | ||
5002 | { | |
5003 | DI tmp_addr; | |
5004 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
5005 | { | |
5006 | SI opval = GET_H_PR (); | |
5007 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
5008 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5009 | } | |
5010 | { | |
5011 | SI opval = tmp_addr; | |
5012 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 5013 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
5014 | } |
5015 | } | |
5016 | ||
5017 | return vpc; | |
5018 | #undef FLD | |
5019 | } | |
5020 | ||
5021 | /* sub-compact: sub $rm, $rn */ | |
5022 | ||
5023 | static SEM_PC | |
5024 | SEM_FN_NAME (sh64_compact,sub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5025 | { | |
c7e628df | 5026 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
5027 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5028 | int UNUSED written = 0; | |
5029 | IADDR UNUSED pc = abuf->addr; | |
5030 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5031 | ||
5032 | { | |
5033 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
5034 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 5035 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
5036 | } |
5037 | ||
5038 | return vpc; | |
5039 | #undef FLD | |
5040 | } | |
5041 | ||
5042 | /* subc-compact: subc $rm, $rn */ | |
5043 | ||
5044 | static SEM_PC | |
5045 | SEM_FN_NAME (sh64_compact,subc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5046 | { | |
c7e628df | 5047 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
5048 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5049 | int UNUSED written = 0; | |
5050 | IADDR UNUSED pc = abuf->addr; | |
5051 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5052 | ||
5053 | { | |
5054 | BI tmp_flag; | |
5055 | tmp_flag = SUBCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
5056 | { | |
5057 | SI opval = SUBCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
5058 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 5059 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
5060 | } |
5061 | { | |
5062 | BI opval = tmp_flag; | |
5063 | SET_H_TBIT (opval); | |
5064 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
5065 | } | |
5066 | } | |
5067 | ||
5068 | return vpc; | |
5069 | #undef FLD | |
5070 | } | |
5071 | ||
5072 | /* subv-compact: subv $rm, $rn */ | |
5073 | ||
5074 | static SEM_PC | |
5075 | SEM_FN_NAME (sh64_compact,subv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5076 | { | |
c7e628df | 5077 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
5078 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5079 | int UNUSED written = 0; | |
5080 | IADDR UNUSED pc = abuf->addr; | |
5081 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5082 | ||
5083 | { | |
5084 | BI tmp_t; | |
5085 | tmp_t = SUBOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0); | |
5086 | { | |
5087 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
5088 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 5089 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
5090 | } |
5091 | { | |
5092 | BI opval = ((tmp_t) ? (1) : (0)); | |
5093 | SET_H_TBIT (opval); | |
5094 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
5095 | } | |
5096 | } | |
5097 | ||
5098 | return vpc; | |
5099 | #undef FLD | |
5100 | } | |
5101 | ||
5102 | /* swapb-compact: swap.b $rm, $rn */ | |
5103 | ||
5104 | static SEM_PC | |
5105 | SEM_FN_NAME (sh64_compact,swapb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5106 | { | |
c7e628df | 5107 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
5108 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5109 | int UNUSED written = 0; | |
5110 | IADDR UNUSED pc = abuf->addr; | |
5111 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5112 | ||
5113 | { | |
5114 | UHI tmp_top_half; | |
5115 | UQI tmp_byte1; | |
5116 | UQI tmp_byte0; | |
5117 | tmp_top_half = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 0); | |
5118 | tmp_byte1 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 2); | |
5119 | tmp_byte0 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3); | |
5120 | { | |
5121 | SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1)); | |
5122 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 5123 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
5124 | } |
5125 | } | |
5126 | ||
5127 | return vpc; | |
5128 | #undef FLD | |
5129 | } | |
5130 | ||
5131 | /* swapw-compact: swap.w $rm, $rn */ | |
5132 | ||
5133 | static SEM_PC | |
5134 | SEM_FN_NAME (sh64_compact,swapw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5135 | { | |
c7e628df | 5136 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
5137 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5138 | int UNUSED written = 0; | |
5139 | IADDR UNUSED pc = abuf->addr; | |
5140 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5141 | ||
5142 | { | |
5143 | SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rm)), 16), SLLSI (GET_H_GRC (FLD (f_rm)), 16)); | |
5144 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 5145 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
5146 | } |
5147 | ||
5148 | return vpc; | |
5149 | #undef FLD | |
5150 | } | |
5151 | ||
5152 | /* tasb-compact: tas.b @$rn */ | |
5153 | ||
5154 | static SEM_PC | |
5155 | SEM_FN_NAME (sh64_compact,tasb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5156 | { | |
5157 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
5158 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5159 | int UNUSED written = 0; | |
5160 | IADDR UNUSED pc = abuf->addr; | |
5161 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5162 | ||
5163 | { | |
5164 | UQI tmp_byte; | |
5165 | tmp_byte = GETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
5166 | { | |
5167 | BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0)); | |
5168 | SET_H_TBIT (opval); | |
5169 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
5170 | } | |
5171 | tmp_byte = ORQI (tmp_byte, 128); | |
5172 | { | |
5173 | UQI opval = tmp_byte; | |
5174 | SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
5175 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5176 | } | |
5177 | } | |
5178 | ||
5179 | return vpc; | |
5180 | #undef FLD | |
5181 | } | |
5182 | ||
5183 | /* trapa-compact: trapa #$uimm8 */ | |
5184 | ||
5185 | static SEM_PC | |
5186 | SEM_FN_NAME (sh64_compact,trapa_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5187 | { | |
5188 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
5189 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5190 | int UNUSED written = 0; | |
5191 | IADDR UNUSED pc = abuf->addr; | |
5192 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5193 | ||
5194 | sh64_compact_trapa (current_cpu, FLD (f_imm8), pc); | |
5195 | ||
5196 | return vpc; | |
5197 | #undef FLD | |
5198 | } | |
5199 | ||
5200 | /* tst-compact: tst $rm, $rn */ | |
5201 | ||
5202 | static SEM_PC | |
5203 | SEM_FN_NAME (sh64_compact,tst_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5204 | { | |
c7e628df | 5205 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
5206 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5207 | int UNUSED written = 0; | |
5208 | IADDR UNUSED pc = abuf->addr; | |
5209 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5210 | ||
5211 | { | |
5212 | BI opval = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))), 0)) ? (1) : (0)); | |
5213 | SET_H_TBIT (opval); | |
5214 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
5215 | } | |
5216 | ||
5217 | return vpc; | |
5218 | #undef FLD | |
5219 | } | |
5220 | ||
5221 | /* tsti-compact: tst #$uimm8, r0 */ | |
5222 | ||
5223 | static SEM_PC | |
5224 | SEM_FN_NAME (sh64_compact,tsti_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5225 | { | |
5226 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
5227 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5228 | int UNUSED written = 0; | |
5229 | IADDR UNUSED pc = abuf->addr; | |
5230 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5231 | ||
5232 | { | |
5233 | BI opval = ((EQSI (ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0)); | |
5234 | SET_H_TBIT (opval); | |
5235 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
5236 | } | |
5237 | ||
5238 | return vpc; | |
5239 | #undef FLD | |
5240 | } | |
5241 | ||
5242 | /* tstb-compact: tst.b #$imm8, @(r0, gbr) */ | |
5243 | ||
5244 | static SEM_PC | |
5245 | SEM_FN_NAME (sh64_compact,tstb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5246 | { | |
5247 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
5248 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5249 | int UNUSED written = 0; | |
5250 | IADDR UNUSED pc = abuf->addr; | |
5251 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5252 | ||
5253 | { | |
5254 | DI tmp_addr; | |
5255 | tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ()); | |
5256 | { | |
5257 | BI opval = ((EQQI (ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0)); | |
5258 | SET_H_TBIT (opval); | |
5259 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
5260 | } | |
5261 | } | |
5262 | ||
5263 | return vpc; | |
5264 | #undef FLD | |
5265 | } | |
5266 | ||
5267 | /* xor-compact: xor $rm64, $rn64 */ | |
5268 | ||
5269 | static SEM_PC | |
5270 | SEM_FN_NAME (sh64_compact,xor_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5271 | { | |
c7e628df | 5272 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
5273 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5274 | int UNUSED written = 0; | |
5275 | IADDR UNUSED pc = abuf->addr; | |
5276 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5277 | ||
5278 | { | |
5279 | DI opval = XORDI (GET_H_GR (FLD (f_rn)), GET_H_GR (FLD (f_rm))); | |
5280 | SET_H_GR (FLD (f_rn), opval); | |
c7e628df | 5281 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5282 | } |
5283 | ||
5284 | return vpc; | |
5285 | #undef FLD | |
5286 | } | |
5287 | ||
5288 | /* xori-compact: xor #$uimm8, r0 */ | |
5289 | ||
5290 | static SEM_PC | |
5291 | SEM_FN_NAME (sh64_compact,xori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5292 | { | |
5293 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
5294 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5295 | int UNUSED written = 0; | |
5296 | IADDR UNUSED pc = abuf->addr; | |
5297 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5298 | ||
5299 | { | |
c7e628df DB |
5300 | SI opval = XORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8))); |
5301 | SET_H_GRC (((UINT) 0), opval); | |
5302 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); | |
cbb38b47 BE |
5303 | } |
5304 | ||
5305 | return vpc; | |
5306 | #undef FLD | |
5307 | } | |
5308 | ||
5309 | /* xorb-compact: xor.b #$imm8, @(r0, gbr) */ | |
5310 | ||
5311 | static SEM_PC | |
5312 | SEM_FN_NAME (sh64_compact,xorb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5313 | { | |
5314 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
5315 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5316 | int UNUSED written = 0; | |
5317 | IADDR UNUSED pc = abuf->addr; | |
5318 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5319 | ||
5320 | { | |
5321 | DI tmp_addr; | |
5322 | UQI tmp_data; | |
5323 | tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ()); | |
5324 | tmp_data = XORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)); | |
5325 | { | |
5326 | UQI opval = tmp_data; | |
5327 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
5328 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5329 | } | |
5330 | } | |
5331 | ||
5332 | return vpc; | |
5333 | #undef FLD | |
5334 | } | |
5335 | ||
5336 | /* xtrct-compact: xtrct $rm, $rn */ | |
5337 | ||
5338 | static SEM_PC | |
5339 | SEM_FN_NAME (sh64_compact,xtrct_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5340 | { | |
c7e628df | 5341 | #define FLD(f) abuf->fields.sfmt_movl12_compact.f |
cbb38b47 BE |
5342 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5343 | int UNUSED written = 0; | |
5344 | IADDR UNUSED pc = abuf->addr; | |
5345 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5346 | ||
5347 | { | |
5348 | SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rm)), 16), SRLSI (GET_H_GRC (FLD (f_rn)), 16)); | |
5349 | SET_H_GRC (FLD (f_rn), opval); | |
c7e628df | 5350 | TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval); |
cbb38b47 BE |
5351 | } |
5352 | ||
5353 | return vpc; | |
5354 | #undef FLD | |
5355 | } | |
5356 | ||
5357 | /* Table of all semantic fns. */ | |
5358 | ||
5359 | static const struct sem_fn_desc sem_fns[] = { | |
5360 | { SH64_COMPACT_INSN_X_INVALID, SEM_FN_NAME (sh64_compact,x_invalid) }, | |
5361 | { SH64_COMPACT_INSN_X_AFTER, SEM_FN_NAME (sh64_compact,x_after) }, | |
5362 | { SH64_COMPACT_INSN_X_BEFORE, SEM_FN_NAME (sh64_compact,x_before) }, | |
5363 | { SH64_COMPACT_INSN_X_CTI_CHAIN, SEM_FN_NAME (sh64_compact,x_cti_chain) }, | |
5364 | { SH64_COMPACT_INSN_X_CHAIN, SEM_FN_NAME (sh64_compact,x_chain) }, | |
5365 | { SH64_COMPACT_INSN_X_BEGIN, SEM_FN_NAME (sh64_compact,x_begin) }, | |
5366 | { SH64_COMPACT_INSN_ADD_COMPACT, SEM_FN_NAME (sh64_compact,add_compact) }, | |
5367 | { SH64_COMPACT_INSN_ADDI_COMPACT, SEM_FN_NAME (sh64_compact,addi_compact) }, | |
5368 | { SH64_COMPACT_INSN_ADDC_COMPACT, SEM_FN_NAME (sh64_compact,addc_compact) }, | |
5369 | { SH64_COMPACT_INSN_ADDV_COMPACT, SEM_FN_NAME (sh64_compact,addv_compact) }, | |
5370 | { SH64_COMPACT_INSN_AND_COMPACT, SEM_FN_NAME (sh64_compact,and_compact) }, | |
5371 | { SH64_COMPACT_INSN_ANDI_COMPACT, SEM_FN_NAME (sh64_compact,andi_compact) }, | |
5372 | { SH64_COMPACT_INSN_ANDB_COMPACT, SEM_FN_NAME (sh64_compact,andb_compact) }, | |
5373 | { SH64_COMPACT_INSN_BF_COMPACT, SEM_FN_NAME (sh64_compact,bf_compact) }, | |
5374 | { SH64_COMPACT_INSN_BFS_COMPACT, SEM_FN_NAME (sh64_compact,bfs_compact) }, | |
5375 | { SH64_COMPACT_INSN_BRA_COMPACT, SEM_FN_NAME (sh64_compact,bra_compact) }, | |
5376 | { SH64_COMPACT_INSN_BRAF_COMPACT, SEM_FN_NAME (sh64_compact,braf_compact) }, | |
5377 | { SH64_COMPACT_INSN_BRK_COMPACT, SEM_FN_NAME (sh64_compact,brk_compact) }, | |
5378 | { SH64_COMPACT_INSN_BSR_COMPACT, SEM_FN_NAME (sh64_compact,bsr_compact) }, | |
5379 | { SH64_COMPACT_INSN_BSRF_COMPACT, SEM_FN_NAME (sh64_compact,bsrf_compact) }, | |
5380 | { SH64_COMPACT_INSN_BT_COMPACT, SEM_FN_NAME (sh64_compact,bt_compact) }, | |
5381 | { SH64_COMPACT_INSN_BTS_COMPACT, SEM_FN_NAME (sh64_compact,bts_compact) }, | |
5382 | { SH64_COMPACT_INSN_CLRMAC_COMPACT, SEM_FN_NAME (sh64_compact,clrmac_compact) }, | |
5383 | { SH64_COMPACT_INSN_CLRS_COMPACT, SEM_FN_NAME (sh64_compact,clrs_compact) }, | |
5384 | { SH64_COMPACT_INSN_CLRT_COMPACT, SEM_FN_NAME (sh64_compact,clrt_compact) }, | |
5385 | { SH64_COMPACT_INSN_CMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,cmpeq_compact) }, | |
5386 | { SH64_COMPACT_INSN_CMPEQI_COMPACT, SEM_FN_NAME (sh64_compact,cmpeqi_compact) }, | |
5387 | { SH64_COMPACT_INSN_CMPGE_COMPACT, SEM_FN_NAME (sh64_compact,cmpge_compact) }, | |
5388 | { SH64_COMPACT_INSN_CMPGT_COMPACT, SEM_FN_NAME (sh64_compact,cmpgt_compact) }, | |
5389 | { SH64_COMPACT_INSN_CMPHI_COMPACT, SEM_FN_NAME (sh64_compact,cmphi_compact) }, | |
5390 | { SH64_COMPACT_INSN_CMPHS_COMPACT, SEM_FN_NAME (sh64_compact,cmphs_compact) }, | |
5391 | { SH64_COMPACT_INSN_CMPPL_COMPACT, SEM_FN_NAME (sh64_compact,cmppl_compact) }, | |
5392 | { SH64_COMPACT_INSN_CMPPZ_COMPACT, SEM_FN_NAME (sh64_compact,cmppz_compact) }, | |
5393 | { SH64_COMPACT_INSN_CMPSTR_COMPACT, SEM_FN_NAME (sh64_compact,cmpstr_compact) }, | |
5394 | { SH64_COMPACT_INSN_DIV0S_COMPACT, SEM_FN_NAME (sh64_compact,div0s_compact) }, | |
5395 | { SH64_COMPACT_INSN_DIV0U_COMPACT, SEM_FN_NAME (sh64_compact,div0u_compact) }, | |
5396 | { SH64_COMPACT_INSN_DIV1_COMPACT, SEM_FN_NAME (sh64_compact,div1_compact) }, | |
c7e628df DB |
5397 | { SH64_COMPACT_INSN_DIVU_COMPACT, SEM_FN_NAME (sh64_compact,divu_compact) }, |
5398 | { SH64_COMPACT_INSN_MULR_COMPACT, SEM_FN_NAME (sh64_compact,mulr_compact) }, | |
cbb38b47 BE |
5399 | { SH64_COMPACT_INSN_DMULSL_COMPACT, SEM_FN_NAME (sh64_compact,dmulsl_compact) }, |
5400 | { SH64_COMPACT_INSN_DMULUL_COMPACT, SEM_FN_NAME (sh64_compact,dmulul_compact) }, | |
5401 | { SH64_COMPACT_INSN_DT_COMPACT, SEM_FN_NAME (sh64_compact,dt_compact) }, | |
5402 | { SH64_COMPACT_INSN_EXTSB_COMPACT, SEM_FN_NAME (sh64_compact,extsb_compact) }, | |
5403 | { SH64_COMPACT_INSN_EXTSW_COMPACT, SEM_FN_NAME (sh64_compact,extsw_compact) }, | |
5404 | { SH64_COMPACT_INSN_EXTUB_COMPACT, SEM_FN_NAME (sh64_compact,extub_compact) }, | |
5405 | { SH64_COMPACT_INSN_EXTUW_COMPACT, SEM_FN_NAME (sh64_compact,extuw_compact) }, | |
5406 | { SH64_COMPACT_INSN_FABS_COMPACT, SEM_FN_NAME (sh64_compact,fabs_compact) }, | |
5407 | { SH64_COMPACT_INSN_FADD_COMPACT, SEM_FN_NAME (sh64_compact,fadd_compact) }, | |
5408 | { SH64_COMPACT_INSN_FCMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,fcmpeq_compact) }, | |
5409 | { SH64_COMPACT_INSN_FCMPGT_COMPACT, SEM_FN_NAME (sh64_compact,fcmpgt_compact) }, | |
5410 | { SH64_COMPACT_INSN_FCNVDS_COMPACT, SEM_FN_NAME (sh64_compact,fcnvds_compact) }, | |
5411 | { SH64_COMPACT_INSN_FCNVSD_COMPACT, SEM_FN_NAME (sh64_compact,fcnvsd_compact) }, | |
5412 | { SH64_COMPACT_INSN_FDIV_COMPACT, SEM_FN_NAME (sh64_compact,fdiv_compact) }, | |
5413 | { SH64_COMPACT_INSN_FIPR_COMPACT, SEM_FN_NAME (sh64_compact,fipr_compact) }, | |
5414 | { SH64_COMPACT_INSN_FLDS_COMPACT, SEM_FN_NAME (sh64_compact,flds_compact) }, | |
5415 | { SH64_COMPACT_INSN_FLDI0_COMPACT, SEM_FN_NAME (sh64_compact,fldi0_compact) }, | |
5416 | { SH64_COMPACT_INSN_FLDI1_COMPACT, SEM_FN_NAME (sh64_compact,fldi1_compact) }, | |
5417 | { SH64_COMPACT_INSN_FLOAT_COMPACT, SEM_FN_NAME (sh64_compact,float_compact) }, | |
5418 | { SH64_COMPACT_INSN_FMAC_COMPACT, SEM_FN_NAME (sh64_compact,fmac_compact) }, | |
5419 | { SH64_COMPACT_INSN_FMOV1_COMPACT, SEM_FN_NAME (sh64_compact,fmov1_compact) }, | |
5420 | { SH64_COMPACT_INSN_FMOV2_COMPACT, SEM_FN_NAME (sh64_compact,fmov2_compact) }, | |
5421 | { SH64_COMPACT_INSN_FMOV3_COMPACT, SEM_FN_NAME (sh64_compact,fmov3_compact) }, | |
5422 | { SH64_COMPACT_INSN_FMOV4_COMPACT, SEM_FN_NAME (sh64_compact,fmov4_compact) }, | |
5423 | { SH64_COMPACT_INSN_FMOV5_COMPACT, SEM_FN_NAME (sh64_compact,fmov5_compact) }, | |
5424 | { SH64_COMPACT_INSN_FMOV6_COMPACT, SEM_FN_NAME (sh64_compact,fmov6_compact) }, | |
5425 | { SH64_COMPACT_INSN_FMOV7_COMPACT, SEM_FN_NAME (sh64_compact,fmov7_compact) }, | |
c7e628df DB |
5426 | { SH64_COMPACT_INSN_FMOV8_COMPACT, SEM_FN_NAME (sh64_compact,fmov8_compact) }, |
5427 | { SH64_COMPACT_INSN_FMOV9_COMPACT, SEM_FN_NAME (sh64_compact,fmov9_compact) }, | |
cbb38b47 BE |
5428 | { SH64_COMPACT_INSN_FMUL_COMPACT, SEM_FN_NAME (sh64_compact,fmul_compact) }, |
5429 | { SH64_COMPACT_INSN_FNEG_COMPACT, SEM_FN_NAME (sh64_compact,fneg_compact) }, | |
5430 | { SH64_COMPACT_INSN_FRCHG_COMPACT, SEM_FN_NAME (sh64_compact,frchg_compact) }, | |
5431 | { SH64_COMPACT_INSN_FSCHG_COMPACT, SEM_FN_NAME (sh64_compact,fschg_compact) }, | |
5432 | { SH64_COMPACT_INSN_FSQRT_COMPACT, SEM_FN_NAME (sh64_compact,fsqrt_compact) }, | |
5433 | { SH64_COMPACT_INSN_FSTS_COMPACT, SEM_FN_NAME (sh64_compact,fsts_compact) }, | |
5434 | { SH64_COMPACT_INSN_FSUB_COMPACT, SEM_FN_NAME (sh64_compact,fsub_compact) }, | |
5435 | { SH64_COMPACT_INSN_FTRC_COMPACT, SEM_FN_NAME (sh64_compact,ftrc_compact) }, | |
5436 | { SH64_COMPACT_INSN_FTRV_COMPACT, SEM_FN_NAME (sh64_compact,ftrv_compact) }, | |
5437 | { SH64_COMPACT_INSN_JMP_COMPACT, SEM_FN_NAME (sh64_compact,jmp_compact) }, | |
5438 | { SH64_COMPACT_INSN_JSR_COMPACT, SEM_FN_NAME (sh64_compact,jsr_compact) }, | |
c7e628df DB |
5439 | { SH64_COMPACT_INSN_LDC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_gbr_compact) }, |
5440 | { SH64_COMPACT_INSN_LDC_VBR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_vbr_compact) }, | |
5441 | { SH64_COMPACT_INSN_LDC_SR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_sr_compact) }, | |
5442 | { SH64_COMPACT_INSN_LDCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_gbr_compact) }, | |
5443 | { SH64_COMPACT_INSN_LDCL_VBR_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_vbr_compact) }, | |
cbb38b47 BE |
5444 | { SH64_COMPACT_INSN_LDS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpscr_compact) }, |
5445 | { SH64_COMPACT_INSN_LDSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) }, | |
5446 | { SH64_COMPACT_INSN_LDS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpul_compact) }, | |
5447 | { SH64_COMPACT_INSN_LDSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) }, | |
5448 | { SH64_COMPACT_INSN_LDS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,lds_mach_compact) }, | |
5449 | { SH64_COMPACT_INSN_LDSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_mach_compact) }, | |
5450 | { SH64_COMPACT_INSN_LDS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,lds_macl_compact) }, | |
5451 | { SH64_COMPACT_INSN_LDSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_macl_compact) }, | |
5452 | { SH64_COMPACT_INSN_LDS_PR_COMPACT, SEM_FN_NAME (sh64_compact,lds_pr_compact) }, | |
5453 | { SH64_COMPACT_INSN_LDSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_pr_compact) }, | |
5454 | { SH64_COMPACT_INSN_MACL_COMPACT, SEM_FN_NAME (sh64_compact,macl_compact) }, | |
5455 | { SH64_COMPACT_INSN_MACW_COMPACT, SEM_FN_NAME (sh64_compact,macw_compact) }, | |
5456 | { SH64_COMPACT_INSN_MOV_COMPACT, SEM_FN_NAME (sh64_compact,mov_compact) }, | |
5457 | { SH64_COMPACT_INSN_MOVI_COMPACT, SEM_FN_NAME (sh64_compact,movi_compact) }, | |
c7e628df | 5458 | { SH64_COMPACT_INSN_MOVI20_COMPACT, SEM_FN_NAME (sh64_compact,movi20_compact) }, |
cbb38b47 BE |
5459 | { SH64_COMPACT_INSN_MOVB1_COMPACT, SEM_FN_NAME (sh64_compact,movb1_compact) }, |
5460 | { SH64_COMPACT_INSN_MOVB2_COMPACT, SEM_FN_NAME (sh64_compact,movb2_compact) }, | |
5461 | { SH64_COMPACT_INSN_MOVB3_COMPACT, SEM_FN_NAME (sh64_compact,movb3_compact) }, | |
5462 | { SH64_COMPACT_INSN_MOVB4_COMPACT, SEM_FN_NAME (sh64_compact,movb4_compact) }, | |
5463 | { SH64_COMPACT_INSN_MOVB5_COMPACT, SEM_FN_NAME (sh64_compact,movb5_compact) }, | |
5464 | { SH64_COMPACT_INSN_MOVB6_COMPACT, SEM_FN_NAME (sh64_compact,movb6_compact) }, | |
5465 | { SH64_COMPACT_INSN_MOVB7_COMPACT, SEM_FN_NAME (sh64_compact,movb7_compact) }, | |
5466 | { SH64_COMPACT_INSN_MOVB8_COMPACT, SEM_FN_NAME (sh64_compact,movb8_compact) }, | |
5467 | { SH64_COMPACT_INSN_MOVB9_COMPACT, SEM_FN_NAME (sh64_compact,movb9_compact) }, | |
5468 | { SH64_COMPACT_INSN_MOVB10_COMPACT, SEM_FN_NAME (sh64_compact,movb10_compact) }, | |
5469 | { SH64_COMPACT_INSN_MOVL1_COMPACT, SEM_FN_NAME (sh64_compact,movl1_compact) }, | |
5470 | { SH64_COMPACT_INSN_MOVL2_COMPACT, SEM_FN_NAME (sh64_compact,movl2_compact) }, | |
5471 | { SH64_COMPACT_INSN_MOVL3_COMPACT, SEM_FN_NAME (sh64_compact,movl3_compact) }, | |
5472 | { SH64_COMPACT_INSN_MOVL4_COMPACT, SEM_FN_NAME (sh64_compact,movl4_compact) }, | |
5473 | { SH64_COMPACT_INSN_MOVL5_COMPACT, SEM_FN_NAME (sh64_compact,movl5_compact) }, | |
5474 | { SH64_COMPACT_INSN_MOVL6_COMPACT, SEM_FN_NAME (sh64_compact,movl6_compact) }, | |
5475 | { SH64_COMPACT_INSN_MOVL7_COMPACT, SEM_FN_NAME (sh64_compact,movl7_compact) }, | |
5476 | { SH64_COMPACT_INSN_MOVL8_COMPACT, SEM_FN_NAME (sh64_compact,movl8_compact) }, | |
5477 | { SH64_COMPACT_INSN_MOVL9_COMPACT, SEM_FN_NAME (sh64_compact,movl9_compact) }, | |
5478 | { SH64_COMPACT_INSN_MOVL10_COMPACT, SEM_FN_NAME (sh64_compact,movl10_compact) }, | |
5479 | { SH64_COMPACT_INSN_MOVL11_COMPACT, SEM_FN_NAME (sh64_compact,movl11_compact) }, | |
c7e628df DB |
5480 | { SH64_COMPACT_INSN_MOVL12_COMPACT, SEM_FN_NAME (sh64_compact,movl12_compact) }, |
5481 | { SH64_COMPACT_INSN_MOVL13_COMPACT, SEM_FN_NAME (sh64_compact,movl13_compact) }, | |
cbb38b47 BE |
5482 | { SH64_COMPACT_INSN_MOVW1_COMPACT, SEM_FN_NAME (sh64_compact,movw1_compact) }, |
5483 | { SH64_COMPACT_INSN_MOVW2_COMPACT, SEM_FN_NAME (sh64_compact,movw2_compact) }, | |
5484 | { SH64_COMPACT_INSN_MOVW3_COMPACT, SEM_FN_NAME (sh64_compact,movw3_compact) }, | |
5485 | { SH64_COMPACT_INSN_MOVW4_COMPACT, SEM_FN_NAME (sh64_compact,movw4_compact) }, | |
5486 | { SH64_COMPACT_INSN_MOVW5_COMPACT, SEM_FN_NAME (sh64_compact,movw5_compact) }, | |
5487 | { SH64_COMPACT_INSN_MOVW6_COMPACT, SEM_FN_NAME (sh64_compact,movw6_compact) }, | |
5488 | { SH64_COMPACT_INSN_MOVW7_COMPACT, SEM_FN_NAME (sh64_compact,movw7_compact) }, | |
5489 | { SH64_COMPACT_INSN_MOVW8_COMPACT, SEM_FN_NAME (sh64_compact,movw8_compact) }, | |
5490 | { SH64_COMPACT_INSN_MOVW9_COMPACT, SEM_FN_NAME (sh64_compact,movw9_compact) }, | |
5491 | { SH64_COMPACT_INSN_MOVW10_COMPACT, SEM_FN_NAME (sh64_compact,movw10_compact) }, | |
5492 | { SH64_COMPACT_INSN_MOVW11_COMPACT, SEM_FN_NAME (sh64_compact,movw11_compact) }, | |
5493 | { SH64_COMPACT_INSN_MOVA_COMPACT, SEM_FN_NAME (sh64_compact,mova_compact) }, | |
5494 | { SH64_COMPACT_INSN_MOVCAL_COMPACT, SEM_FN_NAME (sh64_compact,movcal_compact) }, | |
c7e628df | 5495 | { SH64_COMPACT_INSN_MOVCOL_COMPACT, SEM_FN_NAME (sh64_compact,movcol_compact) }, |
cbb38b47 | 5496 | { SH64_COMPACT_INSN_MOVT_COMPACT, SEM_FN_NAME (sh64_compact,movt_compact) }, |
c7e628df DB |
5497 | { SH64_COMPACT_INSN_MOVUAL_COMPACT, SEM_FN_NAME (sh64_compact,movual_compact) }, |
5498 | { SH64_COMPACT_INSN_MOVUAL2_COMPACT, SEM_FN_NAME (sh64_compact,movual2_compact) }, | |
cbb38b47 BE |
5499 | { SH64_COMPACT_INSN_MULL_COMPACT, SEM_FN_NAME (sh64_compact,mull_compact) }, |
5500 | { SH64_COMPACT_INSN_MULSW_COMPACT, SEM_FN_NAME (sh64_compact,mulsw_compact) }, | |
5501 | { SH64_COMPACT_INSN_MULUW_COMPACT, SEM_FN_NAME (sh64_compact,muluw_compact) }, | |
5502 | { SH64_COMPACT_INSN_NEG_COMPACT, SEM_FN_NAME (sh64_compact,neg_compact) }, | |
5503 | { SH64_COMPACT_INSN_NEGC_COMPACT, SEM_FN_NAME (sh64_compact,negc_compact) }, | |
5504 | { SH64_COMPACT_INSN_NOP_COMPACT, SEM_FN_NAME (sh64_compact,nop_compact) }, | |
5505 | { SH64_COMPACT_INSN_NOT_COMPACT, SEM_FN_NAME (sh64_compact,not_compact) }, | |
5506 | { SH64_COMPACT_INSN_OCBI_COMPACT, SEM_FN_NAME (sh64_compact,ocbi_compact) }, | |
5507 | { SH64_COMPACT_INSN_OCBP_COMPACT, SEM_FN_NAME (sh64_compact,ocbp_compact) }, | |
5508 | { SH64_COMPACT_INSN_OCBWB_COMPACT, SEM_FN_NAME (sh64_compact,ocbwb_compact) }, | |
5509 | { SH64_COMPACT_INSN_OR_COMPACT, SEM_FN_NAME (sh64_compact,or_compact) }, | |
5510 | { SH64_COMPACT_INSN_ORI_COMPACT, SEM_FN_NAME (sh64_compact,ori_compact) }, | |
5511 | { SH64_COMPACT_INSN_ORB_COMPACT, SEM_FN_NAME (sh64_compact,orb_compact) }, | |
5512 | { SH64_COMPACT_INSN_PREF_COMPACT, SEM_FN_NAME (sh64_compact,pref_compact) }, | |
5513 | { SH64_COMPACT_INSN_ROTCL_COMPACT, SEM_FN_NAME (sh64_compact,rotcl_compact) }, | |
5514 | { SH64_COMPACT_INSN_ROTCR_COMPACT, SEM_FN_NAME (sh64_compact,rotcr_compact) }, | |
5515 | { SH64_COMPACT_INSN_ROTL_COMPACT, SEM_FN_NAME (sh64_compact,rotl_compact) }, | |
5516 | { SH64_COMPACT_INSN_ROTR_COMPACT, SEM_FN_NAME (sh64_compact,rotr_compact) }, | |
5517 | { SH64_COMPACT_INSN_RTS_COMPACT, SEM_FN_NAME (sh64_compact,rts_compact) }, | |
5518 | { SH64_COMPACT_INSN_SETS_COMPACT, SEM_FN_NAME (sh64_compact,sets_compact) }, | |
5519 | { SH64_COMPACT_INSN_SETT_COMPACT, SEM_FN_NAME (sh64_compact,sett_compact) }, | |
5520 | { SH64_COMPACT_INSN_SHAD_COMPACT, SEM_FN_NAME (sh64_compact,shad_compact) }, | |
5521 | { SH64_COMPACT_INSN_SHAL_COMPACT, SEM_FN_NAME (sh64_compact,shal_compact) }, | |
5522 | { SH64_COMPACT_INSN_SHAR_COMPACT, SEM_FN_NAME (sh64_compact,shar_compact) }, | |
5523 | { SH64_COMPACT_INSN_SHLD_COMPACT, SEM_FN_NAME (sh64_compact,shld_compact) }, | |
5524 | { SH64_COMPACT_INSN_SHLL_COMPACT, SEM_FN_NAME (sh64_compact,shll_compact) }, | |
5525 | { SH64_COMPACT_INSN_SHLL2_COMPACT, SEM_FN_NAME (sh64_compact,shll2_compact) }, | |
5526 | { SH64_COMPACT_INSN_SHLL8_COMPACT, SEM_FN_NAME (sh64_compact,shll8_compact) }, | |
5527 | { SH64_COMPACT_INSN_SHLL16_COMPACT, SEM_FN_NAME (sh64_compact,shll16_compact) }, | |
5528 | { SH64_COMPACT_INSN_SHLR_COMPACT, SEM_FN_NAME (sh64_compact,shlr_compact) }, | |
5529 | { SH64_COMPACT_INSN_SHLR2_COMPACT, SEM_FN_NAME (sh64_compact,shlr2_compact) }, | |
5530 | { SH64_COMPACT_INSN_SHLR8_COMPACT, SEM_FN_NAME (sh64_compact,shlr8_compact) }, | |
5531 | { SH64_COMPACT_INSN_SHLR16_COMPACT, SEM_FN_NAME (sh64_compact,shlr16_compact) }, | |
5532 | { SH64_COMPACT_INSN_STC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_gbr_compact) }, | |
c7e628df | 5533 | { SH64_COMPACT_INSN_STC_VBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_vbr_compact) }, |
cbb38b47 | 5534 | { SH64_COMPACT_INSN_STCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_gbr_compact) }, |
c7e628df | 5535 | { SH64_COMPACT_INSN_STCL_VBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_vbr_compact) }, |
cbb38b47 BE |
5536 | { SH64_COMPACT_INSN_STS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpscr_compact) }, |
5537 | { SH64_COMPACT_INSN_STSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) }, | |
5538 | { SH64_COMPACT_INSN_STS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpul_compact) }, | |
5539 | { SH64_COMPACT_INSN_STSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpul_compact) }, | |
5540 | { SH64_COMPACT_INSN_STS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,sts_mach_compact) }, | |
5541 | { SH64_COMPACT_INSN_STSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,stsl_mach_compact) }, | |
5542 | { SH64_COMPACT_INSN_STS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,sts_macl_compact) }, | |
5543 | { SH64_COMPACT_INSN_STSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_macl_compact) }, | |
5544 | { SH64_COMPACT_INSN_STS_PR_COMPACT, SEM_FN_NAME (sh64_compact,sts_pr_compact) }, | |
5545 | { SH64_COMPACT_INSN_STSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_pr_compact) }, | |
5546 | { SH64_COMPACT_INSN_SUB_COMPACT, SEM_FN_NAME (sh64_compact,sub_compact) }, | |
5547 | { SH64_COMPACT_INSN_SUBC_COMPACT, SEM_FN_NAME (sh64_compact,subc_compact) }, | |
5548 | { SH64_COMPACT_INSN_SUBV_COMPACT, SEM_FN_NAME (sh64_compact,subv_compact) }, | |
5549 | { SH64_COMPACT_INSN_SWAPB_COMPACT, SEM_FN_NAME (sh64_compact,swapb_compact) }, | |
5550 | { SH64_COMPACT_INSN_SWAPW_COMPACT, SEM_FN_NAME (sh64_compact,swapw_compact) }, | |
5551 | { SH64_COMPACT_INSN_TASB_COMPACT, SEM_FN_NAME (sh64_compact,tasb_compact) }, | |
5552 | { SH64_COMPACT_INSN_TRAPA_COMPACT, SEM_FN_NAME (sh64_compact,trapa_compact) }, | |
5553 | { SH64_COMPACT_INSN_TST_COMPACT, SEM_FN_NAME (sh64_compact,tst_compact) }, | |
5554 | { SH64_COMPACT_INSN_TSTI_COMPACT, SEM_FN_NAME (sh64_compact,tsti_compact) }, | |
5555 | { SH64_COMPACT_INSN_TSTB_COMPACT, SEM_FN_NAME (sh64_compact,tstb_compact) }, | |
5556 | { SH64_COMPACT_INSN_XOR_COMPACT, SEM_FN_NAME (sh64_compact,xor_compact) }, | |
5557 | { SH64_COMPACT_INSN_XORI_COMPACT, SEM_FN_NAME (sh64_compact,xori_compact) }, | |
5558 | { SH64_COMPACT_INSN_XORB_COMPACT, SEM_FN_NAME (sh64_compact,xorb_compact) }, | |
5559 | { SH64_COMPACT_INSN_XTRCT_COMPACT, SEM_FN_NAME (sh64_compact,xtrct_compact) }, | |
5560 | { 0, 0 } | |
5561 | }; | |
5562 | ||
5563 | /* Add the semantic fns to IDESC_TABLE. */ | |
5564 | ||
5565 | void | |
5566 | SEM_FN_NAME (sh64_compact,init_idesc_table) (SIM_CPU *current_cpu) | |
5567 | { | |
5568 | IDESC *idesc_table = CPU_IDESC (current_cpu); | |
5569 | const struct sem_fn_desc *sf; | |
5570 | int mach_num = MACH_NUM (CPU_MACH (current_cpu)); | |
5571 | ||
5572 | for (sf = &sem_fns[0]; sf->fn != 0; ++sf) | |
5573 | { | |
5574 | const CGEN_INSN *insn = idesc_table[sf->index].idata; | |
5575 | int valid_p = (CGEN_INSN_VIRTUAL_P (insn) | |
5576 | || CGEN_INSN_MACH_HAS_P (insn, mach_num)); | |
5577 | #if FAST_P | |
5578 | if (valid_p) | |
5579 | idesc_table[sf->index].sem_fast = sf->fn; | |
5580 | else | |
5581 | idesc_table[sf->index].sem_fast = SEM_FN_NAME (sh64_compact,x_invalid); | |
5582 | #else | |
5583 | if (valid_p) | |
5584 | idesc_table[sf->index].sem_full = sf->fn; | |
5585 | else | |
5586 | idesc_table[sf->index].sem_full = SEM_FN_NAME (sh64_compact,x_invalid); | |
5587 | #endif | |
5588 | } | |
5589 | } | |
5590 |