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