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 | |
1bbd6057 | 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_media,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_media,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_MEDIA | |
85 | sh64_media_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_media,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_MEDIA | |
106 | sh64_media_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_media,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_MEDIA | |
127 | #ifdef DEFINE_SWITCH | |
128 | vpc = sh64_media_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_media_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_media,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_MEDIA | |
157 | vpc = sh64_media_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_media,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_MEDIA | |
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_media_pbb_begin (current_cpu, FAST_P); | |
185 | #else | |
186 | #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */ | |
187 | vpc = sh64_media_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu))); | |
188 | #else | |
189 | vpc = sh64_media_pbb_begin (current_cpu, 0); | |
190 | #endif | |
191 | #endif | |
192 | #endif | |
193 | } | |
194 | ||
195 | return vpc; | |
196 | #undef FLD | |
197 | } | |
198 | ||
199 | /* add: add $rm, $rn, $rd */ | |
200 | ||
201 | static SEM_PC | |
202 | SEM_FN_NAME (sh64_media,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
203 | { | |
204 | #define FLD(f) abuf->fields.sfmt_add.f | |
205 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
206 | int UNUSED written = 0; | |
207 | IADDR UNUSED pc = abuf->addr; | |
208 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
209 | ||
210 | { | |
211 | DI opval = ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))); | |
212 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 213 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
214 | } |
215 | ||
216 | return vpc; | |
217 | #undef FLD | |
218 | } | |
219 | ||
220 | /* addl: add.l $rm, $rn, $rd */ | |
221 | ||
222 | static SEM_PC | |
223 | SEM_FN_NAME (sh64_media,addl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
224 | { | |
225 | #define FLD(f) abuf->fields.sfmt_add.f | |
226 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
227 | int UNUSED written = 0; | |
228 | IADDR UNUSED pc = abuf->addr; | |
229 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
230 | ||
231 | { | |
232 | DI opval = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)); | |
233 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 234 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
235 | } |
236 | ||
237 | return vpc; | |
238 | #undef FLD | |
239 | } | |
240 | ||
241 | /* addi: addi $rm, $disp10, $rd */ | |
242 | ||
243 | static SEM_PC | |
244 | SEM_FN_NAME (sh64_media,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
245 | { | |
246 | #define FLD(f) abuf->fields.sfmt_addi.f | |
247 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
248 | int UNUSED written = 0; | |
249 | IADDR UNUSED pc = abuf->addr; | |
250 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
251 | ||
252 | { | |
253 | DI opval = ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10))); | |
254 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 255 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
256 | } |
257 | ||
258 | return vpc; | |
259 | #undef FLD | |
260 | } | |
261 | ||
262 | /* addil: addi.l $rm, $disp10, $rd */ | |
263 | ||
264 | static SEM_PC | |
265 | SEM_FN_NAME (sh64_media,addil) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
266 | { | |
267 | #define FLD(f) abuf->fields.sfmt_addi.f | |
268 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
269 | int UNUSED written = 0; | |
270 | IADDR UNUSED pc = abuf->addr; | |
271 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
272 | ||
273 | { | |
274 | DI opval = EXTSIDI (ADDSI (EXTSISI (FLD (f_disp10)), SUBWORDDISI (GET_H_GR (FLD (f_left)), 1))); | |
275 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 276 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
277 | } |
278 | ||
279 | return vpc; | |
280 | #undef FLD | |
281 | } | |
282 | ||
283 | /* addzl: addz.l $rm, $rn, $rd */ | |
284 | ||
285 | static SEM_PC | |
286 | SEM_FN_NAME (sh64_media,addzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
287 | { | |
288 | #define FLD(f) abuf->fields.sfmt_add.f | |
289 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
290 | int UNUSED written = 0; | |
291 | IADDR UNUSED pc = abuf->addr; | |
292 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
293 | ||
294 | { | |
295 | DI opval = ZEXTSIDI (ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))); | |
296 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 297 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
298 | } |
299 | ||
300 | return vpc; | |
301 | #undef FLD | |
302 | } | |
303 | ||
304 | /* alloco: alloco $rm, $disp6x32 */ | |
305 | ||
306 | static SEM_PC | |
307 | SEM_FN_NAME (sh64_media,alloco) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
308 | { | |
c7e628df | 309 | #define FLD(f) abuf->fields.sfmt_xori.f |
cbb38b47 BE |
310 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
311 | int UNUSED written = 0; | |
312 | IADDR UNUSED pc = abuf->addr; | |
313 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
314 | ||
c7e628df DB |
315 | { |
316 | { | |
317 | DI opval = GET_H_GR (FLD (f_left)); | |
318 | SET_H_GR (FLD (f_left), opval); | |
319 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
320 | } | |
cbb38b47 | 321 | ((void) 0); /*nop*/ |
c7e628df | 322 | } |
cbb38b47 BE |
323 | |
324 | return vpc; | |
325 | #undef FLD | |
326 | } | |
327 | ||
328 | /* and: and $rm, $rn, $rd */ | |
329 | ||
330 | static SEM_PC | |
331 | SEM_FN_NAME (sh64_media,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
332 | { | |
333 | #define FLD(f) abuf->fields.sfmt_add.f | |
334 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
335 | int UNUSED written = 0; | |
336 | IADDR UNUSED pc = abuf->addr; | |
337 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
338 | ||
339 | { | |
340 | DI opval = ANDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))); | |
341 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 342 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
343 | } |
344 | ||
345 | return vpc; | |
346 | #undef FLD | |
347 | } | |
348 | ||
349 | /* andc: andc $rm, $rn, $rd */ | |
350 | ||
351 | static SEM_PC | |
352 | SEM_FN_NAME (sh64_media,andc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
353 | { | |
354 | #define FLD(f) abuf->fields.sfmt_add.f | |
355 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
356 | int UNUSED written = 0; | |
357 | IADDR UNUSED pc = abuf->addr; | |
358 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
359 | ||
360 | { | |
361 | DI opval = ANDDI (GET_H_GR (FLD (f_left)), INVDI (GET_H_GR (FLD (f_right)))); | |
362 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 363 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
364 | } |
365 | ||
366 | return vpc; | |
367 | #undef FLD | |
368 | } | |
369 | ||
370 | /* andi: andi $rm, $disp10, $rd */ | |
371 | ||
372 | static SEM_PC | |
373 | SEM_FN_NAME (sh64_media,andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
374 | { | |
375 | #define FLD(f) abuf->fields.sfmt_addi.f | |
376 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
377 | int UNUSED written = 0; | |
378 | IADDR UNUSED pc = abuf->addr; | |
379 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
380 | ||
381 | { | |
382 | DI opval = ANDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10))); | |
383 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 384 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
385 | } |
386 | ||
387 | return vpc; | |
388 | #undef FLD | |
389 | } | |
390 | ||
391 | /* beq: beq$likely $rm, $rn, $tra */ | |
392 | ||
393 | static SEM_PC | |
394 | SEM_FN_NAME (sh64_media,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
395 | { | |
396 | #define FLD(f) abuf->fields.sfmt_beq.f | |
397 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
398 | int UNUSED written = 0; | |
399 | IADDR UNUSED pc = abuf->addr; | |
400 | SEM_BRANCH_INIT | |
401 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
402 | ||
c7e628df DB |
403 | { |
404 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
405 | if (EQDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) { |
406 | { | |
407 | UDI opval = CPU (h_tr[FLD (f_tra)]); | |
408 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
409 | written |= (1 << 3); | |
410 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
411 | } | |
c7e628df | 412 | } |
cbb38b47 BE |
413 | } |
414 | ||
415 | abuf->written = written; | |
416 | SEM_BRANCH_FINI (vpc); | |
417 | return vpc; | |
418 | #undef FLD | |
419 | } | |
420 | ||
421 | /* beqi: beqi$likely $rm, $imm6, $tra */ | |
422 | ||
423 | static SEM_PC | |
424 | SEM_FN_NAME (sh64_media,beqi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
425 | { | |
426 | #define FLD(f) abuf->fields.sfmt_beqi.f | |
427 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
428 | int UNUSED written = 0; | |
429 | IADDR UNUSED pc = abuf->addr; | |
430 | SEM_BRANCH_INIT | |
431 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
432 | ||
c7e628df DB |
433 | { |
434 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
435 | if (EQDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6)))) { |
436 | { | |
437 | UDI opval = CPU (h_tr[FLD (f_tra)]); | |
438 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
439 | written |= (1 << 3); | |
440 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
441 | } | |
c7e628df | 442 | } |
cbb38b47 BE |
443 | } |
444 | ||
445 | abuf->written = written; | |
446 | SEM_BRANCH_FINI (vpc); | |
447 | return vpc; | |
448 | #undef FLD | |
449 | } | |
450 | ||
451 | /* bge: bge$likely $rm, $rn, $tra */ | |
452 | ||
453 | static SEM_PC | |
454 | SEM_FN_NAME (sh64_media,bge) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
455 | { | |
456 | #define FLD(f) abuf->fields.sfmt_beq.f | |
457 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
458 | int UNUSED written = 0; | |
459 | IADDR UNUSED pc = abuf->addr; | |
460 | SEM_BRANCH_INIT | |
461 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
462 | ||
c7e628df DB |
463 | { |
464 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
465 | if (GEDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) { |
466 | { | |
467 | UDI opval = CPU (h_tr[FLD (f_tra)]); | |
468 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
469 | written |= (1 << 3); | |
470 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
471 | } | |
c7e628df | 472 | } |
cbb38b47 BE |
473 | } |
474 | ||
475 | abuf->written = written; | |
476 | SEM_BRANCH_FINI (vpc); | |
477 | return vpc; | |
478 | #undef FLD | |
479 | } | |
480 | ||
481 | /* bgeu: bgeu$likely $rm, $rn, $tra */ | |
482 | ||
483 | static SEM_PC | |
484 | SEM_FN_NAME (sh64_media,bgeu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
485 | { | |
486 | #define FLD(f) abuf->fields.sfmt_beq.f | |
487 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
488 | int UNUSED written = 0; | |
489 | IADDR UNUSED pc = abuf->addr; | |
490 | SEM_BRANCH_INIT | |
491 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
492 | ||
c7e628df DB |
493 | { |
494 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
495 | if (GEUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) { |
496 | { | |
497 | UDI opval = CPU (h_tr[FLD (f_tra)]); | |
498 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
499 | written |= (1 << 3); | |
500 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
501 | } | |
c7e628df | 502 | } |
cbb38b47 BE |
503 | } |
504 | ||
505 | abuf->written = written; | |
506 | SEM_BRANCH_FINI (vpc); | |
507 | return vpc; | |
508 | #undef FLD | |
509 | } | |
510 | ||
511 | /* bgt: bgt$likely $rm, $rn, $tra */ | |
512 | ||
513 | static SEM_PC | |
514 | SEM_FN_NAME (sh64_media,bgt) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
515 | { | |
516 | #define FLD(f) abuf->fields.sfmt_beq.f | |
517 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
518 | int UNUSED written = 0; | |
519 | IADDR UNUSED pc = abuf->addr; | |
520 | SEM_BRANCH_INIT | |
521 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
522 | ||
c7e628df DB |
523 | { |
524 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
525 | if (GTDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) { |
526 | { | |
527 | UDI opval = CPU (h_tr[FLD (f_tra)]); | |
528 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
529 | written |= (1 << 3); | |
530 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
531 | } | |
c7e628df | 532 | } |
cbb38b47 BE |
533 | } |
534 | ||
535 | abuf->written = written; | |
536 | SEM_BRANCH_FINI (vpc); | |
537 | return vpc; | |
538 | #undef FLD | |
539 | } | |
540 | ||
541 | /* bgtu: bgtu$likely $rm, $rn, $tra */ | |
542 | ||
543 | static SEM_PC | |
544 | SEM_FN_NAME (sh64_media,bgtu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
545 | { | |
546 | #define FLD(f) abuf->fields.sfmt_beq.f | |
547 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
548 | int UNUSED written = 0; | |
549 | IADDR UNUSED pc = abuf->addr; | |
550 | SEM_BRANCH_INIT | |
551 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
552 | ||
c7e628df DB |
553 | { |
554 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
555 | if (GTUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) { |
556 | { | |
557 | UDI opval = CPU (h_tr[FLD (f_tra)]); | |
558 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
559 | written |= (1 << 3); | |
560 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
561 | } | |
c7e628df | 562 | } |
cbb38b47 BE |
563 | } |
564 | ||
565 | abuf->written = written; | |
566 | SEM_BRANCH_FINI (vpc); | |
567 | return vpc; | |
568 | #undef FLD | |
569 | } | |
570 | ||
571 | /* blink: blink $trb, $rd */ | |
572 | ||
573 | static SEM_PC | |
574 | SEM_FN_NAME (sh64_media,blink) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
575 | { | |
576 | #define FLD(f) abuf->fields.sfmt_blink.f | |
577 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
578 | int UNUSED written = 0; | |
579 | IADDR UNUSED pc = abuf->addr; | |
580 | SEM_BRANCH_INIT | |
581 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
582 | ||
583 | { | |
584 | { | |
585 | DI opval = ORDI (ADDDI (pc, 4), 1); | |
586 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 587 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
588 | } |
589 | { | |
590 | UDI opval = CPU (h_tr[FLD (f_trb)]); | |
591 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
592 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
593 | } | |
c7e628df DB |
594 | if (EQSI (FLD (f_dest), 63)) { |
595 | ((void) 0); /*nop*/ | |
596 | } else { | |
597 | ((void) 0); /*nop*/ | |
598 | } | |
cbb38b47 BE |
599 | } |
600 | ||
601 | SEM_BRANCH_FINI (vpc); | |
602 | return vpc; | |
603 | #undef FLD | |
604 | } | |
605 | ||
606 | /* bne: bne$likely $rm, $rn, $tra */ | |
607 | ||
608 | static SEM_PC | |
609 | SEM_FN_NAME (sh64_media,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
610 | { | |
611 | #define FLD(f) abuf->fields.sfmt_beq.f | |
612 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
613 | int UNUSED written = 0; | |
614 | IADDR UNUSED pc = abuf->addr; | |
615 | SEM_BRANCH_INIT | |
616 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
617 | ||
c7e628df DB |
618 | { |
619 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
620 | if (NEDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) { |
621 | { | |
622 | UDI opval = CPU (h_tr[FLD (f_tra)]); | |
623 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
624 | written |= (1 << 3); | |
625 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
626 | } | |
c7e628df | 627 | } |
cbb38b47 BE |
628 | } |
629 | ||
630 | abuf->written = written; | |
631 | SEM_BRANCH_FINI (vpc); | |
632 | return vpc; | |
633 | #undef FLD | |
634 | } | |
635 | ||
636 | /* bnei: bnei$likely $rm, $imm6, $tra */ | |
637 | ||
638 | static SEM_PC | |
639 | SEM_FN_NAME (sh64_media,bnei) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
640 | { | |
641 | #define FLD(f) abuf->fields.sfmt_beqi.f | |
642 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
643 | int UNUSED written = 0; | |
644 | IADDR UNUSED pc = abuf->addr; | |
645 | SEM_BRANCH_INIT | |
646 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
647 | ||
c7e628df DB |
648 | { |
649 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
650 | if (NEDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6)))) { |
651 | { | |
652 | UDI opval = CPU (h_tr[FLD (f_tra)]); | |
653 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
654 | written |= (1 << 3); | |
655 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
656 | } | |
c7e628df | 657 | } |
cbb38b47 BE |
658 | } |
659 | ||
660 | abuf->written = written; | |
661 | SEM_BRANCH_FINI (vpc); | |
662 | return vpc; | |
663 | #undef FLD | |
664 | } | |
665 | ||
666 | /* brk: brk */ | |
667 | ||
668 | static SEM_PC | |
669 | SEM_FN_NAME (sh64_media,brk) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
670 | { | |
2310652a | 671 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
672 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
673 | int UNUSED written = 0; | |
674 | IADDR UNUSED pc = abuf->addr; | |
675 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
676 | ||
677 | sh64_break (current_cpu, pc); | |
678 | ||
679 | return vpc; | |
680 | #undef FLD | |
681 | } | |
682 | ||
683 | /* byterev: byterev $rm, $rd */ | |
684 | ||
685 | static SEM_PC | |
686 | SEM_FN_NAME (sh64_media,byterev) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
687 | { | |
688 | #define FLD(f) abuf->fields.sfmt_xori.f | |
689 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
690 | int UNUSED written = 0; | |
691 | IADDR UNUSED pc = abuf->addr; | |
692 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
693 | ||
694 | { | |
695 | DI tmp_source; | |
696 | DI tmp_result; | |
697 | tmp_source = GET_H_GR (FLD (f_left)); | |
698 | tmp_result = 0; | |
699 | { | |
700 | tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255)); | |
701 | tmp_source = SRLDI (tmp_source, 8); | |
702 | } | |
703 | { | |
704 | tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255)); | |
705 | tmp_source = SRLDI (tmp_source, 8); | |
706 | } | |
707 | { | |
708 | tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255)); | |
709 | tmp_source = SRLDI (tmp_source, 8); | |
710 | } | |
711 | { | |
712 | tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255)); | |
713 | tmp_source = SRLDI (tmp_source, 8); | |
714 | } | |
715 | { | |
716 | tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255)); | |
717 | tmp_source = SRLDI (tmp_source, 8); | |
718 | } | |
719 | { | |
720 | tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255)); | |
721 | tmp_source = SRLDI (tmp_source, 8); | |
722 | } | |
723 | { | |
724 | tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255)); | |
725 | tmp_source = SRLDI (tmp_source, 8); | |
726 | } | |
727 | { | |
728 | tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255)); | |
729 | tmp_source = SRLDI (tmp_source, 8); | |
730 | } | |
731 | { | |
732 | DI opval = tmp_result; | |
733 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 734 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
735 | } |
736 | } | |
737 | ||
738 | return vpc; | |
739 | #undef FLD | |
740 | } | |
741 | ||
742 | /* cmpeq: cmpeq $rm, $rn, $rd */ | |
743 | ||
744 | static SEM_PC | |
745 | SEM_FN_NAME (sh64_media,cmpeq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
746 | { | |
747 | #define FLD(f) abuf->fields.sfmt_add.f | |
748 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
749 | int UNUSED written = 0; | |
750 | IADDR UNUSED pc = abuf->addr; | |
751 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
752 | ||
753 | { | |
754 | DI opval = ((EQDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0)); | |
755 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 756 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
757 | } |
758 | ||
759 | return vpc; | |
760 | #undef FLD | |
761 | } | |
762 | ||
763 | /* cmpgt: cmpgt $rm, $rn, $rd */ | |
764 | ||
765 | static SEM_PC | |
766 | SEM_FN_NAME (sh64_media,cmpgt) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
767 | { | |
768 | #define FLD(f) abuf->fields.sfmt_add.f | |
769 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
770 | int UNUSED written = 0; | |
771 | IADDR UNUSED pc = abuf->addr; | |
772 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
773 | ||
774 | { | |
775 | DI opval = ((GTDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0)); | |
776 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 777 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
778 | } |
779 | ||
780 | return vpc; | |
781 | #undef FLD | |
782 | } | |
783 | ||
784 | /* cmpgtu: cmpgtu $rm,$rn, $rd */ | |
785 | ||
786 | static SEM_PC | |
787 | SEM_FN_NAME (sh64_media,cmpgtu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
788 | { | |
789 | #define FLD(f) abuf->fields.sfmt_add.f | |
790 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
791 | int UNUSED written = 0; | |
792 | IADDR UNUSED pc = abuf->addr; | |
793 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
794 | ||
795 | { | |
796 | DI opval = ((GTUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0)); | |
797 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 798 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
799 | } |
800 | ||
801 | return vpc; | |
802 | #undef FLD | |
803 | } | |
804 | ||
805 | /* cmveq: cmveq $rm, $rn, $rd */ | |
806 | ||
807 | static SEM_PC | |
808 | SEM_FN_NAME (sh64_media,cmveq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
809 | { | |
810 | #define FLD(f) abuf->fields.sfmt_add.f | |
811 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
812 | int UNUSED written = 0; | |
813 | IADDR UNUSED pc = abuf->addr; | |
814 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
815 | ||
816 | if (EQDI (GET_H_GR (FLD (f_left)), 0)) { | |
817 | { | |
818 | DI opval = GET_H_GR (FLD (f_right)); | |
819 | SET_H_GR (FLD (f_dest), opval); | |
820 | written |= (1 << 2); | |
1bbd6057 | 821 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
822 | } |
823 | } | |
824 | ||
825 | abuf->written = written; | |
826 | return vpc; | |
827 | #undef FLD | |
828 | } | |
829 | ||
830 | /* cmvne: cmvne $rm, $rn, $rd */ | |
831 | ||
832 | static SEM_PC | |
833 | SEM_FN_NAME (sh64_media,cmvne) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
834 | { | |
835 | #define FLD(f) abuf->fields.sfmt_add.f | |
836 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
837 | int UNUSED written = 0; | |
838 | IADDR UNUSED pc = abuf->addr; | |
839 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
840 | ||
841 | if (NEDI (GET_H_GR (FLD (f_left)), 0)) { | |
842 | { | |
843 | DI opval = GET_H_GR (FLD (f_right)); | |
844 | SET_H_GR (FLD (f_dest), opval); | |
845 | written |= (1 << 2); | |
1bbd6057 | 846 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
847 | } |
848 | } | |
849 | ||
850 | abuf->written = written; | |
851 | return vpc; | |
852 | #undef FLD | |
853 | } | |
854 | ||
855 | /* fabsd: fabs.d $drgh, $drf */ | |
856 | ||
857 | static SEM_PC | |
858 | SEM_FN_NAME (sh64_media,fabsd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
859 | { | |
860 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
861 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
862 | int UNUSED written = 0; | |
863 | IADDR UNUSED pc = abuf->addr; | |
864 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
865 | ||
866 | { | |
867 | DF opval = sh64_fabsd (current_cpu, GET_H_DR (FLD (f_left_right))); | |
868 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 869 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
870 | } |
871 | ||
872 | return vpc; | |
873 | #undef FLD | |
874 | } | |
875 | ||
876 | /* fabss: fabs.s $frgh, $frf */ | |
877 | ||
878 | static SEM_PC | |
879 | SEM_FN_NAME (sh64_media,fabss) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
880 | { | |
881 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
882 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
883 | int UNUSED written = 0; | |
884 | IADDR UNUSED pc = abuf->addr; | |
885 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
886 | ||
887 | { | |
888 | SF opval = sh64_fabss (current_cpu, CPU (h_fr[FLD (f_left_right)])); | |
889 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 890 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
891 | } |
892 | ||
893 | return vpc; | |
894 | #undef FLD | |
895 | } | |
896 | ||
897 | /* faddd: fadd.d $drg, $drh, $drf */ | |
898 | ||
899 | static SEM_PC | |
900 | SEM_FN_NAME (sh64_media,faddd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
901 | { | |
902 | #define FLD(f) abuf->fields.sfmt_add.f | |
903 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
904 | int UNUSED written = 0; | |
905 | IADDR UNUSED pc = abuf->addr; | |
906 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
907 | ||
908 | { | |
909 | DF opval = sh64_faddd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))); | |
910 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 911 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
912 | } |
913 | ||
914 | return vpc; | |
915 | #undef FLD | |
916 | } | |
917 | ||
918 | /* fadds: fadd.s $frg, $frh, $frf */ | |
919 | ||
920 | static SEM_PC | |
921 | SEM_FN_NAME (sh64_media,fadds) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
922 | { | |
923 | #define FLD(f) abuf->fields.sfmt_add.f | |
924 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
925 | int UNUSED written = 0; | |
926 | IADDR UNUSED pc = abuf->addr; | |
927 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
928 | ||
929 | { | |
930 | SF opval = sh64_fadds (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])); | |
931 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 932 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
933 | } |
934 | ||
935 | return vpc; | |
936 | #undef FLD | |
937 | } | |
938 | ||
939 | /* fcmpeqd: fcmpeq.d $drg, $drh, $rd */ | |
940 | ||
941 | static SEM_PC | |
942 | SEM_FN_NAME (sh64_media,fcmpeqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
943 | { | |
944 | #define FLD(f) abuf->fields.sfmt_add.f | |
945 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
946 | int UNUSED written = 0; | |
947 | IADDR UNUSED pc = abuf->addr; | |
948 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
949 | ||
950 | { | |
951 | DI opval = ZEXTBIDI (sh64_fcmpeqd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)))); | |
952 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 953 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
954 | } |
955 | ||
956 | return vpc; | |
957 | #undef FLD | |
958 | } | |
959 | ||
960 | /* fcmpeqs: fcmpeq.s $frg, $frh, $rd */ | |
961 | ||
962 | static SEM_PC | |
963 | SEM_FN_NAME (sh64_media,fcmpeqs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
964 | { | |
965 | #define FLD(f) abuf->fields.sfmt_add.f | |
966 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
967 | int UNUSED written = 0; | |
968 | IADDR UNUSED pc = abuf->addr; | |
969 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
970 | ||
971 | { | |
972 | DI opval = ZEXTBIDI (sh64_fcmpeqs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]))); | |
973 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 974 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
975 | } |
976 | ||
977 | return vpc; | |
978 | #undef FLD | |
979 | } | |
980 | ||
981 | /* fcmpged: fcmpge.d $drg, $drh, $rd */ | |
982 | ||
983 | static SEM_PC | |
984 | SEM_FN_NAME (sh64_media,fcmpged) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
985 | { | |
986 | #define FLD(f) abuf->fields.sfmt_add.f | |
987 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
988 | int UNUSED written = 0; | |
989 | IADDR UNUSED pc = abuf->addr; | |
990 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
991 | ||
992 | { | |
993 | DI opval = ZEXTBIDI (sh64_fcmpged (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)))); | |
994 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 995 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
996 | } |
997 | ||
998 | return vpc; | |
999 | #undef FLD | |
1000 | } | |
1001 | ||
1002 | /* fcmpges: fcmpge.s $frg, $frh, $rd */ | |
1003 | ||
1004 | static SEM_PC | |
1005 | SEM_FN_NAME (sh64_media,fcmpges) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1006 | { | |
1007 | #define FLD(f) abuf->fields.sfmt_add.f | |
1008 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1009 | int UNUSED written = 0; | |
1010 | IADDR UNUSED pc = abuf->addr; | |
1011 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1012 | ||
1013 | { | |
1014 | DI opval = ZEXTBIDI (sh64_fcmpges (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]))); | |
1015 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 1016 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
1017 | } |
1018 | ||
1019 | return vpc; | |
1020 | #undef FLD | |
1021 | } | |
1022 | ||
1023 | /* fcmpgtd: fcmpgt.d $drg, $drh, $rd */ | |
1024 | ||
1025 | static SEM_PC | |
1026 | SEM_FN_NAME (sh64_media,fcmpgtd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1027 | { | |
1028 | #define FLD(f) abuf->fields.sfmt_add.f | |
1029 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1030 | int UNUSED written = 0; | |
1031 | IADDR UNUSED pc = abuf->addr; | |
1032 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1033 | ||
1034 | { | |
1035 | DI opval = ZEXTBIDI (sh64_fcmpgtd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)))); | |
1036 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 1037 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
1038 | } |
1039 | ||
1040 | return vpc; | |
1041 | #undef FLD | |
1042 | } | |
1043 | ||
1044 | /* fcmpgts: fcmpgt.s $frg, $frh, $rd */ | |
1045 | ||
1046 | static SEM_PC | |
1047 | SEM_FN_NAME (sh64_media,fcmpgts) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1048 | { | |
1049 | #define FLD(f) abuf->fields.sfmt_add.f | |
1050 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1051 | int UNUSED written = 0; | |
1052 | IADDR UNUSED pc = abuf->addr; | |
1053 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1054 | ||
1055 | { | |
1056 | DI opval = ZEXTBIDI (sh64_fcmpgts (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]))); | |
1057 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 1058 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
1059 | } |
1060 | ||
1061 | return vpc; | |
1062 | #undef FLD | |
1063 | } | |
1064 | ||
1065 | /* fcmpund: fcmpun.d $drg, $drh, $rd */ | |
1066 | ||
1067 | static SEM_PC | |
1068 | SEM_FN_NAME (sh64_media,fcmpund) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1069 | { | |
1070 | #define FLD(f) abuf->fields.sfmt_add.f | |
1071 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1072 | int UNUSED written = 0; | |
1073 | IADDR UNUSED pc = abuf->addr; | |
1074 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1075 | ||
1076 | { | |
1077 | DI opval = ZEXTBIDI (sh64_fcmpund (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)))); | |
1078 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 1079 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
1080 | } |
1081 | ||
1082 | return vpc; | |
1083 | #undef FLD | |
1084 | } | |
1085 | ||
1086 | /* fcmpuns: fcmpun.s $frg, $frh, $rd */ | |
1087 | ||
1088 | static SEM_PC | |
1089 | SEM_FN_NAME (sh64_media,fcmpuns) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1090 | { | |
1091 | #define FLD(f) abuf->fields.sfmt_add.f | |
1092 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1093 | int UNUSED written = 0; | |
1094 | IADDR UNUSED pc = abuf->addr; | |
1095 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1096 | ||
1097 | { | |
1098 | DI opval = ZEXTBIDI (sh64_fcmpuns (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]))); | |
1099 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 1100 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
1101 | } |
1102 | ||
1103 | return vpc; | |
1104 | #undef FLD | |
1105 | } | |
1106 | ||
1107 | /* fcnvds: fcnv.ds $drgh, $frf */ | |
1108 | ||
1109 | static SEM_PC | |
1110 | SEM_FN_NAME (sh64_media,fcnvds) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1111 | { | |
1112 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1113 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1114 | int UNUSED written = 0; | |
1115 | IADDR UNUSED pc = abuf->addr; | |
1116 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1117 | ||
1118 | { | |
1119 | SF opval = sh64_fcnvds (current_cpu, GET_H_DR (FLD (f_left_right))); | |
1120 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1121 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1122 | } |
1123 | ||
1124 | return vpc; | |
1125 | #undef FLD | |
1126 | } | |
1127 | ||
1128 | /* fcnvsd: fcnv.sd $frgh, $drf */ | |
1129 | ||
1130 | static SEM_PC | |
1131 | SEM_FN_NAME (sh64_media,fcnvsd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1132 | { | |
1133 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1134 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1135 | int UNUSED written = 0; | |
1136 | IADDR UNUSED pc = abuf->addr; | |
1137 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1138 | ||
1139 | { | |
1140 | DF opval = sh64_fcnvsd (current_cpu, CPU (h_fr[FLD (f_left_right)])); | |
1141 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1142 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1143 | } |
1144 | ||
1145 | return vpc; | |
1146 | #undef FLD | |
1147 | } | |
1148 | ||
1149 | /* fdivd: fdiv.d $drg, $drh, $drf */ | |
1150 | ||
1151 | static SEM_PC | |
1152 | SEM_FN_NAME (sh64_media,fdivd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1153 | { | |
1154 | #define FLD(f) abuf->fields.sfmt_add.f | |
1155 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1156 | int UNUSED written = 0; | |
1157 | IADDR UNUSED pc = abuf->addr; | |
1158 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1159 | ||
1160 | { | |
1161 | DF opval = sh64_fdivd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))); | |
1162 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1163 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1164 | } |
1165 | ||
1166 | return vpc; | |
1167 | #undef FLD | |
1168 | } | |
1169 | ||
1170 | /* fdivs: fdiv.s $frg, $frh, $frf */ | |
1171 | ||
1172 | static SEM_PC | |
1173 | SEM_FN_NAME (sh64_media,fdivs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1174 | { | |
1175 | #define FLD(f) abuf->fields.sfmt_add.f | |
1176 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1177 | int UNUSED written = 0; | |
1178 | IADDR UNUSED pc = abuf->addr; | |
1179 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1180 | ||
1181 | { | |
1182 | SF opval = sh64_fdivs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])); | |
1183 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1184 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1185 | } |
1186 | ||
1187 | return vpc; | |
1188 | #undef FLD | |
1189 | } | |
1190 | ||
1191 | /* fgetscr: fgetscr $frf */ | |
1192 | ||
1193 | static SEM_PC | |
1194 | SEM_FN_NAME (sh64_media,fgetscr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1195 | { | |
c7e628df | 1196 | #define FLD(f) abuf->fields.sfmt_shori.f |
cbb38b47 BE |
1197 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1198 | int UNUSED written = 0; | |
1199 | IADDR UNUSED pc = abuf->addr; | |
1200 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1201 | ||
c7e628df DB |
1202 | { |
1203 | SF opval = SUBWORDSISF (CPU (h_fpscr)); | |
1204 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1205 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); | |
1206 | } | |
cbb38b47 BE |
1207 | |
1208 | return vpc; | |
1209 | #undef FLD | |
1210 | } | |
1211 | ||
1212 | /* fiprs: fipr.s $fvg, $fvh, $frf */ | |
1213 | ||
1214 | static SEM_PC | |
1215 | SEM_FN_NAME (sh64_media,fiprs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1216 | { | |
1217 | #define FLD(f) abuf->fields.sfmt_add.f | |
1218 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1219 | int UNUSED written = 0; | |
1220 | IADDR UNUSED pc = abuf->addr; | |
1221 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1222 | ||
1223 | { | |
cbb38b47 | 1224 | { |
c7e628df DB |
1225 | SF opval = GET_H_FV (FLD (f_left)); |
1226 | SET_H_FV (FLD (f_left), opval); | |
1227 | TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval); | |
1228 | } | |
1229 | { | |
1230 | SF opval = GET_H_FV (FLD (f_right)); | |
1231 | SET_H_FV (FLD (f_right), opval); | |
1232 | TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval); | |
1233 | } | |
1234 | { | |
1235 | SF opval = sh64_fiprs (current_cpu, FLD (f_left), FLD (f_right)); | |
cbb38b47 | 1236 | CPU (h_fr[FLD (f_dest)]) = opval; |
1bbd6057 | 1237 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1238 | } |
1239 | } | |
1240 | ||
1241 | return vpc; | |
1242 | #undef FLD | |
1243 | } | |
1244 | ||
1245 | /* fldd: fld.d $rm, $disp10x8, $drf */ | |
1246 | ||
1247 | static SEM_PC | |
1248 | SEM_FN_NAME (sh64_media,fldd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1249 | { | |
1250 | #define FLD(f) abuf->fields.sfmt_fldd.f | |
1251 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1252 | int UNUSED written = 0; | |
1253 | IADDR UNUSED pc = abuf->addr; | |
1254 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1255 | ||
1256 | { | |
1257 | DF opval = GETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x8))); | |
1258 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1259 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1260 | } |
1261 | ||
1262 | return vpc; | |
1263 | #undef FLD | |
1264 | } | |
1265 | ||
1266 | /* fldp: fld.p $rm, $disp10x8, $fpf */ | |
1267 | ||
1268 | static SEM_PC | |
1269 | SEM_FN_NAME (sh64_media,fldp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1270 | { | |
1271 | #define FLD(f) abuf->fields.sfmt_fldd.f | |
1272 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1273 | int UNUSED written = 0; | |
1274 | IADDR UNUSED pc = abuf->addr; | |
1275 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1276 | ||
1277 | { | |
cbb38b47 | 1278 | { |
c7e628df DB |
1279 | SF opval = GET_H_FP (FLD (f_dest)); |
1280 | SET_H_FP (FLD (f_dest), opval); | |
1281 | TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval); | |
cbb38b47 | 1282 | } |
c7e628df | 1283 | sh64_fldp (current_cpu, pc, GET_H_GR (FLD (f_left)), FLD (f_disp10x8), FLD (f_dest)); |
cbb38b47 BE |
1284 | } |
1285 | ||
1286 | return vpc; | |
1287 | #undef FLD | |
1288 | } | |
1289 | ||
1290 | /* flds: fld.s $rm, $disp10x4, $frf */ | |
1291 | ||
1292 | static SEM_PC | |
1293 | SEM_FN_NAME (sh64_media,flds) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1294 | { | |
1295 | #define FLD(f) abuf->fields.sfmt_flds.f | |
1296 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1297 | int UNUSED written = 0; | |
1298 | IADDR UNUSED pc = abuf->addr; | |
1299 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1300 | ||
1301 | { | |
1302 | SF opval = GETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x4))); | |
1303 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1304 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1305 | } |
1306 | ||
1307 | return vpc; | |
1308 | #undef FLD | |
1309 | } | |
1310 | ||
1311 | /* fldxd: fldx.d $rm, $rn, $drf */ | |
1312 | ||
1313 | static SEM_PC | |
1314 | SEM_FN_NAME (sh64_media,fldxd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1315 | { | |
1316 | #define FLD(f) abuf->fields.sfmt_add.f | |
1317 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1318 | int UNUSED written = 0; | |
1319 | IADDR UNUSED pc = abuf->addr; | |
1320 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1321 | ||
1322 | { | |
1323 | DF opval = GETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))); | |
1324 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1325 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1326 | } |
1327 | ||
1328 | return vpc; | |
1329 | #undef FLD | |
1330 | } | |
1331 | ||
1332 | /* fldxp: fldx.p $rm, $rn, $fpf */ | |
1333 | ||
1334 | static SEM_PC | |
1335 | SEM_FN_NAME (sh64_media,fldxp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1336 | { | |
1337 | #define FLD(f) abuf->fields.sfmt_add.f | |
1338 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1339 | int UNUSED written = 0; | |
1340 | IADDR UNUSED pc = abuf->addr; | |
1341 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1342 | ||
1343 | { | |
cbb38b47 | 1344 | { |
c7e628df DB |
1345 | SF opval = GET_H_FP (FLD (f_dest)); |
1346 | SET_H_FP (FLD (f_dest), opval); | |
1347 | TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval); | |
cbb38b47 | 1348 | } |
c7e628df | 1349 | sh64_fldp (current_cpu, pc, GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)), FLD (f_dest)); |
cbb38b47 BE |
1350 | } |
1351 | ||
1352 | return vpc; | |
1353 | #undef FLD | |
1354 | } | |
1355 | ||
1356 | /* fldxs: fldx.s $rm, $rn, $frf */ | |
1357 | ||
1358 | static SEM_PC | |
1359 | SEM_FN_NAME (sh64_media,fldxs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1360 | { | |
1361 | #define FLD(f) abuf->fields.sfmt_add.f | |
1362 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1363 | int UNUSED written = 0; | |
1364 | IADDR UNUSED pc = abuf->addr; | |
1365 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1366 | ||
1367 | { | |
1368 | SF opval = GETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))); | |
1369 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1370 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1371 | } |
1372 | ||
1373 | return vpc; | |
1374 | #undef FLD | |
1375 | } | |
1376 | ||
1377 | /* floatld: float.ld $frgh, $drf */ | |
1378 | ||
1379 | static SEM_PC | |
1380 | SEM_FN_NAME (sh64_media,floatld) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1381 | { | |
1382 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
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, 4); | |
1387 | ||
1388 | { | |
1389 | DF opval = sh64_floatld (current_cpu, CPU (h_fr[FLD (f_left_right)])); | |
1390 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1391 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1392 | } |
1393 | ||
1394 | return vpc; | |
1395 | #undef FLD | |
1396 | } | |
1397 | ||
1398 | /* floatls: float.ls $frgh, $frf */ | |
1399 | ||
1400 | static SEM_PC | |
1401 | SEM_FN_NAME (sh64_media,floatls) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1402 | { | |
1403 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1404 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1405 | int UNUSED written = 0; | |
1406 | IADDR UNUSED pc = abuf->addr; | |
1407 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1408 | ||
1409 | { | |
1410 | SF opval = sh64_floatls (current_cpu, CPU (h_fr[FLD (f_left_right)])); | |
1411 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1412 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1413 | } |
1414 | ||
1415 | return vpc; | |
1416 | #undef FLD | |
1417 | } | |
1418 | ||
1419 | /* floatqd: float.qd $drgh, $drf */ | |
1420 | ||
1421 | static SEM_PC | |
1422 | SEM_FN_NAME (sh64_media,floatqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1423 | { | |
1424 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1425 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1426 | int UNUSED written = 0; | |
1427 | IADDR UNUSED pc = abuf->addr; | |
1428 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1429 | ||
1430 | { | |
1431 | DF opval = sh64_floatqd (current_cpu, GET_H_DR (FLD (f_left_right))); | |
1432 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1433 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1434 | } |
1435 | ||
1436 | return vpc; | |
1437 | #undef FLD | |
1438 | } | |
1439 | ||
1440 | /* floatqs: float.qs $drgh, $frf */ | |
1441 | ||
1442 | static SEM_PC | |
1443 | SEM_FN_NAME (sh64_media,floatqs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1444 | { | |
1445 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1446 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1447 | int UNUSED written = 0; | |
1448 | IADDR UNUSED pc = abuf->addr; | |
1449 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1450 | ||
1451 | { | |
1452 | SF opval = sh64_floatqs (current_cpu, GET_H_DR (FLD (f_left_right))); | |
1453 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1454 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1455 | } |
1456 | ||
1457 | return vpc; | |
1458 | #undef FLD | |
1459 | } | |
1460 | ||
1461 | /* fmacs: fmac.s $frg, $frh, $frf */ | |
1462 | ||
1463 | static SEM_PC | |
1464 | SEM_FN_NAME (sh64_media,fmacs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1465 | { | |
1466 | #define FLD(f) abuf->fields.sfmt_add.f | |
1467 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1468 | int UNUSED written = 0; | |
1469 | IADDR UNUSED pc = abuf->addr; | |
1470 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1471 | ||
1472 | { | |
1473 | SF opval = sh64_fadds (current_cpu, CPU (h_fr[FLD (f_dest)]), sh64_fmuls (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]))); | |
1474 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1475 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1476 | } |
1477 | ||
1478 | return vpc; | |
1479 | #undef FLD | |
1480 | } | |
1481 | ||
1482 | /* fmovd: fmov.d $drgh, $drf */ | |
1483 | ||
1484 | static SEM_PC | |
1485 | SEM_FN_NAME (sh64_media,fmovd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1486 | { | |
1487 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1488 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1489 | int UNUSED written = 0; | |
1490 | IADDR UNUSED pc = abuf->addr; | |
1491 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1492 | ||
1493 | { | |
1494 | DF opval = GET_H_DR (FLD (f_left_right)); | |
1495 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1496 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1497 | } |
1498 | ||
1499 | return vpc; | |
1500 | #undef FLD | |
1501 | } | |
1502 | ||
1503 | /* fmovdq: fmov.dq $drgh, $rd */ | |
1504 | ||
1505 | static SEM_PC | |
1506 | SEM_FN_NAME (sh64_media,fmovdq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1507 | { | |
1508 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1509 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1510 | int UNUSED written = 0; | |
1511 | IADDR UNUSED pc = abuf->addr; | |
1512 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1513 | ||
1514 | { | |
1515 | DI opval = SUBWORDDFDI (GET_H_DR (FLD (f_left_right))); | |
1516 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 1517 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
1518 | } |
1519 | ||
1520 | return vpc; | |
1521 | #undef FLD | |
1522 | } | |
1523 | ||
1524 | /* fmovls: fmov.ls $rm, $frf */ | |
1525 | ||
1526 | static SEM_PC | |
1527 | SEM_FN_NAME (sh64_media,fmovls) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1528 | { | |
1529 | #define FLD(f) abuf->fields.sfmt_xori.f | |
1530 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1531 | int UNUSED written = 0; | |
1532 | IADDR UNUSED pc = abuf->addr; | |
1533 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1534 | ||
1535 | { | |
1536 | SF opval = SUBWORDSISF (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)); | |
1537 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1538 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1539 | } |
1540 | ||
1541 | return vpc; | |
1542 | #undef FLD | |
1543 | } | |
1544 | ||
1545 | /* fmovqd: fmov.qd $rm, $drf */ | |
1546 | ||
1547 | static SEM_PC | |
1548 | SEM_FN_NAME (sh64_media,fmovqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1549 | { | |
1550 | #define FLD(f) abuf->fields.sfmt_xori.f | |
1551 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1552 | int UNUSED written = 0; | |
1553 | IADDR UNUSED pc = abuf->addr; | |
1554 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1555 | ||
1556 | { | |
1557 | DF opval = SUBWORDDIDF (GET_H_GR (FLD (f_left))); | |
1558 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1559 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1560 | } |
1561 | ||
1562 | return vpc; | |
1563 | #undef FLD | |
1564 | } | |
1565 | ||
1566 | /* fmovs: fmov.s $frgh, $frf */ | |
1567 | ||
1568 | static SEM_PC | |
1569 | SEM_FN_NAME (sh64_media,fmovs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1570 | { | |
1571 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1572 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1573 | int UNUSED written = 0; | |
1574 | IADDR UNUSED pc = abuf->addr; | |
1575 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1576 | ||
1577 | { | |
1578 | SF opval = CPU (h_fr[FLD (f_left_right)]); | |
1579 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1580 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1581 | } |
1582 | ||
1583 | return vpc; | |
1584 | #undef FLD | |
1585 | } | |
1586 | ||
1587 | /* fmovsl: fmov.sl $frgh, $rd */ | |
1588 | ||
1589 | static SEM_PC | |
1590 | SEM_FN_NAME (sh64_media,fmovsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1591 | { | |
1592 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1593 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1594 | int UNUSED written = 0; | |
1595 | IADDR UNUSED pc = abuf->addr; | |
1596 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1597 | ||
1598 | { | |
1599 | DI opval = EXTSIDI (SUBWORDSFSI (CPU (h_fr[FLD (f_left_right)]))); | |
1600 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 1601 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
1602 | } |
1603 | ||
1604 | return vpc; | |
1605 | #undef FLD | |
1606 | } | |
1607 | ||
1608 | /* fmuld: fmul.d $drg, $drh, $drf */ | |
1609 | ||
1610 | static SEM_PC | |
1611 | SEM_FN_NAME (sh64_media,fmuld) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1612 | { | |
1613 | #define FLD(f) abuf->fields.sfmt_add.f | |
1614 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1615 | int UNUSED written = 0; | |
1616 | IADDR UNUSED pc = abuf->addr; | |
1617 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1618 | ||
1619 | { | |
1620 | DF opval = sh64_fmuld (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))); | |
1621 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1622 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1623 | } |
1624 | ||
1625 | return vpc; | |
1626 | #undef FLD | |
1627 | } | |
1628 | ||
1629 | /* fmuls: fmul.s $frg, $frh, $frf */ | |
1630 | ||
1631 | static SEM_PC | |
1632 | SEM_FN_NAME (sh64_media,fmuls) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1633 | { | |
1634 | #define FLD(f) abuf->fields.sfmt_add.f | |
1635 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1636 | int UNUSED written = 0; | |
1637 | IADDR UNUSED pc = abuf->addr; | |
1638 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1639 | ||
1640 | { | |
1641 | SF opval = sh64_fmuls (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])); | |
1642 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1643 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1644 | } |
1645 | ||
1646 | return vpc; | |
1647 | #undef FLD | |
1648 | } | |
1649 | ||
1650 | /* fnegd: fneg.d $drgh, $drf */ | |
1651 | ||
1652 | static SEM_PC | |
1653 | SEM_FN_NAME (sh64_media,fnegd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1654 | { | |
1655 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1656 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1657 | int UNUSED written = 0; | |
1658 | IADDR UNUSED pc = abuf->addr; | |
1659 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1660 | ||
1661 | { | |
1662 | DF opval = sh64_fnegd (current_cpu, GET_H_DR (FLD (f_left_right))); | |
1663 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1664 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1665 | } |
1666 | ||
1667 | return vpc; | |
1668 | #undef FLD | |
1669 | } | |
1670 | ||
1671 | /* fnegs: fneg.s $frgh, $frf */ | |
1672 | ||
1673 | static SEM_PC | |
1674 | SEM_FN_NAME (sh64_media,fnegs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1675 | { | |
1676 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1677 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1678 | int UNUSED written = 0; | |
1679 | IADDR UNUSED pc = abuf->addr; | |
1680 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1681 | ||
1682 | { | |
1683 | SF opval = sh64_fnegs (current_cpu, CPU (h_fr[FLD (f_left_right)])); | |
1684 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1685 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1686 | } |
1687 | ||
1688 | return vpc; | |
1689 | #undef FLD | |
1690 | } | |
1691 | ||
1692 | /* fputscr: fputscr $frgh */ | |
1693 | ||
1694 | static SEM_PC | |
1695 | SEM_FN_NAME (sh64_media,fputscr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1696 | { | |
c7e628df | 1697 | #define FLD(f) abuf->fields.sfmt_fabsd.f |
cbb38b47 BE |
1698 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
1699 | int UNUSED written = 0; | |
1700 | IADDR UNUSED pc = abuf->addr; | |
1701 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1702 | ||
c7e628df DB |
1703 | { |
1704 | SI opval = SUBWORDSFSI (CPU (h_fr[FLD (f_left_right)])); | |
1705 | CPU (h_fpscr) = opval; | |
1706 | TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval); | |
1707 | } | |
cbb38b47 BE |
1708 | |
1709 | return vpc; | |
1710 | #undef FLD | |
1711 | } | |
1712 | ||
1713 | /* fsqrtd: fsqrt.d $drgh, $drf */ | |
1714 | ||
1715 | static SEM_PC | |
1716 | SEM_FN_NAME (sh64_media,fsqrtd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1717 | { | |
1718 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1719 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1720 | int UNUSED written = 0; | |
1721 | IADDR UNUSED pc = abuf->addr; | |
1722 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1723 | ||
1724 | { | |
1725 | DF opval = sh64_fsqrtd (current_cpu, GET_H_DR (FLD (f_left_right))); | |
1726 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1727 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1728 | } |
1729 | ||
1730 | return vpc; | |
1731 | #undef FLD | |
1732 | } | |
1733 | ||
1734 | /* fsqrts: fsqrt.s $frgh, $frf */ | |
1735 | ||
1736 | static SEM_PC | |
1737 | SEM_FN_NAME (sh64_media,fsqrts) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1738 | { | |
1739 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1740 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1741 | int UNUSED written = 0; | |
1742 | IADDR UNUSED pc = abuf->addr; | |
1743 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1744 | ||
1745 | { | |
1746 | SF opval = sh64_fsqrts (current_cpu, CPU (h_fr[FLD (f_left_right)])); | |
1747 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1748 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1749 | } |
1750 | ||
1751 | return vpc; | |
1752 | #undef FLD | |
1753 | } | |
1754 | ||
1755 | /* fstd: fst.d $rm, $disp10x8, $drf */ | |
1756 | ||
1757 | static SEM_PC | |
1758 | SEM_FN_NAME (sh64_media,fstd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1759 | { | |
1760 | #define FLD(f) abuf->fields.sfmt_fldd.f | |
1761 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1762 | int UNUSED written = 0; | |
1763 | IADDR UNUSED pc = abuf->addr; | |
1764 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1765 | ||
1766 | { | |
1767 | DF opval = GET_H_DR (FLD (f_dest)); | |
1768 | SETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x8)), opval); | |
1769 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1770 | } | |
1771 | ||
1772 | return vpc; | |
1773 | #undef FLD | |
1774 | } | |
1775 | ||
1776 | /* fstp: fst.p $rm, $disp10x8, $fpf */ | |
1777 | ||
1778 | static SEM_PC | |
1779 | SEM_FN_NAME (sh64_media,fstp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1780 | { | |
1781 | #define FLD(f) abuf->fields.sfmt_fldd.f | |
1782 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1783 | int UNUSED written = 0; | |
1784 | IADDR UNUSED pc = abuf->addr; | |
1785 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1786 | ||
1787 | { | |
cbb38b47 | 1788 | { |
c7e628df DB |
1789 | SF opval = GET_H_FP (FLD (f_dest)); |
1790 | SET_H_FP (FLD (f_dest), opval); | |
1791 | TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval); | |
cbb38b47 | 1792 | } |
c7e628df | 1793 | sh64_fstp (current_cpu, pc, GET_H_GR (FLD (f_left)), FLD (f_disp10x8), FLD (f_dest)); |
cbb38b47 BE |
1794 | } |
1795 | ||
1796 | return vpc; | |
1797 | #undef FLD | |
1798 | } | |
1799 | ||
1800 | /* fsts: fst.s $rm, $disp10x4, $frf */ | |
1801 | ||
1802 | static SEM_PC | |
1803 | SEM_FN_NAME (sh64_media,fsts) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1804 | { | |
1805 | #define FLD(f) abuf->fields.sfmt_flds.f | |
1806 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1807 | int UNUSED written = 0; | |
1808 | IADDR UNUSED pc = abuf->addr; | |
1809 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1810 | ||
1811 | { | |
1812 | SF opval = CPU (h_fr[FLD (f_dest)]); | |
1813 | SETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x4)), opval); | |
1814 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1815 | } | |
1816 | ||
1817 | return vpc; | |
1818 | #undef FLD | |
1819 | } | |
1820 | ||
1821 | /* fstxd: fstx.d $rm, $rn, $drf */ | |
1822 | ||
1823 | static SEM_PC | |
1824 | SEM_FN_NAME (sh64_media,fstxd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1825 | { | |
1826 | #define FLD(f) abuf->fields.sfmt_add.f | |
1827 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1828 | int UNUSED written = 0; | |
1829 | IADDR UNUSED pc = abuf->addr; | |
1830 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1831 | ||
1832 | { | |
1833 | DF opval = GET_H_DR (FLD (f_dest)); | |
1834 | SETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval); | |
1835 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1836 | } | |
1837 | ||
1838 | return vpc; | |
1839 | #undef FLD | |
1840 | } | |
1841 | ||
1842 | /* fstxp: fstx.p $rm, $rn, $fpf */ | |
1843 | ||
1844 | static SEM_PC | |
1845 | SEM_FN_NAME (sh64_media,fstxp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1846 | { | |
1847 | #define FLD(f) abuf->fields.sfmt_add.f | |
1848 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1849 | int UNUSED written = 0; | |
1850 | IADDR UNUSED pc = abuf->addr; | |
1851 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1852 | ||
1853 | { | |
cbb38b47 | 1854 | { |
c7e628df DB |
1855 | SF opval = GET_H_FP (FLD (f_dest)); |
1856 | SET_H_FP (FLD (f_dest), opval); | |
1857 | TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval); | |
cbb38b47 | 1858 | } |
c7e628df | 1859 | sh64_fstp (current_cpu, pc, GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)), FLD (f_dest)); |
cbb38b47 BE |
1860 | } |
1861 | ||
1862 | return vpc; | |
1863 | #undef FLD | |
1864 | } | |
1865 | ||
1866 | /* fstxs: fstx.s $rm, $rn, $frf */ | |
1867 | ||
1868 | static SEM_PC | |
1869 | SEM_FN_NAME (sh64_media,fstxs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1870 | { | |
1871 | #define FLD(f) abuf->fields.sfmt_add.f | |
1872 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1873 | int UNUSED written = 0; | |
1874 | IADDR UNUSED pc = abuf->addr; | |
1875 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1876 | ||
1877 | { | |
1878 | SF opval = CPU (h_fr[FLD (f_dest)]); | |
1879 | SETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval); | |
1880 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1881 | } | |
1882 | ||
1883 | return vpc; | |
1884 | #undef FLD | |
1885 | } | |
1886 | ||
1887 | /* fsubd: fsub.d $drg, $drh, $drf */ | |
1888 | ||
1889 | static SEM_PC | |
1890 | SEM_FN_NAME (sh64_media,fsubd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1891 | { | |
1892 | #define FLD(f) abuf->fields.sfmt_add.f | |
1893 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1894 | int UNUSED written = 0; | |
1895 | IADDR UNUSED pc = abuf->addr; | |
1896 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1897 | ||
1898 | { | |
1899 | DF opval = sh64_fsubd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))); | |
1900 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1901 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1902 | } |
1903 | ||
1904 | return vpc; | |
1905 | #undef FLD | |
1906 | } | |
1907 | ||
1908 | /* fsubs: fsub.s $frg, $frh, $frf */ | |
1909 | ||
1910 | static SEM_PC | |
1911 | SEM_FN_NAME (sh64_media,fsubs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1912 | { | |
1913 | #define FLD(f) abuf->fields.sfmt_add.f | |
1914 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1915 | int UNUSED written = 0; | |
1916 | IADDR UNUSED pc = abuf->addr; | |
1917 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1918 | ||
1919 | { | |
1920 | SF opval = sh64_fsubs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])); | |
1921 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1922 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1923 | } |
1924 | ||
1925 | return vpc; | |
1926 | #undef FLD | |
1927 | } | |
1928 | ||
1929 | /* ftrcdl: ftrc.dl $drgh, $frf */ | |
1930 | ||
1931 | static SEM_PC | |
1932 | SEM_FN_NAME (sh64_media,ftrcdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1933 | { | |
1934 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1935 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1936 | int UNUSED written = 0; | |
1937 | IADDR UNUSED pc = abuf->addr; | |
1938 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1939 | ||
1940 | { | |
1941 | SF opval = sh64_ftrcdl (current_cpu, GET_H_DR (FLD (f_left_right))); | |
1942 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1943 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1944 | } |
1945 | ||
1946 | return vpc; | |
1947 | #undef FLD | |
1948 | } | |
1949 | ||
1950 | /* ftrcsl: ftrc.sl $frgh, $frf */ | |
1951 | ||
1952 | static SEM_PC | |
1953 | SEM_FN_NAME (sh64_media,ftrcsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1954 | { | |
1955 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1956 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1957 | int UNUSED written = 0; | |
1958 | IADDR UNUSED pc = abuf->addr; | |
1959 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1960 | ||
1961 | { | |
1962 | SF opval = sh64_ftrcsl (current_cpu, CPU (h_fr[FLD (f_left_right)])); | |
1963 | CPU (h_fr[FLD (f_dest)]) = opval; | |
1bbd6057 | 1964 | TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval); |
cbb38b47 BE |
1965 | } |
1966 | ||
1967 | return vpc; | |
1968 | #undef FLD | |
1969 | } | |
1970 | ||
1971 | /* ftrcdq: ftrc.dq $drgh, $drf */ | |
1972 | ||
1973 | static SEM_PC | |
1974 | SEM_FN_NAME (sh64_media,ftrcdq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1975 | { | |
1976 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1977 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1978 | int UNUSED written = 0; | |
1979 | IADDR UNUSED pc = abuf->addr; | |
1980 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
1981 | ||
1982 | { | |
1983 | DF opval = sh64_ftrcdq (current_cpu, GET_H_DR (FLD (f_left_right))); | |
1984 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 1985 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
1986 | } |
1987 | ||
1988 | return vpc; | |
1989 | #undef FLD | |
1990 | } | |
1991 | ||
1992 | /* ftrcsq: ftrc.sq $frgh, $drf */ | |
1993 | ||
1994 | static SEM_PC | |
1995 | SEM_FN_NAME (sh64_media,ftrcsq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1996 | { | |
1997 | #define FLD(f) abuf->fields.sfmt_fabsd.f | |
1998 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1999 | int UNUSED written = 0; | |
2000 | IADDR UNUSED pc = abuf->addr; | |
2001 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2002 | ||
2003 | { | |
2004 | DF opval = sh64_ftrcsq (current_cpu, CPU (h_fr[FLD (f_left_right)])); | |
2005 | SET_H_DR (FLD (f_dest), opval); | |
1bbd6057 | 2006 | TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval); |
cbb38b47 BE |
2007 | } |
2008 | ||
2009 | return vpc; | |
2010 | #undef FLD | |
2011 | } | |
2012 | ||
2013 | /* ftrvs: ftrv.s $mtrxg, $fvh, $fvf */ | |
2014 | ||
2015 | static SEM_PC | |
2016 | SEM_FN_NAME (sh64_media,ftrvs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2017 | { | |
2018 | #define FLD(f) abuf->fields.sfmt_add.f | |
2019 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2020 | int UNUSED written = 0; | |
2021 | IADDR UNUSED pc = abuf->addr; | |
2022 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2023 | ||
c7e628df DB |
2024 | { |
2025 | { | |
2026 | SF opval = GET_H_FMTX (FLD (f_left)); | |
2027 | SET_H_FMTX (FLD (f_left), opval); | |
2028 | TRACE_RESULT (current_cpu, abuf, "fmtx", 'f', opval); | |
2029 | } | |
2030 | { | |
2031 | SF opval = GET_H_FV (FLD (f_right)); | |
2032 | SET_H_FV (FLD (f_right), opval); | |
2033 | TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval); | |
2034 | } | |
2035 | { | |
2036 | SF opval = GET_H_FV (FLD (f_dest)); | |
2037 | SET_H_FV (FLD (f_dest), opval); | |
2038 | TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval); | |
2039 | } | |
cbb38b47 | 2040 | sh64_ftrvs (current_cpu, FLD (f_left), FLD (f_right), FLD (f_dest)); |
c7e628df | 2041 | } |
cbb38b47 BE |
2042 | |
2043 | return vpc; | |
2044 | #undef FLD | |
2045 | } | |
2046 | ||
2047 | /* getcfg: getcfg $rm, $disp6, $rd */ | |
2048 | ||
2049 | static SEM_PC | |
2050 | SEM_FN_NAME (sh64_media,getcfg) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2051 | { | |
c7e628df | 2052 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
2053 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2054 | int UNUSED written = 0; | |
2055 | IADDR UNUSED pc = abuf->addr; | |
2056 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2057 | ||
c7e628df DB |
2058 | { |
2059 | SI tmp_address; | |
2060 | tmp_address = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
cbb38b47 | 2061 | ((void) 0); /*nop*/ |
c7e628df DB |
2062 | { |
2063 | DI opval = GETMEMSI (current_cpu, pc, tmp_address); | |
2064 | SET_H_GR (FLD (f_dest), opval); | |
2065 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2066 | } | |
2067 | } | |
cbb38b47 BE |
2068 | |
2069 | return vpc; | |
2070 | #undef FLD | |
2071 | } | |
2072 | ||
2073 | /* getcon: getcon $crk, $rd */ | |
2074 | ||
2075 | static SEM_PC | |
2076 | SEM_FN_NAME (sh64_media,getcon) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2077 | { | |
2078 | #define FLD(f) abuf->fields.sfmt_xori.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, 4); | |
2083 | ||
2084 | { | |
2085 | DI opval = GET_H_CR (FLD (f_left)); | |
2086 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2087 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2088 | } |
2089 | ||
2090 | return vpc; | |
2091 | #undef FLD | |
2092 | } | |
2093 | ||
2094 | /* gettr: gettr $trb, $rd */ | |
2095 | ||
2096 | static SEM_PC | |
2097 | SEM_FN_NAME (sh64_media,gettr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2098 | { | |
2099 | #define FLD(f) abuf->fields.sfmt_blink.f | |
2100 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2101 | int UNUSED written = 0; | |
2102 | IADDR UNUSED pc = abuf->addr; | |
2103 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2104 | ||
2105 | { | |
2106 | DI opval = CPU (h_tr[FLD (f_trb)]); | |
2107 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2108 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2109 | } |
2110 | ||
2111 | return vpc; | |
2112 | #undef FLD | |
2113 | } | |
2114 | ||
2115 | /* icbi: icbi $rm, $disp6x32 */ | |
2116 | ||
2117 | static SEM_PC | |
2118 | SEM_FN_NAME (sh64_media,icbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2119 | { | |
c7e628df | 2120 | #define FLD(f) abuf->fields.sfmt_xori.f |
cbb38b47 BE |
2121 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2122 | int UNUSED written = 0; | |
2123 | IADDR UNUSED pc = abuf->addr; | |
2124 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2125 | ||
c7e628df DB |
2126 | { |
2127 | { | |
2128 | DI opval = GET_H_GR (FLD (f_left)); | |
2129 | SET_H_GR (FLD (f_left), opval); | |
2130 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2131 | } | |
cbb38b47 | 2132 | ((void) 0); /*nop*/ |
c7e628df | 2133 | } |
cbb38b47 BE |
2134 | |
2135 | return vpc; | |
2136 | #undef FLD | |
2137 | } | |
2138 | ||
2139 | /* ldb: ld.b $rm, $disp10, $rd */ | |
2140 | ||
2141 | static SEM_PC | |
2142 | SEM_FN_NAME (sh64_media,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2143 | { | |
2144 | #define FLD(f) abuf->fields.sfmt_addi.f | |
2145 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2146 | int UNUSED written = 0; | |
2147 | IADDR UNUSED pc = abuf->addr; | |
2148 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2149 | ||
2150 | { | |
2151 | DI opval = EXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10))))); | |
2152 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2153 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2154 | } |
2155 | ||
2156 | return vpc; | |
2157 | #undef FLD | |
2158 | } | |
2159 | ||
2160 | /* ldl: ld.l $rm, $disp10x4, $rd */ | |
2161 | ||
2162 | static SEM_PC | |
2163 | SEM_FN_NAME (sh64_media,ldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2164 | { | |
2165 | #define FLD(f) abuf->fields.sfmt_flds.f | |
2166 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2167 | int UNUSED written = 0; | |
2168 | IADDR UNUSED pc = abuf->addr; | |
2169 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2170 | ||
2171 | { | |
2172 | DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x4))))); | |
2173 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2174 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2175 | } |
2176 | ||
2177 | return vpc; | |
2178 | #undef FLD | |
2179 | } | |
2180 | ||
2181 | /* ldq: ld.q $rm, $disp10x8, $rd */ | |
2182 | ||
2183 | static SEM_PC | |
2184 | SEM_FN_NAME (sh64_media,ldq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2185 | { | |
2186 | #define FLD(f) abuf->fields.sfmt_fldd.f | |
2187 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2188 | int UNUSED written = 0; | |
2189 | IADDR UNUSED pc = abuf->addr; | |
2190 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2191 | ||
2192 | { | |
2193 | DI opval = GETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x8)))); | |
2194 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2195 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2196 | } |
2197 | ||
2198 | return vpc; | |
2199 | #undef FLD | |
2200 | } | |
2201 | ||
2202 | /* ldub: ld.ub $rm, $disp10, $rd */ | |
2203 | ||
2204 | static SEM_PC | |
2205 | SEM_FN_NAME (sh64_media,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2206 | { | |
2207 | #define FLD(f) abuf->fields.sfmt_addi.f | |
2208 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2209 | int UNUSED written = 0; | |
2210 | IADDR UNUSED pc = abuf->addr; | |
2211 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2212 | ||
2213 | { | |
2214 | DI opval = ZEXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10))))); | |
2215 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2216 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2217 | } |
2218 | ||
2219 | return vpc; | |
2220 | #undef FLD | |
2221 | } | |
2222 | ||
2223 | /* lduw: ld.uw $rm, $disp10x2, $rd */ | |
2224 | ||
2225 | static SEM_PC | |
2226 | SEM_FN_NAME (sh64_media,lduw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2227 | { | |
2228 | #define FLD(f) abuf->fields.sfmt_lduw.f | |
2229 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2230 | int UNUSED written = 0; | |
2231 | IADDR UNUSED pc = abuf->addr; | |
2232 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2233 | ||
2234 | { | |
2235 | DI opval = ZEXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2))))); | |
2236 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2237 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2238 | } |
2239 | ||
2240 | return vpc; | |
2241 | #undef FLD | |
2242 | } | |
2243 | ||
2244 | /* ldw: ld.w $rm, $disp10x2, $rd */ | |
2245 | ||
2246 | static SEM_PC | |
2247 | SEM_FN_NAME (sh64_media,ldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2248 | { | |
2249 | #define FLD(f) abuf->fields.sfmt_lduw.f | |
2250 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2251 | int UNUSED written = 0; | |
2252 | IADDR UNUSED pc = abuf->addr; | |
2253 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2254 | ||
2255 | { | |
2256 | DI opval = EXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2))))); | |
2257 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2258 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2259 | } |
2260 | ||
2261 | return vpc; | |
2262 | #undef FLD | |
2263 | } | |
2264 | ||
2265 | /* ldhil: ldhi.l $rm, $disp6, $rd */ | |
2266 | ||
2267 | static SEM_PC | |
2268 | SEM_FN_NAME (sh64_media,ldhil) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2269 | { | |
c7e628df | 2270 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
2271 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2272 | int UNUSED written = 0; | |
2273 | IADDR UNUSED pc = abuf->addr; | |
2274 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2275 | ||
1bbd6057 JR |
2276 | { |
2277 | DI tmp_addr; | |
2278 | QI tmp_bytecount; | |
2279 | SI tmp_val; | |
2280 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
2281 | tmp_bytecount = ADDDI (ANDDI (tmp_addr, 3), 1); | |
2282 | tmp_val = 0; | |
2283 | if (ANDQI (tmp_bytecount, 4)) { | |
2284 | { | |
2285 | DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -4))); | |
2286 | SET_H_GR (FLD (f_dest), opval); | |
2287 | written |= (1 << 6); | |
2288 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2289 | } | |
2290 | } else { | |
2291 | if (GET_H_ENDIAN ()) { | |
2292 | { | |
2293 | if (ANDQI (tmp_bytecount, 2)) { | |
2294 | tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4)))); | |
2295 | } | |
2296 | if (ANDQI (tmp_bytecount, 1)) { | |
2297 | tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr))); | |
2298 | } | |
2299 | { | |
2300 | DI opval = EXTSIDI (tmp_val); | |
2301 | SET_H_GR (FLD (f_dest), opval); | |
2302 | written |= (1 << 6); | |
2303 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2304 | } | |
2305 | } | |
2306 | } else { | |
2307 | { | |
2308 | if (ANDQI (tmp_bytecount, 1)) { | |
2309 | tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr))); | |
2310 | } | |
2311 | if (ANDQI (tmp_bytecount, 2)) { | |
2312 | tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4)))); | |
2313 | } | |
2314 | { | |
2315 | DI opval = EXTSIDI (SLLSI (tmp_val, SUBSI (32, MULSI (8, tmp_bytecount)))); | |
2316 | SET_H_GR (FLD (f_dest), opval); | |
2317 | written |= (1 << 6); | |
2318 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2319 | } | |
2320 | } | |
2321 | } | |
2322 | } | |
2323 | } | |
cbb38b47 | 2324 | |
1bbd6057 | 2325 | abuf->written = written; |
cbb38b47 BE |
2326 | return vpc; |
2327 | #undef FLD | |
2328 | } | |
2329 | ||
2330 | /* ldhiq: ldhi.q $rm, $disp6, $rd */ | |
2331 | ||
2332 | static SEM_PC | |
2333 | SEM_FN_NAME (sh64_media,ldhiq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2334 | { | |
c7e628df | 2335 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
2336 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2337 | int UNUSED written = 0; | |
2338 | IADDR UNUSED pc = abuf->addr; | |
2339 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2340 | ||
1bbd6057 JR |
2341 | { |
2342 | DI tmp_addr; | |
2343 | QI tmp_bytecount; | |
2344 | DI tmp_val; | |
2345 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
2346 | tmp_bytecount = ADDDI (ANDDI (tmp_addr, 7), 1); | |
2347 | tmp_val = 0; | |
2348 | if (ANDQI (tmp_bytecount, 8)) { | |
2349 | { | |
2350 | DI opval = GETMEMDI (current_cpu, pc, ANDDI (tmp_addr, -8)); | |
2351 | SET_H_GR (FLD (f_dest), opval); | |
2352 | written |= (1 << 7); | |
2353 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2354 | } | |
2355 | } else { | |
2356 | if (GET_H_ENDIAN ()) { | |
2357 | { | |
2358 | if (ANDQI (tmp_bytecount, 4)) { | |
2359 | tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8)))); | |
2360 | } | |
2361 | if (ANDQI (tmp_bytecount, 2)) { | |
2362 | tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4)))); | |
2363 | } | |
2364 | if (ANDQI (tmp_bytecount, 1)) { | |
2365 | tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr))); | |
2366 | } | |
2367 | { | |
2368 | DI opval = tmp_val; | |
2369 | SET_H_GR (FLD (f_dest), opval); | |
2370 | written |= (1 << 7); | |
2371 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2372 | } | |
2373 | } | |
2374 | } else { | |
2375 | { | |
2376 | if (ANDQI (tmp_bytecount, 1)) { | |
2377 | tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr))); | |
2378 | } | |
2379 | if (ANDQI (tmp_bytecount, 2)) { | |
2380 | tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4)))); | |
2381 | } | |
2382 | if (ANDQI (tmp_bytecount, 4)) { | |
2383 | tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8)))); | |
2384 | } | |
2385 | { | |
2386 | DI opval = SLLDI (tmp_val, SUBSI (64, MULSI (8, tmp_bytecount))); | |
2387 | SET_H_GR (FLD (f_dest), opval); | |
2388 | written |= (1 << 7); | |
2389 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2390 | } | |
2391 | } | |
2392 | } | |
2393 | } | |
2394 | } | |
cbb38b47 | 2395 | |
1bbd6057 | 2396 | abuf->written = written; |
cbb38b47 BE |
2397 | return vpc; |
2398 | #undef FLD | |
2399 | } | |
2400 | ||
2401 | /* ldlol: ldlo.l $rm, $disp6, $rd */ | |
2402 | ||
2403 | static SEM_PC | |
2404 | SEM_FN_NAME (sh64_media,ldlol) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2405 | { | |
c7e628df | 2406 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
2407 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2408 | int UNUSED written = 0; | |
2409 | IADDR UNUSED pc = abuf->addr; | |
2410 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2411 | ||
1bbd6057 JR |
2412 | { |
2413 | DI tmp_addr; | |
2414 | QI tmp_bytecount; | |
2415 | SI tmp_val; | |
2416 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
2417 | tmp_bytecount = SUBSI (4, ANDDI (tmp_addr, 3)); | |
2418 | tmp_val = 0; | |
2419 | if (ANDQI (tmp_bytecount, 4)) { | |
2420 | { | |
2421 | DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, tmp_addr)); | |
2422 | SET_H_GR (FLD (f_dest), opval); | |
2423 | written |= (1 << 6); | |
2424 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2425 | } | |
2426 | } else { | |
2427 | if (GET_H_ENDIAN ()) { | |
2428 | { | |
2429 | if (ANDQI (tmp_bytecount, 1)) { | |
2430 | tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr))); | |
2431 | } | |
2432 | if (ANDQI (tmp_bytecount, 2)) { | |
2433 | tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2)))); | |
2434 | } | |
2435 | { | |
2436 | DI opval = EXTSIDI (SLLSI (tmp_val, SUBSI (32, MULSI (8, tmp_bytecount)))); | |
2437 | SET_H_GR (FLD (f_dest), opval); | |
2438 | written |= (1 << 6); | |
2439 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2440 | } | |
2441 | } | |
2442 | } else { | |
2443 | { | |
2444 | if (ANDQI (tmp_bytecount, 2)) { | |
2445 | tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2)))); | |
2446 | } | |
2447 | if (ANDQI (tmp_bytecount, 1)) { | |
2448 | tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr))); | |
2449 | } | |
2450 | { | |
2451 | DI opval = EXTSIDI (tmp_val); | |
2452 | SET_H_GR (FLD (f_dest), opval); | |
2453 | written |= (1 << 6); | |
2454 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2455 | } | |
2456 | } | |
2457 | } | |
2458 | } | |
2459 | } | |
cbb38b47 | 2460 | |
1bbd6057 | 2461 | abuf->written = written; |
cbb38b47 BE |
2462 | return vpc; |
2463 | #undef FLD | |
2464 | } | |
2465 | ||
2466 | /* ldloq: ldlo.q $rm, $disp6, $rd */ | |
2467 | ||
2468 | static SEM_PC | |
2469 | SEM_FN_NAME (sh64_media,ldloq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2470 | { | |
c7e628df | 2471 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
2472 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2473 | int UNUSED written = 0; | |
2474 | IADDR UNUSED pc = abuf->addr; | |
2475 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2476 | ||
1bbd6057 JR |
2477 | { |
2478 | DI tmp_addr; | |
2479 | QI tmp_bytecount; | |
2480 | DI tmp_val; | |
2481 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
2482 | tmp_bytecount = SUBSI (8, ANDDI (tmp_addr, 7)); | |
2483 | tmp_val = 0; | |
2484 | if (ANDQI (tmp_bytecount, 8)) { | |
2485 | { | |
2486 | DI opval = GETMEMDI (current_cpu, pc, tmp_addr); | |
2487 | SET_H_GR (FLD (f_dest), opval); | |
2488 | written |= (1 << 7); | |
2489 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2490 | } | |
2491 | } else { | |
2492 | if (GET_H_ENDIAN ()) { | |
2493 | { | |
2494 | if (ANDQI (tmp_bytecount, 1)) { | |
2495 | tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr))); | |
2496 | } | |
2497 | if (ANDQI (tmp_bytecount, 2)) { | |
2498 | tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2)))); | |
2499 | } | |
2500 | if (ANDQI (tmp_bytecount, 4)) { | |
2501 | tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4)))); | |
2502 | } | |
2503 | { | |
2504 | DI opval = SLLDI (tmp_val, SUBSI (64, MULSI (8, tmp_bytecount))); | |
2505 | SET_H_GR (FLD (f_dest), opval); | |
2506 | written |= (1 << 7); | |
2507 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2508 | } | |
2509 | } | |
2510 | } else { | |
2511 | { | |
2512 | if (ANDQI (tmp_bytecount, 4)) { | |
2513 | tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4)))); | |
2514 | } | |
2515 | if (ANDQI (tmp_bytecount, 2)) { | |
2516 | tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2)))); | |
2517 | } | |
2518 | if (ANDQI (tmp_bytecount, 1)) { | |
2519 | tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr))); | |
2520 | } | |
2521 | { | |
2522 | DI opval = tmp_val; | |
2523 | SET_H_GR (FLD (f_dest), opval); | |
2524 | written |= (1 << 7); | |
2525 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
2526 | } | |
2527 | } | |
2528 | } | |
2529 | } | |
2530 | } | |
cbb38b47 | 2531 | |
1bbd6057 | 2532 | abuf->written = written; |
cbb38b47 BE |
2533 | return vpc; |
2534 | #undef FLD | |
2535 | } | |
2536 | ||
2537 | /* ldxb: ldx.b $rm, $rn, $rd */ | |
2538 | ||
2539 | static SEM_PC | |
2540 | SEM_FN_NAME (sh64_media,ldxb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2541 | { | |
2542 | #define FLD(f) abuf->fields.sfmt_add.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, 4); | |
2547 | ||
2548 | { | |
2549 | DI opval = EXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))))); | |
2550 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2551 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2552 | } |
2553 | ||
2554 | return vpc; | |
2555 | #undef FLD | |
2556 | } | |
2557 | ||
2558 | /* ldxl: ldx.l $rm, $rn, $rd */ | |
2559 | ||
2560 | static SEM_PC | |
2561 | SEM_FN_NAME (sh64_media,ldxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2562 | { | |
2563 | #define FLD(f) abuf->fields.sfmt_add.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, 4); | |
2568 | ||
2569 | { | |
2570 | DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))))); | |
2571 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2572 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2573 | } |
2574 | ||
2575 | return vpc; | |
2576 | #undef FLD | |
2577 | } | |
2578 | ||
2579 | /* ldxq: ldx.q $rm, $rn, $rd */ | |
2580 | ||
2581 | static SEM_PC | |
2582 | SEM_FN_NAME (sh64_media,ldxq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2583 | { | |
2584 | #define FLD(f) abuf->fields.sfmt_add.f | |
2585 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2586 | int UNUSED written = 0; | |
2587 | IADDR UNUSED pc = abuf->addr; | |
2588 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2589 | ||
2590 | { | |
2591 | DI opval = GETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))); | |
2592 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2593 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2594 | } |
2595 | ||
2596 | return vpc; | |
2597 | #undef FLD | |
2598 | } | |
2599 | ||
2600 | /* ldxub: ldx.ub $rm, $rn, $rd */ | |
2601 | ||
2602 | static SEM_PC | |
2603 | SEM_FN_NAME (sh64_media,ldxub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2604 | { | |
2605 | #define FLD(f) abuf->fields.sfmt_add.f | |
2606 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2607 | int UNUSED written = 0; | |
2608 | IADDR UNUSED pc = abuf->addr; | |
2609 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2610 | ||
2611 | { | |
2612 | DI opval = ZEXTQIDI (GETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))))); | |
2613 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2614 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2615 | } |
2616 | ||
2617 | return vpc; | |
2618 | #undef FLD | |
2619 | } | |
2620 | ||
2621 | /* ldxuw: ldx.uw $rm, $rn, $rd */ | |
2622 | ||
2623 | static SEM_PC | |
2624 | SEM_FN_NAME (sh64_media,ldxuw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2625 | { | |
2626 | #define FLD(f) abuf->fields.sfmt_add.f | |
2627 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2628 | int UNUSED written = 0; | |
2629 | IADDR UNUSED pc = abuf->addr; | |
2630 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2631 | ||
2632 | { | |
2633 | DI opval = ZEXTHIDI (GETMEMUHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))))); | |
2634 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2635 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2636 | } |
2637 | ||
2638 | return vpc; | |
2639 | #undef FLD | |
2640 | } | |
2641 | ||
2642 | /* ldxw: ldx.w $rm, $rn, $rd */ | |
2643 | ||
2644 | static SEM_PC | |
2645 | SEM_FN_NAME (sh64_media,ldxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2646 | { | |
2647 | #define FLD(f) abuf->fields.sfmt_add.f | |
2648 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2649 | int UNUSED written = 0; | |
2650 | IADDR UNUSED pc = abuf->addr; | |
2651 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2652 | ||
2653 | { | |
2654 | DI opval = EXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))))); | |
2655 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2656 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2657 | } |
2658 | ||
2659 | return vpc; | |
2660 | #undef FLD | |
2661 | } | |
2662 | ||
2663 | /* mabsl: mabs.l $rm, $rd */ | |
2664 | ||
2665 | static SEM_PC | |
2666 | SEM_FN_NAME (sh64_media,mabsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2667 | { | |
2668 | #define FLD(f) abuf->fields.sfmt_xori.f | |
2669 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2670 | int UNUSED written = 0; | |
2671 | IADDR UNUSED pc = abuf->addr; | |
2672 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2673 | ||
2674 | { | |
2675 | SI tmp_result1; | |
2676 | SI tmp_result0; | |
2677 | tmp_result0 = ABSSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)); | |
2678 | tmp_result1 = ABSSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)); | |
2679 | { | |
2680 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
2681 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2682 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2683 | } |
2684 | } | |
2685 | ||
2686 | return vpc; | |
2687 | #undef FLD | |
2688 | } | |
2689 | ||
2690 | /* mabsw: mabs.w $rm, $rd */ | |
2691 | ||
2692 | static SEM_PC | |
2693 | SEM_FN_NAME (sh64_media,mabsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2694 | { | |
2695 | #define FLD(f) abuf->fields.sfmt_xori.f | |
2696 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2697 | int UNUSED written = 0; | |
2698 | IADDR UNUSED pc = abuf->addr; | |
2699 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2700 | ||
2701 | { | |
2702 | HI tmp_result3; | |
2703 | HI tmp_result2; | |
2704 | HI tmp_result1; | |
2705 | HI tmp_result0; | |
2706 | tmp_result0 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)); | |
2707 | tmp_result1 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)); | |
2708 | tmp_result2 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)); | |
2709 | tmp_result3 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)); | |
2710 | { | |
2711 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
2712 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2713 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2714 | } |
2715 | } | |
2716 | ||
2717 | return vpc; | |
2718 | #undef FLD | |
2719 | } | |
2720 | ||
2721 | /* maddl: madd.l $rm, $rn, $rd */ | |
2722 | ||
2723 | static SEM_PC | |
2724 | SEM_FN_NAME (sh64_media,maddl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2725 | { | |
2726 | #define FLD(f) abuf->fields.sfmt_add.f | |
2727 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2728 | int UNUSED written = 0; | |
2729 | IADDR UNUSED pc = abuf->addr; | |
2730 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2731 | ||
2732 | { | |
2733 | SI tmp_result1; | |
2734 | SI tmp_result0; | |
2735 | tmp_result0 = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)); | |
2736 | tmp_result1 = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)); | |
2737 | { | |
2738 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
2739 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2740 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2741 | } |
2742 | } | |
2743 | ||
2744 | return vpc; | |
2745 | #undef FLD | |
2746 | } | |
2747 | ||
2748 | /* maddw: madd.w $rm, $rn, $rd */ | |
2749 | ||
2750 | static SEM_PC | |
2751 | SEM_FN_NAME (sh64_media,maddw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2752 | { | |
2753 | #define FLD(f) abuf->fields.sfmt_add.f | |
2754 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2755 | int UNUSED written = 0; | |
2756 | IADDR UNUSED pc = abuf->addr; | |
2757 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2758 | ||
2759 | { | |
2760 | HI tmp_result3; | |
2761 | HI tmp_result2; | |
2762 | HI tmp_result1; | |
2763 | HI tmp_result0; | |
2764 | tmp_result0 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)); | |
2765 | tmp_result1 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)); | |
2766 | tmp_result2 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)); | |
2767 | tmp_result3 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)); | |
2768 | { | |
2769 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
2770 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2771 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2772 | } |
2773 | } | |
2774 | ||
2775 | return vpc; | |
2776 | #undef FLD | |
2777 | } | |
2778 | ||
2779 | /* maddsl: madds.l $rm, $rn, $rd */ | |
2780 | ||
2781 | static SEM_PC | |
2782 | SEM_FN_NAME (sh64_media,maddsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2783 | { | |
2784 | #define FLD(f) abuf->fields.sfmt_add.f | |
2785 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2786 | int UNUSED written = 0; | |
2787 | IADDR UNUSED pc = abuf->addr; | |
2788 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2789 | ||
2790 | { | |
2791 | SI tmp_result1; | |
2792 | SI tmp_result0; | |
1bbd6057 JR |
2793 | tmp_result0 = ((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); |
2794 | tmp_result1 = ((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
cbb38b47 BE |
2795 | { |
2796 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
2797 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2798 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2799 | } |
2800 | } | |
2801 | ||
2802 | return vpc; | |
2803 | #undef FLD | |
2804 | } | |
2805 | ||
2806 | /* maddsub: madds.ub $rm, $rn, $rd */ | |
2807 | ||
2808 | static SEM_PC | |
2809 | SEM_FN_NAME (sh64_media,maddsub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2810 | { | |
2811 | #define FLD(f) abuf->fields.sfmt_add.f | |
2812 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2813 | int UNUSED written = 0; | |
2814 | IADDR UNUSED pc = abuf->addr; | |
2815 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2816 | ||
2817 | { | |
2818 | QI tmp_result7; | |
2819 | QI tmp_result6; | |
2820 | QI tmp_result5; | |
2821 | QI tmp_result4; | |
2822 | QI tmp_result3; | |
2823 | QI tmp_result2; | |
2824 | QI tmp_result1; | |
2825 | QI tmp_result0; | |
1bbd6057 JR |
2826 | tmp_result0 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBQI (SLLQI (1, 8), 1))))); |
2827 | tmp_result1 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
2828 | tmp_result2 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
2829 | tmp_result3 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
2830 | tmp_result4 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
2831 | tmp_result5 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
2832 | tmp_result6 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
2833 | tmp_result7 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
cbb38b47 BE |
2834 | { |
2835 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
2836 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2837 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2838 | } |
2839 | } | |
2840 | ||
2841 | return vpc; | |
2842 | #undef FLD | |
2843 | } | |
2844 | ||
2845 | /* maddsw: madds.w $rm, $rn, $rd */ | |
2846 | ||
2847 | static SEM_PC | |
2848 | SEM_FN_NAME (sh64_media,maddsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2849 | { | |
2850 | #define FLD(f) abuf->fields.sfmt_add.f | |
2851 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2852 | int UNUSED written = 0; | |
2853 | IADDR UNUSED pc = abuf->addr; | |
2854 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2855 | ||
2856 | { | |
2857 | HI tmp_result3; | |
2858 | HI tmp_result2; | |
2859 | HI tmp_result1; | |
2860 | HI tmp_result0; | |
1bbd6057 JR |
2861 | tmp_result0 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); |
2862 | tmp_result1 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
2863 | tmp_result2 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
2864 | tmp_result3 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
cbb38b47 BE |
2865 | { |
2866 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
2867 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2868 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2869 | } |
2870 | } | |
2871 | ||
2872 | return vpc; | |
2873 | #undef FLD | |
2874 | } | |
2875 | ||
2876 | /* mcmpeqb: mcmpeq.b $rm, $rn, $rd */ | |
2877 | ||
2878 | static SEM_PC | |
2879 | SEM_FN_NAME (sh64_media,mcmpeqb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2880 | { | |
2881 | #define FLD(f) abuf->fields.sfmt_add.f | |
2882 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2883 | int UNUSED written = 0; | |
2884 | IADDR UNUSED pc = abuf->addr; | |
2885 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2886 | ||
2887 | { | |
2888 | QI tmp_result7; | |
2889 | QI tmp_result6; | |
2890 | QI tmp_result5; | |
2891 | QI tmp_result4; | |
2892 | QI tmp_result3; | |
2893 | QI tmp_result2; | |
2894 | QI tmp_result1; | |
2895 | QI tmp_result0; | |
2896 | tmp_result0 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))) ? (INVQI (0)) : (0)); | |
2897 | tmp_result1 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))) ? (INVQI (0)) : (0)); | |
2898 | tmp_result2 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))) ? (INVQI (0)) : (0)); | |
2899 | tmp_result3 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))) ? (INVQI (0)) : (0)); | |
2900 | tmp_result4 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))) ? (INVQI (0)) : (0)); | |
2901 | tmp_result5 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))) ? (INVQI (0)) : (0)); | |
2902 | tmp_result6 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))) ? (INVQI (0)) : (0)); | |
2903 | tmp_result7 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))) ? (INVQI (0)) : (0)); | |
2904 | { | |
2905 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
2906 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2907 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2908 | } |
2909 | } | |
2910 | ||
2911 | return vpc; | |
2912 | #undef FLD | |
2913 | } | |
2914 | ||
2915 | /* mcmpeql: mcmpeq.l $rm, $rn, $rd */ | |
2916 | ||
2917 | static SEM_PC | |
2918 | SEM_FN_NAME (sh64_media,mcmpeql) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2919 | { | |
2920 | #define FLD(f) abuf->fields.sfmt_add.f | |
2921 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2922 | int UNUSED written = 0; | |
2923 | IADDR UNUSED pc = abuf->addr; | |
2924 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2925 | ||
2926 | { | |
2927 | SI tmp_result1; | |
2928 | SI tmp_result0; | |
2929 | tmp_result0 = ((EQSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))) ? (INVSI (0)) : (0)); | |
2930 | tmp_result1 = ((EQSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))) ? (INVSI (0)) : (0)); | |
2931 | { | |
2932 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
2933 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2934 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2935 | } |
2936 | } | |
2937 | ||
2938 | return vpc; | |
2939 | #undef FLD | |
2940 | } | |
2941 | ||
2942 | /* mcmpeqw: mcmpeq.w $rm, $rn, $rd */ | |
2943 | ||
2944 | static SEM_PC | |
2945 | SEM_FN_NAME (sh64_media,mcmpeqw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2946 | { | |
2947 | #define FLD(f) abuf->fields.sfmt_add.f | |
2948 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2949 | int UNUSED written = 0; | |
2950 | IADDR UNUSED pc = abuf->addr; | |
2951 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2952 | ||
2953 | { | |
2954 | HI tmp_result3; | |
2955 | HI tmp_result2; | |
2956 | HI tmp_result1; | |
2957 | HI tmp_result0; | |
2958 | tmp_result0 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))) ? (INVHI (0)) : (0)); | |
2959 | tmp_result1 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))) ? (INVHI (0)) : (0)); | |
2960 | tmp_result2 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))) ? (INVHI (0)) : (0)); | |
2961 | tmp_result3 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))) ? (INVHI (0)) : (0)); | |
2962 | { | |
2963 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
2964 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2965 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2966 | } |
2967 | } | |
2968 | ||
2969 | return vpc; | |
2970 | #undef FLD | |
2971 | } | |
2972 | ||
2973 | /* mcmpgtl: mcmpgt.l $rm, $rn, $rd */ | |
2974 | ||
2975 | static SEM_PC | |
2976 | SEM_FN_NAME (sh64_media,mcmpgtl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2977 | { | |
2978 | #define FLD(f) abuf->fields.sfmt_add.f | |
2979 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2980 | int UNUSED written = 0; | |
2981 | IADDR UNUSED pc = abuf->addr; | |
2982 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
2983 | ||
2984 | { | |
2985 | SI tmp_result1; | |
2986 | SI tmp_result0; | |
2987 | tmp_result0 = ((GTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))) ? (INVSI (0)) : (0)); | |
2988 | tmp_result1 = ((GTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))) ? (INVSI (0)) : (0)); | |
2989 | { | |
2990 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
2991 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 2992 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
2993 | } |
2994 | } | |
2995 | ||
2996 | return vpc; | |
2997 | #undef FLD | |
2998 | } | |
2999 | ||
3000 | /* mcmpgtub: mcmpgt.ub $rm, $rn, $rd */ | |
3001 | ||
3002 | static SEM_PC | |
3003 | SEM_FN_NAME (sh64_media,mcmpgtub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3004 | { | |
3005 | #define FLD(f) abuf->fields.sfmt_add.f | |
3006 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3007 | int UNUSED written = 0; | |
3008 | IADDR UNUSED pc = abuf->addr; | |
3009 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3010 | ||
3011 | { | |
3012 | QI tmp_result7; | |
3013 | QI tmp_result6; | |
3014 | QI tmp_result5; | |
3015 | QI tmp_result4; | |
3016 | QI tmp_result3; | |
3017 | QI tmp_result2; | |
3018 | QI tmp_result1; | |
3019 | QI tmp_result0; | |
3020 | tmp_result0 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))) ? (INVQI (0)) : (0)); | |
3021 | tmp_result1 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))) ? (INVQI (0)) : (0)); | |
3022 | tmp_result2 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))) ? (INVQI (0)) : (0)); | |
3023 | tmp_result3 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))) ? (INVQI (0)) : (0)); | |
3024 | tmp_result4 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))) ? (INVQI (0)) : (0)); | |
3025 | tmp_result5 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))) ? (INVQI (0)) : (0)); | |
3026 | tmp_result6 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))) ? (INVQI (0)) : (0)); | |
3027 | tmp_result7 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))) ? (INVQI (0)) : (0)); | |
3028 | { | |
3029 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
3030 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3031 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3032 | } |
3033 | } | |
3034 | ||
3035 | return vpc; | |
3036 | #undef FLD | |
3037 | } | |
3038 | ||
3039 | /* mcmpgtw: mcmpgt.w $rm, $rn, $rd */ | |
3040 | ||
3041 | static SEM_PC | |
3042 | SEM_FN_NAME (sh64_media,mcmpgtw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3043 | { | |
3044 | #define FLD(f) abuf->fields.sfmt_add.f | |
3045 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3046 | int UNUSED written = 0; | |
3047 | IADDR UNUSED pc = abuf->addr; | |
3048 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3049 | ||
3050 | { | |
3051 | HI tmp_result3; | |
3052 | HI tmp_result2; | |
3053 | HI tmp_result1; | |
3054 | HI tmp_result0; | |
3055 | tmp_result0 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))) ? (INVHI (0)) : (0)); | |
3056 | tmp_result1 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))) ? (INVHI (0)) : (0)); | |
3057 | tmp_result2 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))) ? (INVHI (0)) : (0)); | |
3058 | tmp_result3 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))) ? (INVHI (0)) : (0)); | |
3059 | { | |
3060 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
3061 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3062 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3063 | } |
3064 | } | |
3065 | ||
3066 | return vpc; | |
3067 | #undef FLD | |
3068 | } | |
3069 | ||
3070 | /* mcmv: mcmv $rm, $rn, $rd */ | |
3071 | ||
3072 | static SEM_PC | |
3073 | SEM_FN_NAME (sh64_media,mcmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3074 | { | |
3075 | #define FLD(f) abuf->fields.sfmt_add.f | |
3076 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3077 | int UNUSED written = 0; | |
3078 | IADDR UNUSED pc = abuf->addr; | |
3079 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3080 | ||
3081 | { | |
3082 | DI opval = ORDI (ANDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), ANDDI (GET_H_GR (FLD (f_dest)), INVDI (GET_H_GR (FLD (f_right))))); | |
3083 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3084 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3085 | } |
3086 | ||
3087 | return vpc; | |
3088 | #undef FLD | |
3089 | } | |
3090 | ||
3091 | /* mcnvslw: mcnvs.lw $rm, $rn, $rd */ | |
3092 | ||
3093 | static SEM_PC | |
3094 | SEM_FN_NAME (sh64_media,mcnvslw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3095 | { | |
3096 | #define FLD(f) abuf->fields.sfmt_add.f | |
3097 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3098 | int UNUSED written = 0; | |
3099 | IADDR UNUSED pc = abuf->addr; | |
3100 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3101 | ||
3102 | { | |
3103 | HI tmp_result3; | |
3104 | HI tmp_result2; | |
3105 | HI tmp_result1; | |
3106 | HI tmp_result0; | |
1bbd6057 JR |
3107 | tmp_result0 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); |
3108 | tmp_result1 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
3109 | tmp_result2 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
3110 | tmp_result3 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
cbb38b47 BE |
3111 | { |
3112 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
3113 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3114 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3115 | } |
3116 | } | |
3117 | ||
3118 | return vpc; | |
3119 | #undef FLD | |
3120 | } | |
3121 | ||
3122 | /* mcnvswb: mcnvs.wb $rm, $rn, $rd */ | |
3123 | ||
3124 | static SEM_PC | |
3125 | SEM_FN_NAME (sh64_media,mcnvswb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3126 | { | |
3127 | #define FLD(f) abuf->fields.sfmt_add.f | |
3128 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3129 | int UNUSED written = 0; | |
3130 | IADDR UNUSED pc = abuf->addr; | |
3131 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3132 | ||
3133 | { | |
3134 | QI tmp_result7; | |
3135 | QI tmp_result6; | |
3136 | QI tmp_result5; | |
3137 | QI tmp_result4; | |
3138 | QI tmp_result3; | |
3139 | QI tmp_result2; | |
3140 | QI tmp_result1; | |
3141 | QI tmp_result0; | |
1bbd6057 JR |
3142 | tmp_result0 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1))))); |
3143 | tmp_result1 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1))))); | |
3144 | tmp_result2 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1))))); | |
3145 | tmp_result3 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1))))); | |
3146 | tmp_result4 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1))))); | |
3147 | tmp_result5 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1))))); | |
3148 | tmp_result6 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1))))); | |
3149 | tmp_result7 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1))))); | |
cbb38b47 BE |
3150 | { |
3151 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
3152 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3153 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3154 | } |
3155 | } | |
3156 | ||
3157 | return vpc; | |
3158 | #undef FLD | |
3159 | } | |
3160 | ||
3161 | /* mcnvswub: mcnvs.wub $rm, $rn, $rd */ | |
3162 | ||
3163 | static SEM_PC | |
3164 | SEM_FN_NAME (sh64_media,mcnvswub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3165 | { | |
3166 | #define FLD(f) abuf->fields.sfmt_add.f | |
3167 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3168 | int UNUSED written = 0; | |
3169 | IADDR UNUSED pc = abuf->addr; | |
3170 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3171 | ||
3172 | { | |
3173 | QI tmp_result7; | |
3174 | QI tmp_result6; | |
3175 | QI tmp_result5; | |
3176 | QI tmp_result4; | |
3177 | QI tmp_result3; | |
3178 | QI tmp_result2; | |
3179 | QI tmp_result1; | |
3180 | QI tmp_result0; | |
1bbd6057 JR |
3181 | tmp_result0 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)) : (SUBQI (SLLQI (1, 8), 1))))); |
3182 | tmp_result1 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)) : (SUBQI (SLLQI (1, 8), 1))))); | |
3183 | tmp_result2 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)) : (SUBQI (SLLQI (1, 8), 1))))); | |
3184 | tmp_result3 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)) : (SUBQI (SLLQI (1, 8), 1))))); | |
3185 | tmp_result4 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)) : (SUBQI (SLLQI (1, 8), 1))))); | |
3186 | tmp_result5 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)) : (SUBQI (SLLQI (1, 8), 1))))); | |
3187 | tmp_result6 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)) : (SUBQI (SLLQI (1, 8), 1))))); | |
3188 | tmp_result7 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)) : (SUBQI (SLLQI (1, 8), 1))))); | |
cbb38b47 BE |
3189 | { |
3190 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
3191 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3192 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3193 | } |
3194 | } | |
3195 | ||
3196 | return vpc; | |
3197 | #undef FLD | |
3198 | } | |
3199 | ||
3200 | /* mextr1: mextr1 $rm, $rn, $rd */ | |
3201 | ||
3202 | static SEM_PC | |
3203 | SEM_FN_NAME (sh64_media,mextr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3204 | { | |
3205 | #define FLD(f) abuf->fields.sfmt_add.f | |
3206 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3207 | int UNUSED written = 0; | |
3208 | IADDR UNUSED pc = abuf->addr; | |
3209 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3210 | ||
3211 | { | |
3212 | QI tmp_count; | |
3213 | DI tmp_mask; | |
3214 | DI tmp_rhs; | |
1bbd6057 | 3215 | tmp_count = MULQI (8, 1); |
cbb38b47 BE |
3216 | tmp_mask = SLLDI (INVSI (0), tmp_count); |
3217 | tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count); | |
1bbd6057 | 3218 | tmp_count = MULQI (8, SUBQI (8, 1)); |
cbb38b47 BE |
3219 | tmp_mask = SRLDI (INVSI (0), tmp_count); |
3220 | { | |
3221 | DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count)); | |
3222 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3223 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3224 | } |
3225 | } | |
3226 | ||
3227 | return vpc; | |
3228 | #undef FLD | |
3229 | } | |
3230 | ||
3231 | /* mextr2: mextr2 $rm, $rn, $rd */ | |
3232 | ||
3233 | static SEM_PC | |
3234 | SEM_FN_NAME (sh64_media,mextr2) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3235 | { | |
3236 | #define FLD(f) abuf->fields.sfmt_add.f | |
3237 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3238 | int UNUSED written = 0; | |
3239 | IADDR UNUSED pc = abuf->addr; | |
3240 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3241 | ||
3242 | { | |
3243 | QI tmp_count; | |
3244 | DI tmp_mask; | |
3245 | DI tmp_rhs; | |
1bbd6057 | 3246 | tmp_count = MULQI (8, 2); |
cbb38b47 BE |
3247 | tmp_mask = SLLDI (INVSI (0), tmp_count); |
3248 | tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count); | |
1bbd6057 | 3249 | tmp_count = MULQI (8, SUBQI (8, 2)); |
cbb38b47 BE |
3250 | tmp_mask = SRLDI (INVSI (0), tmp_count); |
3251 | { | |
3252 | DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count)); | |
3253 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3254 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3255 | } |
3256 | } | |
3257 | ||
3258 | return vpc; | |
3259 | #undef FLD | |
3260 | } | |
3261 | ||
3262 | /* mextr3: mextr3 $rm, $rn, $rd */ | |
3263 | ||
3264 | static SEM_PC | |
3265 | SEM_FN_NAME (sh64_media,mextr3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3266 | { | |
3267 | #define FLD(f) abuf->fields.sfmt_add.f | |
3268 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3269 | int UNUSED written = 0; | |
3270 | IADDR UNUSED pc = abuf->addr; | |
3271 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3272 | ||
3273 | { | |
3274 | QI tmp_count; | |
3275 | DI tmp_mask; | |
3276 | DI tmp_rhs; | |
1bbd6057 | 3277 | tmp_count = MULQI (8, 3); |
cbb38b47 BE |
3278 | tmp_mask = SLLDI (INVSI (0), tmp_count); |
3279 | tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count); | |
1bbd6057 | 3280 | tmp_count = MULQI (8, SUBQI (8, 3)); |
cbb38b47 BE |
3281 | tmp_mask = SRLDI (INVSI (0), tmp_count); |
3282 | { | |
3283 | DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count)); | |
3284 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3285 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3286 | } |
3287 | } | |
3288 | ||
3289 | return vpc; | |
3290 | #undef FLD | |
3291 | } | |
3292 | ||
3293 | /* mextr4: mextr4 $rm, $rn, $rd */ | |
3294 | ||
3295 | static SEM_PC | |
3296 | SEM_FN_NAME (sh64_media,mextr4) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3297 | { | |
3298 | #define FLD(f) abuf->fields.sfmt_add.f | |
3299 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3300 | int UNUSED written = 0; | |
3301 | IADDR UNUSED pc = abuf->addr; | |
3302 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3303 | ||
3304 | { | |
3305 | QI tmp_count; | |
3306 | DI tmp_mask; | |
3307 | DI tmp_rhs; | |
1bbd6057 | 3308 | tmp_count = MULQI (8, 4); |
cbb38b47 BE |
3309 | tmp_mask = SLLDI (INVSI (0), tmp_count); |
3310 | tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count); | |
1bbd6057 | 3311 | tmp_count = MULQI (8, SUBQI (8, 4)); |
cbb38b47 BE |
3312 | tmp_mask = SRLDI (INVSI (0), tmp_count); |
3313 | { | |
3314 | DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count)); | |
3315 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3316 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3317 | } |
3318 | } | |
3319 | ||
3320 | return vpc; | |
3321 | #undef FLD | |
3322 | } | |
3323 | ||
3324 | /* mextr5: mextr5 $rm, $rn, $rd */ | |
3325 | ||
3326 | static SEM_PC | |
3327 | SEM_FN_NAME (sh64_media,mextr5) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3328 | { | |
3329 | #define FLD(f) abuf->fields.sfmt_add.f | |
3330 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3331 | int UNUSED written = 0; | |
3332 | IADDR UNUSED pc = abuf->addr; | |
3333 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3334 | ||
3335 | { | |
3336 | QI tmp_count; | |
3337 | DI tmp_mask; | |
3338 | DI tmp_rhs; | |
1bbd6057 | 3339 | tmp_count = MULQI (8, 5); |
cbb38b47 BE |
3340 | tmp_mask = SLLDI (INVSI (0), tmp_count); |
3341 | tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count); | |
1bbd6057 | 3342 | tmp_count = MULQI (8, SUBQI (8, 5)); |
cbb38b47 BE |
3343 | tmp_mask = SRLDI (INVSI (0), tmp_count); |
3344 | { | |
3345 | DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count)); | |
3346 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3347 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3348 | } |
3349 | } | |
3350 | ||
3351 | return vpc; | |
3352 | #undef FLD | |
3353 | } | |
3354 | ||
3355 | /* mextr6: mextr6 $rm, $rn, $rd */ | |
3356 | ||
3357 | static SEM_PC | |
3358 | SEM_FN_NAME (sh64_media,mextr6) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3359 | { | |
3360 | #define FLD(f) abuf->fields.sfmt_add.f | |
3361 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3362 | int UNUSED written = 0; | |
3363 | IADDR UNUSED pc = abuf->addr; | |
3364 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3365 | ||
3366 | { | |
3367 | QI tmp_count; | |
3368 | DI tmp_mask; | |
3369 | DI tmp_rhs; | |
1bbd6057 | 3370 | tmp_count = MULQI (8, 6); |
cbb38b47 BE |
3371 | tmp_mask = SLLDI (INVSI (0), tmp_count); |
3372 | tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count); | |
1bbd6057 | 3373 | tmp_count = MULQI (8, SUBQI (8, 6)); |
cbb38b47 BE |
3374 | tmp_mask = SRLDI (INVSI (0), tmp_count); |
3375 | { | |
3376 | DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count)); | |
3377 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3378 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3379 | } |
3380 | } | |
3381 | ||
3382 | return vpc; | |
3383 | #undef FLD | |
3384 | } | |
3385 | ||
3386 | /* mextr7: mextr7 $rm, $rn, $rd */ | |
3387 | ||
3388 | static SEM_PC | |
3389 | SEM_FN_NAME (sh64_media,mextr7) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3390 | { | |
3391 | #define FLD(f) abuf->fields.sfmt_add.f | |
3392 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3393 | int UNUSED written = 0; | |
3394 | IADDR UNUSED pc = abuf->addr; | |
3395 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3396 | ||
3397 | { | |
3398 | QI tmp_count; | |
3399 | DI tmp_mask; | |
3400 | DI tmp_rhs; | |
1bbd6057 | 3401 | tmp_count = MULQI (8, 7); |
cbb38b47 BE |
3402 | tmp_mask = SLLDI (INVSI (0), tmp_count); |
3403 | tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count); | |
1bbd6057 | 3404 | tmp_count = MULQI (8, SUBQI (8, 7)); |
cbb38b47 BE |
3405 | tmp_mask = SRLDI (INVSI (0), tmp_count); |
3406 | { | |
3407 | DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count)); | |
3408 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3409 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3410 | } |
3411 | } | |
3412 | ||
3413 | return vpc; | |
3414 | #undef FLD | |
3415 | } | |
3416 | ||
3417 | /* mmacfxwl: mmacfx.wl $rm, $rn, $rd */ | |
3418 | ||
3419 | static SEM_PC | |
3420 | SEM_FN_NAME (sh64_media,mmacfxwl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3421 | { | |
3422 | #define FLD(f) abuf->fields.sfmt_add.f | |
3423 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3424 | int UNUSED written = 0; | |
3425 | IADDR UNUSED pc = abuf->addr; | |
3426 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3427 | ||
3428 | { | |
3429 | SI tmp_temp; | |
3430 | SI tmp_result1; | |
3431 | SI tmp_result0; | |
1bbd6057 JR |
3432 | tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1); |
3433 | tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 0); | |
3434 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))); | |
3435 | tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
3436 | tmp_result0 = ((LTDI (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
3437 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))); | |
3438 | tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
3439 | tmp_result1 = ((LTDI (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
cbb38b47 BE |
3440 | { |
3441 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
3442 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3443 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3444 | } |
3445 | } | |
3446 | ||
3447 | return vpc; | |
3448 | #undef FLD | |
3449 | } | |
3450 | ||
3451 | /* mmacnfx.wl: mmacnfx.wl $rm, $rn, $rd */ | |
3452 | ||
3453 | static SEM_PC | |
3454 | SEM_FN_NAME (sh64_media,mmacnfx_wl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3455 | { | |
3456 | #define FLD(f) abuf->fields.sfmt_add.f | |
3457 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3458 | int UNUSED written = 0; | |
3459 | IADDR UNUSED pc = abuf->addr; | |
3460 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3461 | ||
3462 | { | |
3463 | SI tmp_temp; | |
3464 | SI tmp_result1; | |
3465 | SI tmp_result0; | |
1bbd6057 JR |
3466 | tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1); |
3467 | tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 0); | |
3468 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))); | |
3469 | tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
3470 | tmp_result0 = ((LTDI (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
3471 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))); | |
3472 | tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
3473 | tmp_result1 = ((LTDI (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
cbb38b47 BE |
3474 | { |
3475 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
3476 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3477 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3478 | } |
3479 | } | |
3480 | ||
3481 | return vpc; | |
3482 | #undef FLD | |
3483 | } | |
3484 | ||
3485 | /* mmull: mmul.l $rm, $rn, $rd */ | |
3486 | ||
3487 | static SEM_PC | |
3488 | SEM_FN_NAME (sh64_media,mmull) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3489 | { | |
3490 | #define FLD(f) abuf->fields.sfmt_add.f | |
3491 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3492 | int UNUSED written = 0; | |
3493 | IADDR UNUSED pc = abuf->addr; | |
3494 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3495 | ||
3496 | { | |
3497 | SI tmp_result1; | |
3498 | SI tmp_result0; | |
3499 | tmp_result0 = MULSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)); | |
3500 | tmp_result1 = MULSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)); | |
3501 | { | |
3502 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
3503 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3504 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3505 | } |
3506 | } | |
3507 | ||
3508 | return vpc; | |
3509 | #undef FLD | |
3510 | } | |
3511 | ||
3512 | /* mmulw: mmul.w $rm, $rn, $rd */ | |
3513 | ||
3514 | static SEM_PC | |
3515 | SEM_FN_NAME (sh64_media,mmulw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3516 | { | |
3517 | #define FLD(f) abuf->fields.sfmt_add.f | |
3518 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3519 | int UNUSED written = 0; | |
3520 | IADDR UNUSED pc = abuf->addr; | |
3521 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3522 | ||
3523 | { | |
3524 | HI tmp_result3; | |
3525 | HI tmp_result2; | |
3526 | HI tmp_result1; | |
3527 | HI tmp_result0; | |
3528 | tmp_result0 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)); | |
3529 | tmp_result1 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)); | |
3530 | tmp_result2 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)); | |
3531 | tmp_result3 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)); | |
3532 | { | |
3533 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
3534 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3535 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3536 | } |
3537 | } | |
3538 | ||
3539 | return vpc; | |
3540 | #undef FLD | |
3541 | } | |
3542 | ||
3543 | /* mmulfxl: mmulfx.l $rm, $rn, $rd */ | |
3544 | ||
3545 | static SEM_PC | |
3546 | SEM_FN_NAME (sh64_media,mmulfxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3547 | { | |
3548 | #define FLD(f) abuf->fields.sfmt_add.f | |
3549 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3550 | int UNUSED written = 0; | |
3551 | IADDR UNUSED pc = abuf->addr; | |
3552 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3553 | ||
3554 | { | |
3555 | DI tmp_temp; | |
3556 | SI tmp_result0; | |
3557 | SI tmp_result1; | |
cbb38b47 | 3558 | tmp_temp = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))); |
1bbd6057 JR |
3559 | tmp_result0 = ((LTDI (SRADI (tmp_temp, 31), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SRADI (tmp_temp, 31), SLLDI (1, SUBSI (32, 1)))) ? (SRADI (tmp_temp, 31)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); |
3560 | tmp_temp = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))); | |
3561 | tmp_result1 = ((LTDI (SRADI (tmp_temp, 31), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SRADI (tmp_temp, 31), SLLDI (1, SUBSI (32, 1)))) ? (SRADI (tmp_temp, 31)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
cbb38b47 BE |
3562 | { |
3563 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
3564 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3565 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3566 | } |
3567 | } | |
3568 | ||
3569 | return vpc; | |
3570 | #undef FLD | |
3571 | } | |
3572 | ||
3573 | /* mmulfxw: mmulfx.w $rm, $rn, $rd */ | |
3574 | ||
3575 | static SEM_PC | |
3576 | SEM_FN_NAME (sh64_media,mmulfxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3577 | { | |
3578 | #define FLD(f) abuf->fields.sfmt_add.f | |
3579 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3580 | int UNUSED written = 0; | |
3581 | IADDR UNUSED pc = abuf->addr; | |
3582 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3583 | ||
3584 | { | |
3585 | SI tmp_temp; | |
3586 | HI tmp_result0; | |
3587 | HI tmp_result1; | |
3588 | HI tmp_result2; | |
3589 | HI tmp_result3; | |
cbb38b47 | 3590 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))); |
1bbd6057 JR |
3591 | tmp_result0 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); |
3592 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))); | |
3593 | tmp_result1 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
3594 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))); | |
3595 | tmp_result2 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
3596 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))); | |
3597 | tmp_result3 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
cbb38b47 BE |
3598 | { |
3599 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
3600 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3601 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3602 | } |
3603 | } | |
3604 | ||
3605 | return vpc; | |
3606 | #undef FLD | |
3607 | } | |
3608 | ||
3609 | /* mmulfxrpw: mmulfxrp.w $rm, $rn, $rd */ | |
3610 | ||
3611 | static SEM_PC | |
3612 | SEM_FN_NAME (sh64_media,mmulfxrpw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3613 | { | |
3614 | #define FLD(f) abuf->fields.sfmt_add.f | |
3615 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3616 | int UNUSED written = 0; | |
3617 | IADDR UNUSED pc = abuf->addr; | |
3618 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3619 | ||
3620 | { | |
3621 | SI tmp_temp; | |
3622 | HI tmp_result0; | |
3623 | HI tmp_result1; | |
3624 | HI tmp_result2; | |
3625 | HI tmp_result3; | |
3626 | HI tmp_c; | |
3627 | tmp_c = SLLSI (1, 14); | |
cbb38b47 | 3628 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))); |
1bbd6057 JR |
3629 | tmp_result0 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); |
3630 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))); | |
3631 | tmp_result1 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
3632 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))); | |
3633 | tmp_result2 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
3634 | tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))); | |
3635 | tmp_result3 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
cbb38b47 BE |
3636 | { |
3637 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
3638 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3639 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3640 | } |
3641 | } | |
3642 | ||
3643 | return vpc; | |
3644 | #undef FLD | |
3645 | } | |
3646 | ||
3647 | /* mmulhiwl: mmulhi.wl $rm, $rn, $rd */ | |
3648 | ||
3649 | static SEM_PC | |
3650 | SEM_FN_NAME (sh64_media,mmulhiwl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3651 | { | |
3652 | #define FLD(f) abuf->fields.sfmt_add.f | |
3653 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3654 | int UNUSED written = 0; | |
3655 | IADDR UNUSED pc = abuf->addr; | |
3656 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3657 | ||
3658 | { | |
3659 | SI tmp_result1; | |
3660 | SI tmp_result0; | |
1bbd6057 JR |
3661 | tmp_result0 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))); |
3662 | tmp_result1 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))); | |
cbb38b47 BE |
3663 | { |
3664 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
3665 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3666 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3667 | } |
3668 | } | |
3669 | ||
3670 | return vpc; | |
3671 | #undef FLD | |
3672 | } | |
3673 | ||
3674 | /* mmullowl: mmullo.wl $rm, $rn, $rd */ | |
3675 | ||
3676 | static SEM_PC | |
3677 | SEM_FN_NAME (sh64_media,mmullowl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3678 | { | |
3679 | #define FLD(f) abuf->fields.sfmt_add.f | |
3680 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3681 | int UNUSED written = 0; | |
3682 | IADDR UNUSED pc = abuf->addr; | |
3683 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3684 | ||
3685 | { | |
3686 | SI tmp_result1; | |
3687 | SI tmp_result0; | |
1bbd6057 JR |
3688 | tmp_result0 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))); |
3689 | tmp_result1 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))); | |
cbb38b47 BE |
3690 | { |
3691 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
3692 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3693 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3694 | } |
3695 | } | |
3696 | ||
3697 | return vpc; | |
3698 | #undef FLD | |
3699 | } | |
3700 | ||
3701 | /* mmulsumwq: mmulsum.wq $rm, $rn, $rd */ | |
3702 | ||
3703 | static SEM_PC | |
3704 | SEM_FN_NAME (sh64_media,mmulsumwq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3705 | { | |
3706 | #define FLD(f) abuf->fields.sfmt_add.f | |
3707 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3708 | int UNUSED written = 0; | |
3709 | IADDR UNUSED pc = abuf->addr; | |
3710 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3711 | ||
3712 | { | |
3713 | DI tmp_acc; | |
3714 | tmp_acc = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))); | |
3715 | tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)))); | |
3716 | tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)))); | |
3717 | tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)))); | |
3718 | { | |
3719 | DI opval = ADDDI (GET_H_GR (FLD (f_dest)), tmp_acc); | |
3720 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3721 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3722 | } |
3723 | } | |
3724 | ||
3725 | return vpc; | |
3726 | #undef FLD | |
3727 | } | |
3728 | ||
3729 | /* movi: movi $imm16, $rd */ | |
3730 | ||
3731 | static SEM_PC | |
3732 | SEM_FN_NAME (sh64_media,movi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3733 | { | |
3734 | #define FLD(f) abuf->fields.sfmt_movi.f | |
3735 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3736 | int UNUSED written = 0; | |
3737 | IADDR UNUSED pc = abuf->addr; | |
3738 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3739 | ||
3740 | { | |
3741 | DI opval = EXTSIDI (FLD (f_imm16)); | |
3742 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3743 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3744 | } |
3745 | ||
3746 | return vpc; | |
3747 | #undef FLD | |
3748 | } | |
3749 | ||
3750 | /* mpermw: mperm.w $rm, $rn, $rd */ | |
3751 | ||
3752 | static SEM_PC | |
3753 | SEM_FN_NAME (sh64_media,mpermw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3754 | { | |
3755 | #define FLD(f) abuf->fields.sfmt_add.f | |
3756 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3757 | int UNUSED written = 0; | |
3758 | IADDR UNUSED pc = abuf->addr; | |
3759 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3760 | ||
3761 | { | |
3762 | QI tmp_control; | |
3763 | HI tmp_result3; | |
3764 | HI tmp_result2; | |
3765 | HI tmp_result1; | |
3766 | HI tmp_result0; | |
1bbd6057 | 3767 | tmp_control = ANDQI (GET_H_GR (FLD (f_right)), 255); |
cbb38b47 BE |
3768 | tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (tmp_control, 3))); |
3769 | tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 2), 3))); | |
3770 | tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 4), 3))); | |
3771 | tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 6), 3))); | |
3772 | { | |
3773 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
3774 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3775 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3776 | } |
3777 | } | |
3778 | ||
3779 | return vpc; | |
3780 | #undef FLD | |
3781 | } | |
3782 | ||
3783 | /* msadubq: msad.ubq $rm, $rn, $rd */ | |
3784 | ||
3785 | static SEM_PC | |
3786 | SEM_FN_NAME (sh64_media,msadubq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3787 | { | |
3788 | #define FLD(f) abuf->fields.sfmt_add.f | |
3789 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3790 | int UNUSED written = 0; | |
3791 | IADDR UNUSED pc = abuf->addr; | |
3792 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3793 | ||
3794 | { | |
3795 | DI tmp_acc; | |
1bbd6057 | 3796 | tmp_acc = ABSDI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))); |
cbb38b47 BE |
3797 | tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))); |
3798 | tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))); | |
3799 | tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))); | |
3800 | tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))); | |
3801 | tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))); | |
3802 | tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))); | |
3803 | tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))); | |
3804 | { | |
3805 | DI opval = ADDDI (GET_H_GR (FLD (f_dest)), tmp_acc); | |
3806 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3807 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3808 | } |
3809 | } | |
3810 | ||
3811 | return vpc; | |
3812 | #undef FLD | |
3813 | } | |
3814 | ||
3815 | /* mshaldsl: mshalds.l $rm, $rn, $rd */ | |
3816 | ||
3817 | static SEM_PC | |
3818 | SEM_FN_NAME (sh64_media,mshaldsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3819 | { | |
3820 | #define FLD(f) abuf->fields.sfmt_add.f | |
3821 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3822 | int UNUSED written = 0; | |
3823 | IADDR UNUSED pc = abuf->addr; | |
3824 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3825 | ||
3826 | { | |
3827 | SI tmp_result1; | |
3828 | SI tmp_result0; | |
1bbd6057 JR |
3829 | tmp_result0 = ((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); |
3830 | tmp_result1 = ((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
cbb38b47 BE |
3831 | { |
3832 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
3833 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3834 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3835 | } |
3836 | } | |
3837 | ||
3838 | return vpc; | |
3839 | #undef FLD | |
3840 | } | |
3841 | ||
3842 | /* mshaldsw: mshalds.w $rm, $rn, $rd */ | |
3843 | ||
3844 | static SEM_PC | |
3845 | SEM_FN_NAME (sh64_media,mshaldsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3846 | { | |
3847 | #define FLD(f) abuf->fields.sfmt_add.f | |
3848 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3849 | int UNUSED written = 0; | |
3850 | IADDR UNUSED pc = abuf->addr; | |
3851 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3852 | ||
3853 | { | |
3854 | HI tmp_result3; | |
3855 | HI tmp_result2; | |
3856 | HI tmp_result1; | |
3857 | HI tmp_result0; | |
1bbd6057 JR |
3858 | tmp_result0 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); |
3859 | tmp_result1 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
3860 | tmp_result2 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
3861 | tmp_result3 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
cbb38b47 BE |
3862 | { |
3863 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
3864 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3865 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3866 | } |
3867 | } | |
3868 | ||
3869 | return vpc; | |
3870 | #undef FLD | |
3871 | } | |
3872 | ||
3873 | /* mshardl: mshard.l $rm, $rn, $rd */ | |
3874 | ||
3875 | static SEM_PC | |
3876 | SEM_FN_NAME (sh64_media,mshardl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3877 | { | |
3878 | #define FLD(f) abuf->fields.sfmt_add.f | |
3879 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3880 | int UNUSED written = 0; | |
3881 | IADDR UNUSED pc = abuf->addr; | |
3882 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3883 | ||
3884 | { | |
3885 | SI tmp_result1; | |
3886 | SI tmp_result0; | |
3887 | tmp_result0 = SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)); | |
3888 | tmp_result1 = SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)); | |
3889 | { | |
3890 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
3891 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3892 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3893 | } |
3894 | } | |
3895 | ||
3896 | return vpc; | |
3897 | #undef FLD | |
3898 | } | |
3899 | ||
3900 | /* mshardw: mshard.w $rm, $rn, $rd */ | |
3901 | ||
3902 | static SEM_PC | |
3903 | SEM_FN_NAME (sh64_media,mshardw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3904 | { | |
3905 | #define FLD(f) abuf->fields.sfmt_add.f | |
3906 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3907 | int UNUSED written = 0; | |
3908 | IADDR UNUSED pc = abuf->addr; | |
3909 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3910 | ||
3911 | { | |
3912 | HI tmp_result3; | |
3913 | HI tmp_result2; | |
3914 | HI tmp_result1; | |
3915 | HI tmp_result0; | |
3916 | tmp_result0 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
3917 | tmp_result1 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
3918 | tmp_result2 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
3919 | tmp_result3 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
3920 | { | |
3921 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
3922 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3923 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3924 | } |
3925 | } | |
3926 | ||
3927 | return vpc; | |
3928 | #undef FLD | |
3929 | } | |
3930 | ||
3931 | /* mshardsq: mshards.q $rm, $rn, $rd */ | |
3932 | ||
3933 | static SEM_PC | |
3934 | SEM_FN_NAME (sh64_media,mshardsq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3935 | { | |
3936 | #define FLD(f) abuf->fields.sfmt_add.f | |
3937 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3938 | int UNUSED written = 0; | |
3939 | IADDR UNUSED pc = abuf->addr; | |
3940 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3941 | ||
3942 | { | |
3943 | DI opval = ((LTDI (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGDI (SLLDI (1, SUBSI (16, 1)))) : (((LTDI (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)), SLLDI (1, SUBSI (16, 1)))) ? (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63))) : (SUBDI (SLLDI (1, SUBSI (16, 1)), 1))))); | |
3944 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3945 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3946 | } |
3947 | ||
3948 | return vpc; | |
3949 | #undef FLD | |
3950 | } | |
3951 | ||
3952 | /* mshfhib: mshfhi.b $rm, $rn, $rd */ | |
3953 | ||
3954 | static SEM_PC | |
3955 | SEM_FN_NAME (sh64_media,mshfhib) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3956 | { | |
3957 | #define FLD(f) abuf->fields.sfmt_add.f | |
3958 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3959 | int UNUSED written = 0; | |
3960 | IADDR UNUSED pc = abuf->addr; | |
3961 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
3962 | ||
3963 | { | |
3964 | QI tmp_result7; | |
3965 | QI tmp_result6; | |
3966 | QI tmp_result5; | |
3967 | QI tmp_result4; | |
3968 | QI tmp_result3; | |
3969 | QI tmp_result2; | |
3970 | QI tmp_result1; | |
3971 | QI tmp_result0; | |
1bbd6057 JR |
3972 | tmp_result0 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3); |
3973 | tmp_result1 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3); | |
3974 | tmp_result2 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2); | |
3975 | tmp_result3 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2); | |
3976 | tmp_result4 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1); | |
3977 | tmp_result5 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1); | |
3978 | tmp_result6 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0); | |
3979 | tmp_result7 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0); | |
cbb38b47 BE |
3980 | { |
3981 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
3982 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 3983 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
3984 | } |
3985 | } | |
3986 | ||
3987 | return vpc; | |
3988 | #undef FLD | |
3989 | } | |
3990 | ||
3991 | /* mshfhil: mshfhi.l $rm, $rn, $rd */ | |
3992 | ||
3993 | static SEM_PC | |
3994 | SEM_FN_NAME (sh64_media,mshfhil) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3995 | { | |
3996 | #define FLD(f) abuf->fields.sfmt_add.f | |
3997 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3998 | int UNUSED written = 0; | |
3999 | IADDR UNUSED pc = abuf->addr; | |
4000 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4001 | ||
4002 | { | |
4003 | SI tmp_result1; | |
4004 | SI tmp_result0; | |
1bbd6057 JR |
4005 | tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_left)), 0); |
4006 | tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_right)), 0); | |
cbb38b47 BE |
4007 | { |
4008 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
4009 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4010 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4011 | } |
4012 | } | |
4013 | ||
4014 | return vpc; | |
4015 | #undef FLD | |
4016 | } | |
4017 | ||
4018 | /* mshfhiw: mshfhi.w $rm, $rn, $rd */ | |
4019 | ||
4020 | static SEM_PC | |
4021 | SEM_FN_NAME (sh64_media,mshfhiw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4022 | { | |
4023 | #define FLD(f) abuf->fields.sfmt_add.f | |
4024 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4025 | int UNUSED written = 0; | |
4026 | IADDR UNUSED pc = abuf->addr; | |
4027 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4028 | ||
4029 | { | |
4030 | HI tmp_result3; | |
4031 | HI tmp_result2; | |
4032 | HI tmp_result1; | |
4033 | HI tmp_result0; | |
1bbd6057 JR |
4034 | tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1); |
4035 | tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1); | |
4036 | tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0); | |
4037 | tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0); | |
cbb38b47 BE |
4038 | { |
4039 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
4040 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4041 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4042 | } |
4043 | } | |
4044 | ||
4045 | return vpc; | |
4046 | #undef FLD | |
4047 | } | |
4048 | ||
4049 | /* mshflob: mshflo.b $rm, $rn, $rd */ | |
4050 | ||
4051 | static SEM_PC | |
4052 | SEM_FN_NAME (sh64_media,mshflob) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4053 | { | |
4054 | #define FLD(f) abuf->fields.sfmt_add.f | |
4055 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4056 | int UNUSED written = 0; | |
4057 | IADDR UNUSED pc = abuf->addr; | |
4058 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4059 | ||
4060 | { | |
4061 | QI tmp_result7; | |
4062 | QI tmp_result6; | |
4063 | QI tmp_result5; | |
4064 | QI tmp_result4; | |
4065 | QI tmp_result3; | |
4066 | QI tmp_result2; | |
4067 | QI tmp_result1; | |
4068 | QI tmp_result0; | |
1bbd6057 JR |
4069 | tmp_result0 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7); |
4070 | tmp_result1 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7); | |
4071 | tmp_result2 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6); | |
4072 | tmp_result3 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6); | |
4073 | tmp_result4 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5); | |
4074 | tmp_result5 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5); | |
4075 | tmp_result6 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4); | |
4076 | tmp_result7 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4); | |
cbb38b47 BE |
4077 | { |
4078 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
4079 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4080 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4081 | } |
4082 | } | |
4083 | ||
4084 | return vpc; | |
4085 | #undef FLD | |
4086 | } | |
4087 | ||
4088 | /* mshflol: mshflo.l $rm, $rn, $rd */ | |
4089 | ||
4090 | static SEM_PC | |
4091 | SEM_FN_NAME (sh64_media,mshflol) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4092 | { | |
4093 | #define FLD(f) abuf->fields.sfmt_add.f | |
4094 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4095 | int UNUSED written = 0; | |
4096 | IADDR UNUSED pc = abuf->addr; | |
4097 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4098 | ||
4099 | { | |
4100 | SI tmp_result1; | |
4101 | SI tmp_result0; | |
1bbd6057 JR |
4102 | tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_left)), 1); |
4103 | tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_right)), 1); | |
cbb38b47 BE |
4104 | { |
4105 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
4106 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4107 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4108 | } |
4109 | } | |
4110 | ||
4111 | return vpc; | |
4112 | #undef FLD | |
4113 | } | |
4114 | ||
4115 | /* mshflow: mshflo.w $rm, $rn, $rd */ | |
4116 | ||
4117 | static SEM_PC | |
4118 | SEM_FN_NAME (sh64_media,mshflow) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4119 | { | |
4120 | #define FLD(f) abuf->fields.sfmt_add.f | |
4121 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4122 | int UNUSED written = 0; | |
4123 | IADDR UNUSED pc = abuf->addr; | |
4124 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4125 | ||
4126 | { | |
4127 | HI tmp_result3; | |
4128 | HI tmp_result2; | |
4129 | HI tmp_result1; | |
4130 | HI tmp_result0; | |
1bbd6057 JR |
4131 | tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3); |
4132 | tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3); | |
4133 | tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2); | |
4134 | tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2); | |
cbb38b47 BE |
4135 | { |
4136 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
4137 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4138 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4139 | } |
4140 | } | |
4141 | ||
4142 | return vpc; | |
4143 | #undef FLD | |
4144 | } | |
4145 | ||
4146 | /* mshlldl: mshlld.l $rm, $rn, $rd */ | |
4147 | ||
4148 | static SEM_PC | |
4149 | SEM_FN_NAME (sh64_media,mshlldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4150 | { | |
4151 | #define FLD(f) abuf->fields.sfmt_add.f | |
4152 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4153 | int UNUSED written = 0; | |
4154 | IADDR UNUSED pc = abuf->addr; | |
4155 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4156 | ||
4157 | { | |
4158 | SI tmp_result1; | |
4159 | SI tmp_result0; | |
4160 | tmp_result0 = SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)); | |
4161 | tmp_result1 = SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)); | |
4162 | { | |
4163 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
4164 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4165 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4166 | } |
4167 | } | |
4168 | ||
4169 | return vpc; | |
4170 | #undef FLD | |
4171 | } | |
4172 | ||
4173 | /* mshlldw: mshlld.w $rm, $rn, $rd */ | |
4174 | ||
4175 | static SEM_PC | |
4176 | SEM_FN_NAME (sh64_media,mshlldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4177 | { | |
4178 | #define FLD(f) abuf->fields.sfmt_add.f | |
4179 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4180 | int UNUSED written = 0; | |
4181 | IADDR UNUSED pc = abuf->addr; | |
4182 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4183 | ||
4184 | { | |
4185 | HI tmp_result3; | |
4186 | HI tmp_result2; | |
4187 | HI tmp_result1; | |
4188 | HI tmp_result0; | |
4189 | tmp_result0 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
4190 | tmp_result1 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
4191 | tmp_result2 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
4192 | tmp_result3 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
4193 | { | |
4194 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
4195 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4196 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4197 | } |
4198 | } | |
4199 | ||
4200 | return vpc; | |
4201 | #undef FLD | |
4202 | } | |
4203 | ||
4204 | /* mshlrdl: mshlrd.l $rm, $rn, $rd */ | |
4205 | ||
4206 | static SEM_PC | |
4207 | SEM_FN_NAME (sh64_media,mshlrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4208 | { | |
4209 | #define FLD(f) abuf->fields.sfmt_add.f | |
4210 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4211 | int UNUSED written = 0; | |
4212 | IADDR UNUSED pc = abuf->addr; | |
4213 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4214 | ||
4215 | { | |
4216 | SI tmp_result1; | |
4217 | SI tmp_result0; | |
4218 | tmp_result0 = SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)); | |
4219 | tmp_result1 = SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)); | |
4220 | { | |
4221 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
4222 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4223 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4224 | } |
4225 | } | |
4226 | ||
4227 | return vpc; | |
4228 | #undef FLD | |
4229 | } | |
4230 | ||
4231 | /* mshlrdw: mshlrd.w $rm, $rn, $rd */ | |
4232 | ||
4233 | static SEM_PC | |
4234 | SEM_FN_NAME (sh64_media,mshlrdw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4235 | { | |
4236 | #define FLD(f) abuf->fields.sfmt_add.f | |
4237 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4238 | int UNUSED written = 0; | |
4239 | IADDR UNUSED pc = abuf->addr; | |
4240 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4241 | ||
4242 | { | |
4243 | HI tmp_result3; | |
4244 | HI tmp_result2; | |
4245 | HI tmp_result1; | |
4246 | HI tmp_result0; | |
4247 | tmp_result0 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
4248 | tmp_result1 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
4249 | tmp_result2 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
4250 | tmp_result3 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)); | |
4251 | { | |
4252 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
4253 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4254 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4255 | } |
4256 | } | |
4257 | ||
4258 | return vpc; | |
4259 | #undef FLD | |
4260 | } | |
4261 | ||
4262 | /* msubl: msub.l $rm, $rn, $rd */ | |
4263 | ||
4264 | static SEM_PC | |
4265 | SEM_FN_NAME (sh64_media,msubl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4266 | { | |
4267 | #define FLD(f) abuf->fields.sfmt_add.f | |
4268 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4269 | int UNUSED written = 0; | |
4270 | IADDR UNUSED pc = abuf->addr; | |
4271 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4272 | ||
4273 | { | |
4274 | SI tmp_result1; | |
4275 | SI tmp_result0; | |
4276 | tmp_result0 = SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)); | |
4277 | tmp_result1 = SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)); | |
4278 | { | |
4279 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
4280 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4281 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4282 | } |
4283 | } | |
4284 | ||
4285 | return vpc; | |
4286 | #undef FLD | |
4287 | } | |
4288 | ||
4289 | /* msubw: msub.w $rm, $rn, $rd */ | |
4290 | ||
4291 | static SEM_PC | |
4292 | SEM_FN_NAME (sh64_media,msubw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4293 | { | |
4294 | #define FLD(f) abuf->fields.sfmt_add.f | |
4295 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4296 | int UNUSED written = 0; | |
4297 | IADDR UNUSED pc = abuf->addr; | |
4298 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4299 | ||
4300 | { | |
4301 | HI tmp_result3; | |
4302 | HI tmp_result2; | |
4303 | HI tmp_result1; | |
4304 | HI tmp_result0; | |
4305 | tmp_result0 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)); | |
4306 | tmp_result1 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)); | |
4307 | tmp_result2 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)); | |
4308 | tmp_result3 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)); | |
4309 | { | |
4310 | DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0)))); | |
4311 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4312 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4313 | } |
4314 | } | |
4315 | ||
4316 | return vpc; | |
4317 | #undef FLD | |
4318 | } | |
4319 | ||
4320 | /* msubsl: msubs.l $rm, $rn, $rd */ | |
4321 | ||
4322 | static SEM_PC | |
4323 | SEM_FN_NAME (sh64_media,msubsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4324 | { | |
4325 | #define FLD(f) abuf->fields.sfmt_add.f | |
4326 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4327 | int UNUSED written = 0; | |
4328 | IADDR UNUSED pc = abuf->addr; | |
4329 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4330 | ||
4331 | { | |
4332 | SI tmp_result1; | |
4333 | SI tmp_result0; | |
1bbd6057 JR |
4334 | tmp_result0 = ((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); |
4335 | tmp_result1 = ((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1))))); | |
cbb38b47 BE |
4336 | { |
4337 | DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0)); | |
4338 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4339 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4340 | } |
4341 | } | |
4342 | ||
4343 | return vpc; | |
4344 | #undef FLD | |
4345 | } | |
4346 | ||
4347 | /* msubsub: msubs.ub $rm, $rn, $rd */ | |
4348 | ||
4349 | static SEM_PC | |
4350 | SEM_FN_NAME (sh64_media,msubsub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4351 | { | |
4352 | #define FLD(f) abuf->fields.sfmt_add.f | |
4353 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4354 | int UNUSED written = 0; | |
4355 | IADDR UNUSED pc = abuf->addr; | |
4356 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4357 | ||
4358 | { | |
4359 | QI tmp_result7; | |
4360 | QI tmp_result6; | |
4361 | QI tmp_result5; | |
4362 | QI tmp_result4; | |
4363 | QI tmp_result3; | |
4364 | QI tmp_result2; | |
4365 | QI tmp_result1; | |
4366 | QI tmp_result0; | |
1bbd6057 JR |
4367 | tmp_result0 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBQI (SLLQI (1, 8), 1))))); |
4368 | tmp_result1 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
4369 | tmp_result2 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
4370 | tmp_result3 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
4371 | tmp_result4 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
4372 | tmp_result5 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
4373 | tmp_result6 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
4374 | tmp_result7 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBQI (SLLQI (1, 8), 1))))); | |
cbb38b47 BE |
4375 | { |
4376 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
4377 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4378 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4379 | } |
4380 | } | |
4381 | ||
4382 | return vpc; | |
4383 | #undef FLD | |
4384 | } | |
4385 | ||
4386 | /* msubsw: msubs.w $rm, $rn, $rd */ | |
4387 | ||
4388 | static SEM_PC | |
4389 | SEM_FN_NAME (sh64_media,msubsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4390 | { | |
4391 | #define FLD(f) abuf->fields.sfmt_add.f | |
4392 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4393 | int UNUSED written = 0; | |
4394 | IADDR UNUSED pc = abuf->addr; | |
4395 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4396 | ||
4397 | { | |
4398 | QI tmp_result7; | |
4399 | QI tmp_result6; | |
4400 | QI tmp_result5; | |
4401 | QI tmp_result4; | |
4402 | QI tmp_result3; | |
4403 | QI tmp_result2; | |
4404 | QI tmp_result1; | |
4405 | QI tmp_result0; | |
1bbd6057 JR |
4406 | tmp_result0 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); |
4407 | tmp_result1 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
4408 | tmp_result2 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
4409 | tmp_result3 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
4410 | tmp_result4 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
4411 | tmp_result5 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
4412 | tmp_result6 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
4413 | tmp_result7 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1))))); | |
cbb38b47 BE |
4414 | { |
4415 | DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0)))))))); | |
4416 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4417 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4418 | } |
4419 | } | |
4420 | ||
4421 | return vpc; | |
4422 | #undef FLD | |
4423 | } | |
4424 | ||
4425 | /* mulsl: muls.l $rm, $rn, $rd */ | |
4426 | ||
4427 | static SEM_PC | |
4428 | SEM_FN_NAME (sh64_media,mulsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4429 | { | |
4430 | #define FLD(f) abuf->fields.sfmt_add.f | |
4431 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4432 | int UNUSED written = 0; | |
4433 | IADDR UNUSED pc = abuf->addr; | |
4434 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4435 | ||
4436 | { | |
4437 | DI opval = MULDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))); | |
4438 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4439 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4440 | } |
4441 | ||
4442 | return vpc; | |
4443 | #undef FLD | |
4444 | } | |
4445 | ||
4446 | /* mulul: mulu.l $rm, $rn, $rd */ | |
4447 | ||
4448 | static SEM_PC | |
4449 | SEM_FN_NAME (sh64_media,mulul) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4450 | { | |
4451 | #define FLD(f) abuf->fields.sfmt_add.f | |
4452 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4453 | int UNUSED written = 0; | |
4454 | IADDR UNUSED pc = abuf->addr; | |
4455 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4456 | ||
4457 | { | |
4458 | DI opval = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))); | |
4459 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4460 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4461 | } |
4462 | ||
4463 | return vpc; | |
4464 | #undef FLD | |
4465 | } | |
4466 | ||
4467 | /* nop: nop */ | |
4468 | ||
4469 | static SEM_PC | |
4470 | SEM_FN_NAME (sh64_media,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4471 | { | |
2310652a | 4472 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
4473 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4474 | int UNUSED written = 0; | |
4475 | IADDR UNUSED pc = abuf->addr; | |
4476 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4477 | ||
4478 | ((void) 0); /*nop*/ | |
4479 | ||
4480 | return vpc; | |
4481 | #undef FLD | |
4482 | } | |
4483 | ||
4484 | /* nsb: nsb $rm, $rd */ | |
4485 | ||
4486 | static SEM_PC | |
4487 | SEM_FN_NAME (sh64_media,nsb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4488 | { | |
4489 | #define FLD(f) abuf->fields.sfmt_xori.f | |
4490 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4491 | int UNUSED written = 0; | |
4492 | IADDR UNUSED pc = abuf->addr; | |
4493 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4494 | ||
4495 | { | |
4496 | DI opval = sh64_nsb (current_cpu, GET_H_GR (FLD (f_left))); | |
4497 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4498 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4499 | } |
4500 | ||
4501 | return vpc; | |
4502 | #undef FLD | |
4503 | } | |
4504 | ||
4505 | /* ocbi: ocbi $rm, $disp6x32 */ | |
4506 | ||
4507 | static SEM_PC | |
4508 | SEM_FN_NAME (sh64_media,ocbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4509 | { | |
c7e628df | 4510 | #define FLD(f) abuf->fields.sfmt_xori.f |
cbb38b47 BE |
4511 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4512 | int UNUSED written = 0; | |
4513 | IADDR UNUSED pc = abuf->addr; | |
4514 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4515 | ||
c7e628df DB |
4516 | { |
4517 | { | |
4518 | DI opval = GET_H_GR (FLD (f_left)); | |
4519 | SET_H_GR (FLD (f_left), opval); | |
4520 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
4521 | } | |
cbb38b47 | 4522 | ((void) 0); /*nop*/ |
c7e628df | 4523 | } |
cbb38b47 BE |
4524 | |
4525 | return vpc; | |
4526 | #undef FLD | |
4527 | } | |
4528 | ||
4529 | /* ocbp: ocbp $rm, $disp6x32 */ | |
4530 | ||
4531 | static SEM_PC | |
4532 | SEM_FN_NAME (sh64_media,ocbp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4533 | { | |
c7e628df | 4534 | #define FLD(f) abuf->fields.sfmt_xori.f |
cbb38b47 BE |
4535 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4536 | int UNUSED written = 0; | |
4537 | IADDR UNUSED pc = abuf->addr; | |
4538 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4539 | ||
c7e628df DB |
4540 | { |
4541 | { | |
4542 | DI opval = GET_H_GR (FLD (f_left)); | |
4543 | SET_H_GR (FLD (f_left), opval); | |
4544 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
4545 | } | |
cbb38b47 | 4546 | ((void) 0); /*nop*/ |
c7e628df | 4547 | } |
cbb38b47 BE |
4548 | |
4549 | return vpc; | |
4550 | #undef FLD | |
4551 | } | |
4552 | ||
4553 | /* ocbwb: ocbwb $rm, $disp6x32 */ | |
4554 | ||
4555 | static SEM_PC | |
4556 | SEM_FN_NAME (sh64_media,ocbwb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4557 | { | |
c7e628df | 4558 | #define FLD(f) abuf->fields.sfmt_xori.f |
cbb38b47 BE |
4559 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4560 | int UNUSED written = 0; | |
4561 | IADDR UNUSED pc = abuf->addr; | |
4562 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4563 | ||
c7e628df DB |
4564 | { |
4565 | { | |
4566 | DI opval = GET_H_GR (FLD (f_left)); | |
4567 | SET_H_GR (FLD (f_left), opval); | |
4568 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
4569 | } | |
cbb38b47 | 4570 | ((void) 0); /*nop*/ |
c7e628df | 4571 | } |
cbb38b47 BE |
4572 | |
4573 | return vpc; | |
4574 | #undef FLD | |
4575 | } | |
4576 | ||
4577 | /* or: or $rm, $rn, $rd */ | |
4578 | ||
4579 | static SEM_PC | |
4580 | SEM_FN_NAME (sh64_media,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4581 | { | |
4582 | #define FLD(f) abuf->fields.sfmt_add.f | |
4583 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4584 | int UNUSED written = 0; | |
4585 | IADDR UNUSED pc = abuf->addr; | |
4586 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4587 | ||
4588 | { | |
4589 | DI opval = ORDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))); | |
4590 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4591 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4592 | } |
4593 | ||
4594 | return vpc; | |
4595 | #undef FLD | |
4596 | } | |
4597 | ||
4598 | /* ori: ori $rm, $imm10, $rd */ | |
4599 | ||
4600 | static SEM_PC | |
4601 | SEM_FN_NAME (sh64_media,ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4602 | { | |
4603 | #define FLD(f) abuf->fields.sfmt_ori.f | |
4604 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4605 | int UNUSED written = 0; | |
4606 | IADDR UNUSED pc = abuf->addr; | |
4607 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4608 | ||
4609 | { | |
4610 | DI opval = ORDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm10))); | |
4611 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4612 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4613 | } |
4614 | ||
4615 | return vpc; | |
4616 | #undef FLD | |
4617 | } | |
4618 | ||
4619 | /* prefi: prefi $rm, $disp6x32 */ | |
4620 | ||
4621 | static SEM_PC | |
4622 | SEM_FN_NAME (sh64_media,prefi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4623 | { | |
c7e628df | 4624 | #define FLD(f) abuf->fields.sfmt_xori.f |
cbb38b47 BE |
4625 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4626 | int UNUSED written = 0; | |
4627 | IADDR UNUSED pc = abuf->addr; | |
4628 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4629 | ||
c7e628df DB |
4630 | { |
4631 | { | |
4632 | DI opval = GET_H_GR (FLD (f_left)); | |
4633 | SET_H_GR (FLD (f_left), opval); | |
4634 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); | |
4635 | } | |
cbb38b47 | 4636 | ((void) 0); /*nop*/ |
c7e628df | 4637 | } |
cbb38b47 BE |
4638 | |
4639 | return vpc; | |
4640 | #undef FLD | |
4641 | } | |
4642 | ||
4643 | /* pta: pta$likely $disp16, $tra */ | |
4644 | ||
4645 | static SEM_PC | |
4646 | SEM_FN_NAME (sh64_media,pta) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4647 | { | |
4648 | #define FLD(f) abuf->fields.sfmt_pta.f | |
4649 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4650 | int UNUSED written = 0; | |
4651 | IADDR UNUSED pc = abuf->addr; | |
4652 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4653 | ||
c7e628df DB |
4654 | { |
4655 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
4656 | { |
4657 | DI opval = ADDSI (FLD (f_disp16), 1); | |
4658 | CPU (h_tr[FLD (f_tra)]) = opval; | |
1bbd6057 | 4659 | TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval); |
cbb38b47 | 4660 | } |
c7e628df | 4661 | } |
cbb38b47 BE |
4662 | |
4663 | return vpc; | |
4664 | #undef FLD | |
4665 | } | |
4666 | ||
4667 | /* ptabs: ptabs$likely $rn, $tra */ | |
4668 | ||
4669 | static SEM_PC | |
4670 | SEM_FN_NAME (sh64_media,ptabs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4671 | { | |
4672 | #define FLD(f) abuf->fields.sfmt_beq.f | |
4673 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4674 | int UNUSED written = 0; | |
4675 | IADDR UNUSED pc = abuf->addr; | |
4676 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4677 | ||
c7e628df DB |
4678 | { |
4679 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
4680 | { |
4681 | DI opval = GET_H_GR (FLD (f_right)); | |
4682 | CPU (h_tr[FLD (f_tra)]) = opval; | |
1bbd6057 | 4683 | TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval); |
cbb38b47 | 4684 | } |
c7e628df | 4685 | } |
cbb38b47 BE |
4686 | |
4687 | return vpc; | |
4688 | #undef FLD | |
4689 | } | |
4690 | ||
4691 | /* ptb: ptb$likely $disp16, $tra */ | |
4692 | ||
4693 | static SEM_PC | |
4694 | SEM_FN_NAME (sh64_media,ptb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4695 | { | |
4696 | #define FLD(f) abuf->fields.sfmt_pta.f | |
4697 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4698 | int UNUSED written = 0; | |
4699 | IADDR UNUSED pc = abuf->addr; | |
4700 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4701 | ||
c7e628df DB |
4702 | { |
4703 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
4704 | { |
4705 | DI opval = FLD (f_disp16); | |
4706 | CPU (h_tr[FLD (f_tra)]) = opval; | |
1bbd6057 | 4707 | TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval); |
cbb38b47 | 4708 | } |
c7e628df | 4709 | } |
cbb38b47 BE |
4710 | |
4711 | return vpc; | |
4712 | #undef FLD | |
4713 | } | |
4714 | ||
4715 | /* ptrel: ptrel$likely $rn, $tra */ | |
4716 | ||
4717 | static SEM_PC | |
4718 | SEM_FN_NAME (sh64_media,ptrel) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4719 | { | |
4720 | #define FLD(f) abuf->fields.sfmt_beq.f | |
4721 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4722 | int UNUSED written = 0; | |
4723 | IADDR UNUSED pc = abuf->addr; | |
4724 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4725 | ||
c7e628df DB |
4726 | { |
4727 | ((void) 0); /*nop*/ | |
cbb38b47 BE |
4728 | { |
4729 | DI opval = ADDDI (pc, GET_H_GR (FLD (f_right))); | |
4730 | CPU (h_tr[FLD (f_tra)]) = opval; | |
1bbd6057 | 4731 | TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval); |
cbb38b47 | 4732 | } |
c7e628df | 4733 | } |
cbb38b47 BE |
4734 | |
4735 | return vpc; | |
4736 | #undef FLD | |
4737 | } | |
4738 | ||
4739 | /* putcfg: putcfg $rm, $disp6, $rd */ | |
4740 | ||
4741 | static SEM_PC | |
4742 | SEM_FN_NAME (sh64_media,putcfg) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4743 | { | |
c7e628df | 4744 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
4745 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
4746 | int UNUSED written = 0; | |
4747 | IADDR UNUSED pc = abuf->addr; | |
4748 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4749 | ||
c7e628df DB |
4750 | { |
4751 | SI tmp_address; | |
4752 | tmp_address = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
cbb38b47 | 4753 | ((void) 0); /*nop*/ |
c7e628df DB |
4754 | { |
4755 | SI opval = GET_H_GR (FLD (f_dest)); | |
4756 | SETMEMSI (current_cpu, pc, tmp_address, opval); | |
4757 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4758 | } | |
4759 | } | |
cbb38b47 BE |
4760 | |
4761 | return vpc; | |
4762 | #undef FLD | |
4763 | } | |
4764 | ||
4765 | /* putcon: putcon $rm, $crj */ | |
4766 | ||
4767 | static SEM_PC | |
4768 | SEM_FN_NAME (sh64_media,putcon) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4769 | { | |
4770 | #define FLD(f) abuf->fields.sfmt_xori.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, 4); | |
4775 | ||
4776 | { | |
4777 | DI opval = GET_H_GR (FLD (f_left)); | |
4778 | SET_H_CR (FLD (f_dest), opval); | |
1bbd6057 | 4779 | TRACE_RESULT (current_cpu, abuf, "cr", 'D', opval); |
cbb38b47 BE |
4780 | } |
4781 | ||
4782 | return vpc; | |
4783 | #undef FLD | |
4784 | } | |
4785 | ||
4786 | /* rte: rte */ | |
4787 | ||
4788 | static SEM_PC | |
4789 | SEM_FN_NAME (sh64_media,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4790 | { | |
2310652a | 4791 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
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, 4); | |
4796 | ||
4797 | ((void) 0); /*nop*/ | |
4798 | ||
4799 | return vpc; | |
4800 | #undef FLD | |
4801 | } | |
4802 | ||
4803 | /* shard: shard $rm, $rn, $rd */ | |
4804 | ||
4805 | static SEM_PC | |
4806 | SEM_FN_NAME (sh64_media,shard) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4807 | { | |
4808 | #define FLD(f) abuf->fields.sfmt_add.f | |
4809 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4810 | int UNUSED written = 0; | |
4811 | IADDR UNUSED pc = abuf->addr; | |
4812 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4813 | ||
4814 | { | |
4815 | DI opval = SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)); | |
4816 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4817 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4818 | } |
4819 | ||
4820 | return vpc; | |
4821 | #undef FLD | |
4822 | } | |
4823 | ||
4824 | /* shardl: shard.l $rm, $rn, $rd */ | |
4825 | ||
4826 | static SEM_PC | |
4827 | SEM_FN_NAME (sh64_media,shardl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4828 | { | |
4829 | #define FLD(f) abuf->fields.sfmt_add.f | |
4830 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4831 | int UNUSED written = 0; | |
4832 | IADDR UNUSED pc = abuf->addr; | |
4833 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4834 | ||
4835 | { | |
4836 | DI opval = EXTSIDI (SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63))); | |
4837 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4838 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4839 | } |
4840 | ||
4841 | return vpc; | |
4842 | #undef FLD | |
4843 | } | |
4844 | ||
4845 | /* shari: shari $rm, $uimm6, $rd */ | |
4846 | ||
4847 | static SEM_PC | |
4848 | SEM_FN_NAME (sh64_media,shari) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4849 | { | |
4850 | #define FLD(f) abuf->fields.sfmt_shari.f | |
4851 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4852 | int UNUSED written = 0; | |
4853 | IADDR UNUSED pc = abuf->addr; | |
4854 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4855 | ||
4856 | { | |
4857 | DI opval = SRADI (GET_H_GR (FLD (f_left)), FLD (f_uimm6)); | |
4858 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4859 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4860 | } |
4861 | ||
4862 | return vpc; | |
4863 | #undef FLD | |
4864 | } | |
4865 | ||
4866 | /* sharil: shari.l $rm, $uimm6, $rd */ | |
4867 | ||
4868 | static SEM_PC | |
4869 | SEM_FN_NAME (sh64_media,sharil) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4870 | { | |
4871 | #define FLD(f) abuf->fields.sfmt_shari.f | |
4872 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4873 | int UNUSED written = 0; | |
4874 | IADDR UNUSED pc = abuf->addr; | |
4875 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4876 | ||
4877 | { | |
4878 | DI opval = EXTSIDI (SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63))); | |
4879 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4880 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4881 | } |
4882 | ||
4883 | return vpc; | |
4884 | #undef FLD | |
4885 | } | |
4886 | ||
4887 | /* shlld: shlld $rm, $rn, $rd */ | |
4888 | ||
4889 | static SEM_PC | |
4890 | SEM_FN_NAME (sh64_media,shlld) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4891 | { | |
4892 | #define FLD(f) abuf->fields.sfmt_add.f | |
4893 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4894 | int UNUSED written = 0; | |
4895 | IADDR UNUSED pc = abuf->addr; | |
4896 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4897 | ||
4898 | { | |
4899 | DI opval = SLLDI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)); | |
4900 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4901 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4902 | } |
4903 | ||
4904 | return vpc; | |
4905 | #undef FLD | |
4906 | } | |
4907 | ||
4908 | /* shlldl: shlld.l $rm, $rn, $rd */ | |
4909 | ||
4910 | static SEM_PC | |
4911 | SEM_FN_NAME (sh64_media,shlldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4912 | { | |
4913 | #define FLD(f) abuf->fields.sfmt_add.f | |
4914 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4915 | int UNUSED written = 0; | |
4916 | IADDR UNUSED pc = abuf->addr; | |
4917 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4918 | ||
4919 | { | |
4920 | DI opval = EXTSIDI (SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63))); | |
4921 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4922 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4923 | } |
4924 | ||
4925 | return vpc; | |
4926 | #undef FLD | |
4927 | } | |
4928 | ||
4929 | /* shlli: shlli $rm, $uimm6, $rd */ | |
4930 | ||
4931 | static SEM_PC | |
4932 | SEM_FN_NAME (sh64_media,shlli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4933 | { | |
4934 | #define FLD(f) abuf->fields.sfmt_shari.f | |
4935 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4936 | int UNUSED written = 0; | |
4937 | IADDR UNUSED pc = abuf->addr; | |
4938 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4939 | ||
4940 | { | |
4941 | DI opval = SLLDI (GET_H_GR (FLD (f_left)), FLD (f_uimm6)); | |
4942 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4943 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4944 | } |
4945 | ||
4946 | return vpc; | |
4947 | #undef FLD | |
4948 | } | |
4949 | ||
4950 | /* shllil: shlli.l $rm, $uimm6, $rd */ | |
4951 | ||
4952 | static SEM_PC | |
4953 | SEM_FN_NAME (sh64_media,shllil) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4954 | { | |
4955 | #define FLD(f) abuf->fields.sfmt_shari.f | |
4956 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4957 | int UNUSED written = 0; | |
4958 | IADDR UNUSED pc = abuf->addr; | |
4959 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4960 | ||
4961 | { | |
4962 | DI opval = EXTSIDI (SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63))); | |
4963 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4964 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4965 | } |
4966 | ||
4967 | return vpc; | |
4968 | #undef FLD | |
4969 | } | |
4970 | ||
4971 | /* shlrd: shlrd $rm, $rn, $rd */ | |
4972 | ||
4973 | static SEM_PC | |
4974 | SEM_FN_NAME (sh64_media,shlrd) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4975 | { | |
4976 | #define FLD(f) abuf->fields.sfmt_add.f | |
4977 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4978 | int UNUSED written = 0; | |
4979 | IADDR UNUSED pc = abuf->addr; | |
4980 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
4981 | ||
4982 | { | |
4983 | DI opval = SRLDI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)); | |
4984 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 4985 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
4986 | } |
4987 | ||
4988 | return vpc; | |
4989 | #undef FLD | |
4990 | } | |
4991 | ||
4992 | /* shlrdl: shlrd.l $rm, $rn, $rd */ | |
4993 | ||
4994 | static SEM_PC | |
4995 | SEM_FN_NAME (sh64_media,shlrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4996 | { | |
4997 | #define FLD(f) abuf->fields.sfmt_add.f | |
4998 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4999 | int UNUSED written = 0; | |
5000 | IADDR UNUSED pc = abuf->addr; | |
5001 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5002 | ||
5003 | { | |
5004 | DI opval = EXTSIDI (SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63))); | |
5005 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5006 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5007 | } |
5008 | ||
5009 | return vpc; | |
5010 | #undef FLD | |
5011 | } | |
5012 | ||
5013 | /* shlri: shlri $rm, $uimm6, $rd */ | |
5014 | ||
5015 | static SEM_PC | |
5016 | SEM_FN_NAME (sh64_media,shlri) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5017 | { | |
5018 | #define FLD(f) abuf->fields.sfmt_shari.f | |
5019 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5020 | int UNUSED written = 0; | |
5021 | IADDR UNUSED pc = abuf->addr; | |
5022 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5023 | ||
5024 | { | |
5025 | DI opval = SRLDI (GET_H_GR (FLD (f_left)), FLD (f_uimm6)); | |
5026 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5027 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5028 | } |
5029 | ||
5030 | return vpc; | |
5031 | #undef FLD | |
5032 | } | |
5033 | ||
5034 | /* shlril: shlri.l $rm, $uimm6, $rd */ | |
5035 | ||
5036 | static SEM_PC | |
5037 | SEM_FN_NAME (sh64_media,shlril) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5038 | { | |
5039 | #define FLD(f) abuf->fields.sfmt_shari.f | |
5040 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5041 | int UNUSED written = 0; | |
5042 | IADDR UNUSED pc = abuf->addr; | |
5043 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5044 | ||
5045 | { | |
5046 | DI opval = EXTSIDI (SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63))); | |
5047 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5048 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5049 | } |
5050 | ||
5051 | return vpc; | |
5052 | #undef FLD | |
5053 | } | |
5054 | ||
5055 | /* shori: shori $uimm16, $rd */ | |
5056 | ||
5057 | static SEM_PC | |
5058 | SEM_FN_NAME (sh64_media,shori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5059 | { | |
5060 | #define FLD(f) abuf->fields.sfmt_shori.f | |
5061 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5062 | int UNUSED written = 0; | |
5063 | IADDR UNUSED pc = abuf->addr; | |
5064 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5065 | ||
5066 | { | |
5067 | DI opval = ORDI (SLLDI (GET_H_GR (FLD (f_dest)), 16), ZEXTSIDI (FLD (f_uimm16))); | |
5068 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5069 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5070 | } |
5071 | ||
5072 | return vpc; | |
5073 | #undef FLD | |
5074 | } | |
5075 | ||
5076 | /* sleep: sleep */ | |
5077 | ||
5078 | static SEM_PC | |
5079 | SEM_FN_NAME (sh64_media,sleep) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5080 | { | |
2310652a | 5081 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
5082 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5083 | int UNUSED written = 0; | |
5084 | IADDR UNUSED pc = abuf->addr; | |
5085 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5086 | ||
5087 | ((void) 0); /*nop*/ | |
5088 | ||
5089 | return vpc; | |
5090 | #undef FLD | |
5091 | } | |
5092 | ||
5093 | /* stb: st.b $rm, $disp10, $rd */ | |
5094 | ||
5095 | static SEM_PC | |
5096 | SEM_FN_NAME (sh64_media,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5097 | { | |
5098 | #define FLD(f) abuf->fields.sfmt_addi.f | |
5099 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5100 | int UNUSED written = 0; | |
5101 | IADDR UNUSED pc = abuf->addr; | |
5102 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5103 | ||
5104 | { | |
5105 | UQI opval = ANDQI (GET_H_GR (FLD (f_dest)), 255); | |
5106 | SETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10))), opval); | |
5107 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5108 | } | |
5109 | ||
5110 | return vpc; | |
5111 | #undef FLD | |
5112 | } | |
5113 | ||
5114 | /* stl: st.l $rm, $disp10x4, $rd */ | |
5115 | ||
5116 | static SEM_PC | |
5117 | SEM_FN_NAME (sh64_media,stl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5118 | { | |
5119 | #define FLD(f) abuf->fields.sfmt_flds.f | |
5120 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5121 | int UNUSED written = 0; | |
5122 | IADDR UNUSED pc = abuf->addr; | |
5123 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5124 | ||
5125 | { | |
5126 | SI opval = ANDSI (GET_H_GR (FLD (f_dest)), 0xffffffff); | |
5127 | SETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x4))), opval); | |
5128 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5129 | } | |
5130 | ||
5131 | return vpc; | |
5132 | #undef FLD | |
5133 | } | |
5134 | ||
5135 | /* stq: st.q $rm, $disp10x8, $rd */ | |
5136 | ||
5137 | static SEM_PC | |
5138 | SEM_FN_NAME (sh64_media,stq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5139 | { | |
5140 | #define FLD(f) abuf->fields.sfmt_fldd.f | |
5141 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5142 | int UNUSED written = 0; | |
5143 | IADDR UNUSED pc = abuf->addr; | |
5144 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5145 | ||
5146 | { | |
5147 | DI opval = GET_H_GR (FLD (f_dest)); | |
5148 | SETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x8))), opval); | |
5149 | TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval); | |
5150 | } | |
5151 | ||
5152 | return vpc; | |
5153 | #undef FLD | |
5154 | } | |
5155 | ||
5156 | /* stw: st.w $rm, $disp10x2, $rd */ | |
5157 | ||
5158 | static SEM_PC | |
5159 | SEM_FN_NAME (sh64_media,stw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5160 | { | |
5161 | #define FLD(f) abuf->fields.sfmt_lduw.f | |
5162 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5163 | int UNUSED written = 0; | |
5164 | IADDR UNUSED pc = abuf->addr; | |
5165 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5166 | ||
5167 | { | |
5168 | HI opval = ANDHI (GET_H_GR (FLD (f_dest)), 65535); | |
5169 | SETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2))), opval); | |
5170 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5171 | } | |
5172 | ||
5173 | return vpc; | |
5174 | #undef FLD | |
5175 | } | |
5176 | ||
5177 | /* sthil: sthi.l $rm, $disp6, $rd */ | |
5178 | ||
5179 | static SEM_PC | |
5180 | SEM_FN_NAME (sh64_media,sthil) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5181 | { | |
c7e628df | 5182 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
5183 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5184 | int UNUSED written = 0; | |
5185 | IADDR UNUSED pc = abuf->addr; | |
5186 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5187 | ||
5188 | { | |
5189 | DI tmp_addr; | |
5190 | QI tmp_bytecount; | |
5191 | DI tmp_val; | |
5192 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
5193 | tmp_bytecount = ADDDI (ANDDI (tmp_addr, 3), 1); | |
1bbd6057 JR |
5194 | if (ANDQI (tmp_bytecount, 4)) { |
5195 | { | |
5196 | SI opval = GET_H_GR (FLD (f_dest)); | |
5197 | SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -4), opval); | |
5198 | written |= (1 << 5); | |
5199 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5200 | } | |
5201 | } else { | |
cbb38b47 | 5202 | if (GET_H_ENDIAN ()) { |
1bbd6057 | 5203 | { |
cbb38b47 | 5204 | tmp_val = GET_H_GR (FLD (f_dest)); |
1bbd6057 | 5205 | if (ANDQI (tmp_bytecount, 1)) { |
cbb38b47 BE |
5206 | { |
5207 | { | |
5208 | UQI opval = ANDQI (tmp_val, 255); | |
5209 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
1bbd6057 | 5210 | written |= (1 << 6); |
cbb38b47 BE |
5211 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
5212 | } | |
5213 | tmp_val = SRLDI (tmp_val, 8); | |
cbb38b47 BE |
5214 | } |
5215 | } | |
1bbd6057 | 5216 | if (ANDQI (tmp_bytecount, 2)) { |
cbb38b47 BE |
5217 | { |
5218 | { | |
1bbd6057 JR |
5219 | HI opval = ANDHI (tmp_val, 65535); |
5220 | SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval); | |
cbb38b47 BE |
5221 | written |= (1 << 4); |
5222 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5223 | } | |
1bbd6057 JR |
5224 | tmp_val = SRLDI (tmp_val, 16); |
5225 | } | |
cbb38b47 BE |
5226 | } |
5227 | } | |
1bbd6057 JR |
5228 | } else { |
5229 | { | |
5230 | tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (32, MULSI (8, tmp_bytecount))); | |
5231 | if (ANDQI (tmp_bytecount, 2)) { | |
cbb38b47 BE |
5232 | { |
5233 | { | |
1bbd6057 JR |
5234 | HI opval = ANDHI (tmp_val, 65535); |
5235 | SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval); | |
cbb38b47 BE |
5236 | written |= (1 << 4); |
5237 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5238 | } | |
1bbd6057 | 5239 | tmp_val = SRLDI (tmp_val, 16); |
cbb38b47 BE |
5240 | } |
5241 | } | |
1bbd6057 | 5242 | if (ANDQI (tmp_bytecount, 1)) { |
cbb38b47 BE |
5243 | { |
5244 | { | |
5245 | UQI opval = ANDQI (tmp_val, 255); | |
5246 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
1bbd6057 | 5247 | written |= (1 << 6); |
cbb38b47 BE |
5248 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
5249 | } | |
5250 | tmp_val = SRLDI (tmp_val, 8); | |
1bbd6057 JR |
5251 | } |
5252 | } | |
5253 | } | |
cbb38b47 BE |
5254 | } |
5255 | } | |
5256 | } | |
5257 | ||
5258 | abuf->written = written; | |
5259 | return vpc; | |
5260 | #undef FLD | |
5261 | } | |
5262 | ||
5263 | /* sthiq: sthi.q $rm, $disp6, $rd */ | |
5264 | ||
5265 | static SEM_PC | |
5266 | SEM_FN_NAME (sh64_media,sthiq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5267 | { | |
c7e628df | 5268 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
5269 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5270 | int UNUSED written = 0; | |
5271 | IADDR UNUSED pc = abuf->addr; | |
5272 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5273 | ||
5274 | { | |
5275 | DI tmp_addr; | |
5276 | QI tmp_bytecount; | |
5277 | DI tmp_val; | |
5278 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
5279 | tmp_bytecount = ADDDI (ANDDI (tmp_addr, 7), 1); | |
1bbd6057 JR |
5280 | if (ANDQI (tmp_bytecount, 8)) { |
5281 | { | |
5282 | DI opval = GET_H_GR (FLD (f_dest)); | |
5283 | SETMEMDI (current_cpu, pc, ANDDI (tmp_addr, -8), opval); | |
5284 | written |= (1 << 4); | |
5285 | TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval); | |
5286 | } | |
5287 | } else { | |
cbb38b47 | 5288 | if (GET_H_ENDIAN ()) { |
1bbd6057 | 5289 | { |
cbb38b47 | 5290 | tmp_val = GET_H_GR (FLD (f_dest)); |
1bbd6057 | 5291 | if (ANDQI (tmp_bytecount, 1)) { |
cbb38b47 BE |
5292 | { |
5293 | { | |
5294 | UQI opval = ANDQI (tmp_val, 255); | |
5295 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
1bbd6057 | 5296 | written |= (1 << 7); |
cbb38b47 BE |
5297 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
5298 | } | |
5299 | tmp_val = SRLDI (tmp_val, 8); | |
cbb38b47 BE |
5300 | } |
5301 | } | |
1bbd6057 | 5302 | if (ANDQI (tmp_bytecount, 2)) { |
cbb38b47 BE |
5303 | { |
5304 | { | |
1bbd6057 JR |
5305 | HI opval = ANDHI (tmp_val, 65535); |
5306 | SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval); | |
5307 | written |= (1 << 5); | |
cbb38b47 BE |
5308 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
5309 | } | |
1bbd6057 | 5310 | tmp_val = SRLDI (tmp_val, 16); |
cbb38b47 BE |
5311 | } |
5312 | } | |
1bbd6057 | 5313 | if (ANDQI (tmp_bytecount, 4)) { |
cbb38b47 BE |
5314 | { |
5315 | { | |
1bbd6057 JR |
5316 | SI opval = ANDSI (tmp_val, 0xffffffff); |
5317 | SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8), opval); | |
5318 | written |= (1 << 6); | |
cbb38b47 BE |
5319 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
5320 | } | |
1bbd6057 JR |
5321 | tmp_val = SRLDI (tmp_val, 32); |
5322 | } | |
5323 | } | |
5324 | } | |
5325 | } else { | |
5326 | { | |
5327 | tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (64, MULSI (8, tmp_bytecount))); | |
5328 | if (ANDQI (tmp_bytecount, 4)) { | |
5329 | { | |
5330 | { | |
5331 | SI opval = ANDSI (tmp_val, 0xffffffff); | |
5332 | SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8), opval); | |
5333 | written |= (1 << 6); | |
5334 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5335 | } | |
5336 | tmp_val = SRLDI (tmp_val, 32); | |
5337 | } | |
5338 | } | |
5339 | if (ANDQI (tmp_bytecount, 2)) { | |
5340 | { | |
5341 | { | |
5342 | HI opval = ANDHI (tmp_val, 65535); | |
5343 | SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval); | |
5344 | written |= (1 << 5); | |
5345 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5346 | } | |
5347 | tmp_val = SRLDI (tmp_val, 16); | |
cbb38b47 BE |
5348 | } |
5349 | } | |
1bbd6057 | 5350 | if (ANDQI (tmp_bytecount, 1)) { |
cbb38b47 BE |
5351 | { |
5352 | { | |
5353 | UQI opval = ANDQI (tmp_val, 255); | |
5354 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
1bbd6057 | 5355 | written |= (1 << 7); |
cbb38b47 BE |
5356 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
5357 | } | |
5358 | tmp_val = SRLDI (tmp_val, 8); | |
cbb38b47 BE |
5359 | } |
5360 | } | |
1bbd6057 JR |
5361 | } |
5362 | } | |
5363 | } | |
5364 | } | |
5365 | ||
5366 | abuf->written = written; | |
5367 | return vpc; | |
5368 | #undef FLD | |
5369 | } | |
5370 | ||
5371 | /* stlol: stlo.l $rm, $disp6, $rd */ | |
5372 | ||
5373 | static SEM_PC | |
5374 | SEM_FN_NAME (sh64_media,stlol) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
cbb38b47 | 5375 | { |
c7e628df | 5376 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
1bbd6057 JR |
5377 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5378 | int UNUSED written = 0; | |
5379 | IADDR UNUSED pc = abuf->addr; | |
5380 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5381 | ||
5382 | { | |
5383 | DI tmp_addr; | |
5384 | QI tmp_bytecount; | |
5385 | DI tmp_val; | |
5386 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
5387 | tmp_bytecount = SUBSI (4, ANDDI (tmp_addr, 3)); | |
5388 | if (ANDQI (tmp_bytecount, 4)) { | |
cbb38b47 | 5389 | { |
1bbd6057 JR |
5390 | USI opval = GET_H_GR (FLD (f_dest)); |
5391 | SETMEMUSI (current_cpu, pc, tmp_addr, opval); | |
5392 | written |= (1 << 6); | |
5393 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5394 | } | |
5395 | } else { | |
5396 | if (GET_H_ENDIAN ()) { | |
5397 | { | |
5398 | tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (32, MULSI (8, tmp_bytecount))); | |
5399 | if (ANDQI (tmp_bytecount, 2)) { | |
5400 | { | |
5401 | { | |
5402 | UHI opval = ANDHI (tmp_val, 65535); | |
5403 | SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval); | |
cbb38b47 BE |
5404 | written |= (1 << 4); |
5405 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5406 | } | |
1bbd6057 | 5407 | tmp_val = SRLDI (tmp_val, 16); |
cbb38b47 BE |
5408 | } |
5409 | } | |
1bbd6057 | 5410 | if (ANDQI (tmp_bytecount, 1)) { |
cbb38b47 BE |
5411 | { |
5412 | { | |
5413 | UQI opval = ANDQI (tmp_val, 255); | |
5414 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
1bbd6057 | 5415 | written |= (1 << 5); |
cbb38b47 BE |
5416 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
5417 | } | |
5418 | tmp_val = SRLDI (tmp_val, 8); | |
cbb38b47 BE |
5419 | } |
5420 | } | |
1bbd6057 JR |
5421 | } |
5422 | } else { | |
5423 | { | |
5424 | tmp_val = GET_H_GR (FLD (f_dest)); | |
5425 | if (ANDQI (tmp_bytecount, 1)) { | |
cbb38b47 BE |
5426 | { |
5427 | { | |
5428 | UQI opval = ANDQI (tmp_val, 255); | |
5429 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
1bbd6057 | 5430 | written |= (1 << 5); |
cbb38b47 BE |
5431 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); |
5432 | } | |
5433 | tmp_val = SRLDI (tmp_val, 8); | |
cbb38b47 BE |
5434 | } |
5435 | } | |
1bbd6057 | 5436 | if (ANDQI (tmp_bytecount, 2)) { |
cbb38b47 BE |
5437 | { |
5438 | { | |
1bbd6057 JR |
5439 | UHI opval = ANDHI (tmp_val, 65535); |
5440 | SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval); | |
cbb38b47 BE |
5441 | written |= (1 << 4); |
5442 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5443 | } | |
1bbd6057 JR |
5444 | tmp_val = SRLDI (tmp_val, 16); |
5445 | } | |
5446 | } | |
cbb38b47 BE |
5447 | } |
5448 | } | |
5449 | } | |
cbb38b47 BE |
5450 | } |
5451 | ||
1bbd6057 | 5452 | abuf->written = written; |
cbb38b47 BE |
5453 | return vpc; |
5454 | #undef FLD | |
5455 | } | |
5456 | ||
5457 | /* stloq: stlo.q $rm, $disp6, $rd */ | |
5458 | ||
5459 | static SEM_PC | |
5460 | SEM_FN_NAME (sh64_media,stloq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5461 | { | |
c7e628df | 5462 | #define FLD(f) abuf->fields.sfmt_getcfg.f |
cbb38b47 BE |
5463 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5464 | int UNUSED written = 0; | |
5465 | IADDR UNUSED pc = abuf->addr; | |
5466 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5467 | ||
1bbd6057 JR |
5468 | { |
5469 | DI tmp_addr; | |
5470 | QI tmp_bytecount; | |
5471 | DI tmp_val; | |
5472 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6)); | |
5473 | tmp_bytecount = SUBSI (8, ANDDI (tmp_addr, 7)); | |
5474 | if (ANDQI (tmp_bytecount, 8)) { | |
5475 | { | |
5476 | UDI opval = GET_H_GR (FLD (f_dest)); | |
5477 | SETMEMUDI (current_cpu, pc, tmp_addr, opval); | |
5478 | written |= (1 << 4); | |
5479 | TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval); | |
5480 | } | |
5481 | } else { | |
5482 | if (GET_H_ENDIAN ()) { | |
5483 | { | |
5484 | tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (64, MULSI (8, tmp_bytecount))); | |
5485 | if (ANDQI (tmp_bytecount, 4)) { | |
5486 | { | |
5487 | { | |
5488 | USI opval = ANDSI (tmp_val, 0xffffffff); | |
5489 | SETMEMUSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4), opval); | |
5490 | written |= (1 << 7); | |
5491 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5492 | } | |
5493 | tmp_val = SRLDI (tmp_val, 32); | |
5494 | } | |
5495 | } | |
5496 | if (ANDQI (tmp_bytecount, 2)) { | |
5497 | { | |
5498 | { | |
5499 | UHI opval = ANDHI (tmp_val, 65535); | |
5500 | SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval); | |
5501 | written |= (1 << 5); | |
5502 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5503 | } | |
5504 | tmp_val = SRLDI (tmp_val, 16); | |
5505 | } | |
5506 | } | |
5507 | if (ANDQI (tmp_bytecount, 1)) { | |
5508 | { | |
5509 | { | |
5510 | UQI opval = ANDQI (tmp_val, 255); | |
5511 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
5512 | written |= (1 << 6); | |
5513 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5514 | } | |
5515 | tmp_val = SRLDI (tmp_val, 8); | |
5516 | } | |
5517 | } | |
5518 | } | |
5519 | } else { | |
5520 | { | |
5521 | tmp_val = GET_H_GR (FLD (f_dest)); | |
5522 | if (ANDQI (tmp_bytecount, 1)) { | |
5523 | { | |
5524 | { | |
5525 | UQI opval = ANDQI (tmp_val, 255); | |
5526 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
5527 | written |= (1 << 6); | |
5528 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5529 | } | |
5530 | tmp_val = SRLDI (tmp_val, 8); | |
5531 | } | |
5532 | } | |
5533 | if (ANDQI (tmp_bytecount, 2)) { | |
5534 | { | |
5535 | { | |
5536 | UHI opval = ANDHI (tmp_val, 65535); | |
5537 | SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval); | |
5538 | written |= (1 << 5); | |
5539 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5540 | } | |
5541 | tmp_val = SRLDI (tmp_val, 16); | |
5542 | } | |
5543 | } | |
5544 | if (ANDQI (tmp_bytecount, 4)) { | |
5545 | { | |
5546 | { | |
5547 | USI opval = ANDSI (tmp_val, 0xffffffff); | |
5548 | SETMEMUSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4), opval); | |
5549 | written |= (1 << 7); | |
5550 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5551 | } | |
5552 | tmp_val = SRLDI (tmp_val, 32); | |
5553 | } | |
5554 | } | |
5555 | } | |
5556 | } | |
5557 | } | |
5558 | } | |
cbb38b47 | 5559 | |
1bbd6057 | 5560 | abuf->written = written; |
cbb38b47 BE |
5561 | return vpc; |
5562 | #undef FLD | |
5563 | } | |
5564 | ||
5565 | /* stxb: stx.b $rm, $rn, $rd */ | |
5566 | ||
5567 | static SEM_PC | |
5568 | SEM_FN_NAME (sh64_media,stxb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5569 | { | |
5570 | #define FLD(f) abuf->fields.sfmt_add.f | |
5571 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5572 | int UNUSED written = 0; | |
5573 | IADDR UNUSED pc = abuf->addr; | |
5574 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5575 | ||
5576 | { | |
5577 | UQI opval = SUBWORDDIQI (GET_H_GR (FLD (f_dest)), 7); | |
5578 | SETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval); | |
5579 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5580 | } | |
5581 | ||
5582 | return vpc; | |
5583 | #undef FLD | |
5584 | } | |
5585 | ||
5586 | /* stxl: stx.l $rm, $rn, $rd */ | |
5587 | ||
5588 | static SEM_PC | |
5589 | SEM_FN_NAME (sh64_media,stxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5590 | { | |
5591 | #define FLD(f) abuf->fields.sfmt_add.f | |
5592 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5593 | int UNUSED written = 0; | |
5594 | IADDR UNUSED pc = abuf->addr; | |
5595 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5596 | ||
5597 | { | |
5598 | SI opval = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1); | |
5599 | SETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval); | |
5600 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5601 | } | |
5602 | ||
5603 | return vpc; | |
5604 | #undef FLD | |
5605 | } | |
5606 | ||
5607 | /* stxq: stx.q $rm, $rn, $rd */ | |
5608 | ||
5609 | static SEM_PC | |
5610 | SEM_FN_NAME (sh64_media,stxq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5611 | { | |
5612 | #define FLD(f) abuf->fields.sfmt_add.f | |
5613 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5614 | int UNUSED written = 0; | |
5615 | IADDR UNUSED pc = abuf->addr; | |
5616 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5617 | ||
5618 | { | |
5619 | DI opval = GET_H_GR (FLD (f_dest)); | |
5620 | SETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval); | |
5621 | TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval); | |
5622 | } | |
5623 | ||
5624 | return vpc; | |
5625 | #undef FLD | |
5626 | } | |
5627 | ||
5628 | /* stxw: stx.w $rm, $rn, $rd */ | |
5629 | ||
5630 | static SEM_PC | |
5631 | SEM_FN_NAME (sh64_media,stxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5632 | { | |
5633 | #define FLD(f) abuf->fields.sfmt_add.f | |
5634 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5635 | int UNUSED written = 0; | |
5636 | IADDR UNUSED pc = abuf->addr; | |
5637 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5638 | ||
5639 | { | |
5640 | HI opval = SUBWORDDIHI (GET_H_GR (FLD (f_dest)), 3); | |
5641 | SETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval); | |
5642 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5643 | } | |
5644 | ||
5645 | return vpc; | |
5646 | #undef FLD | |
5647 | } | |
5648 | ||
5649 | /* sub: sub $rm, $rn, $rd */ | |
5650 | ||
5651 | static SEM_PC | |
5652 | SEM_FN_NAME (sh64_media,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5653 | { | |
5654 | #define FLD(f) abuf->fields.sfmt_add.f | |
5655 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5656 | int UNUSED written = 0; | |
5657 | IADDR UNUSED pc = abuf->addr; | |
5658 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5659 | ||
5660 | { | |
5661 | DI opval = SUBDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))); | |
5662 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5663 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5664 | } |
5665 | ||
5666 | return vpc; | |
5667 | #undef FLD | |
5668 | } | |
5669 | ||
5670 | /* subl: sub.l $rm, $rn, $rd */ | |
5671 | ||
5672 | static SEM_PC | |
5673 | SEM_FN_NAME (sh64_media,subl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5674 | { | |
5675 | #define FLD(f) abuf->fields.sfmt_add.f | |
5676 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5677 | int UNUSED written = 0; | |
5678 | IADDR UNUSED pc = abuf->addr; | |
5679 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5680 | ||
5681 | { | |
5682 | DI opval = EXTSIDI (SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))); | |
5683 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5684 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5685 | } |
5686 | ||
5687 | return vpc; | |
5688 | #undef FLD | |
5689 | } | |
5690 | ||
5691 | /* swapq: swap.q $rm, $rn, $rd */ | |
5692 | ||
5693 | static SEM_PC | |
5694 | SEM_FN_NAME (sh64_media,swapq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5695 | { | |
5696 | #define FLD(f) abuf->fields.sfmt_add.f | |
5697 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5698 | int UNUSED written = 0; | |
5699 | IADDR UNUSED pc = abuf->addr; | |
5700 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5701 | ||
5702 | { | |
5703 | DI tmp_addr; | |
5704 | DI tmp_temp; | |
5705 | tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))); | |
5706 | tmp_temp = GETMEMDI (current_cpu, pc, tmp_addr); | |
5707 | { | |
5708 | DI opval = GET_H_GR (FLD (f_dest)); | |
5709 | SETMEMDI (current_cpu, pc, tmp_addr, opval); | |
5710 | TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval); | |
5711 | } | |
5712 | { | |
5713 | DI opval = tmp_temp; | |
5714 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5715 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5716 | } |
5717 | } | |
5718 | ||
5719 | return vpc; | |
5720 | #undef FLD | |
5721 | } | |
5722 | ||
5723 | /* synci: synci */ | |
5724 | ||
5725 | static SEM_PC | |
5726 | SEM_FN_NAME (sh64_media,synci) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5727 | { | |
2310652a | 5728 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
5729 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5730 | int UNUSED written = 0; | |
5731 | IADDR UNUSED pc = abuf->addr; | |
5732 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5733 | ||
5734 | ((void) 0); /*nop*/ | |
5735 | ||
5736 | return vpc; | |
5737 | #undef FLD | |
5738 | } | |
5739 | ||
5740 | /* synco: synco */ | |
5741 | ||
5742 | static SEM_PC | |
5743 | SEM_FN_NAME (sh64_media,synco) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5744 | { | |
2310652a | 5745 | #define FLD(f) abuf->fields.sfmt_empty.f |
cbb38b47 BE |
5746 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
5747 | int UNUSED written = 0; | |
5748 | IADDR UNUSED pc = abuf->addr; | |
5749 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5750 | ||
5751 | ((void) 0); /*nop*/ | |
5752 | ||
5753 | return vpc; | |
5754 | #undef FLD | |
5755 | } | |
5756 | ||
5757 | /* trapa: trapa $rm */ | |
5758 | ||
5759 | static SEM_PC | |
5760 | SEM_FN_NAME (sh64_media,trapa) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5761 | { | |
5762 | #define FLD(f) abuf->fields.sfmt_xori.f | |
5763 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5764 | int UNUSED written = 0; | |
5765 | IADDR UNUSED pc = abuf->addr; | |
5766 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5767 | ||
5768 | sh64_trapa (current_cpu, GET_H_GR (FLD (f_left)), pc); | |
5769 | ||
5770 | return vpc; | |
5771 | #undef FLD | |
5772 | } | |
5773 | ||
5774 | /* xor: xor $rm, $rn, $rd */ | |
5775 | ||
5776 | static SEM_PC | |
5777 | SEM_FN_NAME (sh64_media,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5778 | { | |
5779 | #define FLD(f) abuf->fields.sfmt_add.f | |
5780 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5781 | int UNUSED written = 0; | |
5782 | IADDR UNUSED pc = abuf->addr; | |
5783 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5784 | ||
5785 | { | |
5786 | DI opval = XORDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))); | |
5787 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5788 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5789 | } |
5790 | ||
5791 | return vpc; | |
5792 | #undef FLD | |
5793 | } | |
5794 | ||
5795 | /* xori: xori $rm, $imm6, $rd */ | |
5796 | ||
5797 | static SEM_PC | |
5798 | SEM_FN_NAME (sh64_media,xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5799 | { | |
5800 | #define FLD(f) abuf->fields.sfmt_xori.f | |
5801 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5802 | int UNUSED written = 0; | |
5803 | IADDR UNUSED pc = abuf->addr; | |
5804 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
5805 | ||
5806 | { | |
5807 | DI opval = XORDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6))); | |
5808 | SET_H_GR (FLD (f_dest), opval); | |
1bbd6057 | 5809 | TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval); |
cbb38b47 BE |
5810 | } |
5811 | ||
5812 | return vpc; | |
5813 | #undef FLD | |
5814 | } | |
5815 | ||
5816 | /* Table of all semantic fns. */ | |
5817 | ||
5818 | static const struct sem_fn_desc sem_fns[] = { | |
5819 | { SH64_MEDIA_INSN_X_INVALID, SEM_FN_NAME (sh64_media,x_invalid) }, | |
5820 | { SH64_MEDIA_INSN_X_AFTER, SEM_FN_NAME (sh64_media,x_after) }, | |
5821 | { SH64_MEDIA_INSN_X_BEFORE, SEM_FN_NAME (sh64_media,x_before) }, | |
5822 | { SH64_MEDIA_INSN_X_CTI_CHAIN, SEM_FN_NAME (sh64_media,x_cti_chain) }, | |
5823 | { SH64_MEDIA_INSN_X_CHAIN, SEM_FN_NAME (sh64_media,x_chain) }, | |
5824 | { SH64_MEDIA_INSN_X_BEGIN, SEM_FN_NAME (sh64_media,x_begin) }, | |
5825 | { SH64_MEDIA_INSN_ADD, SEM_FN_NAME (sh64_media,add) }, | |
5826 | { SH64_MEDIA_INSN_ADDL, SEM_FN_NAME (sh64_media,addl) }, | |
5827 | { SH64_MEDIA_INSN_ADDI, SEM_FN_NAME (sh64_media,addi) }, | |
5828 | { SH64_MEDIA_INSN_ADDIL, SEM_FN_NAME (sh64_media,addil) }, | |
5829 | { SH64_MEDIA_INSN_ADDZL, SEM_FN_NAME (sh64_media,addzl) }, | |
5830 | { SH64_MEDIA_INSN_ALLOCO, SEM_FN_NAME (sh64_media,alloco) }, | |
5831 | { SH64_MEDIA_INSN_AND, SEM_FN_NAME (sh64_media,and) }, | |
5832 | { SH64_MEDIA_INSN_ANDC, SEM_FN_NAME (sh64_media,andc) }, | |
5833 | { SH64_MEDIA_INSN_ANDI, SEM_FN_NAME (sh64_media,andi) }, | |
5834 | { SH64_MEDIA_INSN_BEQ, SEM_FN_NAME (sh64_media,beq) }, | |
5835 | { SH64_MEDIA_INSN_BEQI, SEM_FN_NAME (sh64_media,beqi) }, | |
5836 | { SH64_MEDIA_INSN_BGE, SEM_FN_NAME (sh64_media,bge) }, | |
5837 | { SH64_MEDIA_INSN_BGEU, SEM_FN_NAME (sh64_media,bgeu) }, | |
5838 | { SH64_MEDIA_INSN_BGT, SEM_FN_NAME (sh64_media,bgt) }, | |
5839 | { SH64_MEDIA_INSN_BGTU, SEM_FN_NAME (sh64_media,bgtu) }, | |
5840 | { SH64_MEDIA_INSN_BLINK, SEM_FN_NAME (sh64_media,blink) }, | |
5841 | { SH64_MEDIA_INSN_BNE, SEM_FN_NAME (sh64_media,bne) }, | |
5842 | { SH64_MEDIA_INSN_BNEI, SEM_FN_NAME (sh64_media,bnei) }, | |
5843 | { SH64_MEDIA_INSN_BRK, SEM_FN_NAME (sh64_media,brk) }, | |
5844 | { SH64_MEDIA_INSN_BYTEREV, SEM_FN_NAME (sh64_media,byterev) }, | |
5845 | { SH64_MEDIA_INSN_CMPEQ, SEM_FN_NAME (sh64_media,cmpeq) }, | |
5846 | { SH64_MEDIA_INSN_CMPGT, SEM_FN_NAME (sh64_media,cmpgt) }, | |
5847 | { SH64_MEDIA_INSN_CMPGTU, SEM_FN_NAME (sh64_media,cmpgtu) }, | |
5848 | { SH64_MEDIA_INSN_CMVEQ, SEM_FN_NAME (sh64_media,cmveq) }, | |
5849 | { SH64_MEDIA_INSN_CMVNE, SEM_FN_NAME (sh64_media,cmvne) }, | |
5850 | { SH64_MEDIA_INSN_FABSD, SEM_FN_NAME (sh64_media,fabsd) }, | |
5851 | { SH64_MEDIA_INSN_FABSS, SEM_FN_NAME (sh64_media,fabss) }, | |
5852 | { SH64_MEDIA_INSN_FADDD, SEM_FN_NAME (sh64_media,faddd) }, | |
5853 | { SH64_MEDIA_INSN_FADDS, SEM_FN_NAME (sh64_media,fadds) }, | |
5854 | { SH64_MEDIA_INSN_FCMPEQD, SEM_FN_NAME (sh64_media,fcmpeqd) }, | |
5855 | { SH64_MEDIA_INSN_FCMPEQS, SEM_FN_NAME (sh64_media,fcmpeqs) }, | |
5856 | { SH64_MEDIA_INSN_FCMPGED, SEM_FN_NAME (sh64_media,fcmpged) }, | |
5857 | { SH64_MEDIA_INSN_FCMPGES, SEM_FN_NAME (sh64_media,fcmpges) }, | |
5858 | { SH64_MEDIA_INSN_FCMPGTD, SEM_FN_NAME (sh64_media,fcmpgtd) }, | |
5859 | { SH64_MEDIA_INSN_FCMPGTS, SEM_FN_NAME (sh64_media,fcmpgts) }, | |
5860 | { SH64_MEDIA_INSN_FCMPUND, SEM_FN_NAME (sh64_media,fcmpund) }, | |
5861 | { SH64_MEDIA_INSN_FCMPUNS, SEM_FN_NAME (sh64_media,fcmpuns) }, | |
5862 | { SH64_MEDIA_INSN_FCNVDS, SEM_FN_NAME (sh64_media,fcnvds) }, | |
5863 | { SH64_MEDIA_INSN_FCNVSD, SEM_FN_NAME (sh64_media,fcnvsd) }, | |
5864 | { SH64_MEDIA_INSN_FDIVD, SEM_FN_NAME (sh64_media,fdivd) }, | |
5865 | { SH64_MEDIA_INSN_FDIVS, SEM_FN_NAME (sh64_media,fdivs) }, | |
5866 | { SH64_MEDIA_INSN_FGETSCR, SEM_FN_NAME (sh64_media,fgetscr) }, | |
5867 | { SH64_MEDIA_INSN_FIPRS, SEM_FN_NAME (sh64_media,fiprs) }, | |
5868 | { SH64_MEDIA_INSN_FLDD, SEM_FN_NAME (sh64_media,fldd) }, | |
5869 | { SH64_MEDIA_INSN_FLDP, SEM_FN_NAME (sh64_media,fldp) }, | |
5870 | { SH64_MEDIA_INSN_FLDS, SEM_FN_NAME (sh64_media,flds) }, | |
5871 | { SH64_MEDIA_INSN_FLDXD, SEM_FN_NAME (sh64_media,fldxd) }, | |
5872 | { SH64_MEDIA_INSN_FLDXP, SEM_FN_NAME (sh64_media,fldxp) }, | |
5873 | { SH64_MEDIA_INSN_FLDXS, SEM_FN_NAME (sh64_media,fldxs) }, | |
5874 | { SH64_MEDIA_INSN_FLOATLD, SEM_FN_NAME (sh64_media,floatld) }, | |
5875 | { SH64_MEDIA_INSN_FLOATLS, SEM_FN_NAME (sh64_media,floatls) }, | |
5876 | { SH64_MEDIA_INSN_FLOATQD, SEM_FN_NAME (sh64_media,floatqd) }, | |
5877 | { SH64_MEDIA_INSN_FLOATQS, SEM_FN_NAME (sh64_media,floatqs) }, | |
5878 | { SH64_MEDIA_INSN_FMACS, SEM_FN_NAME (sh64_media,fmacs) }, | |
5879 | { SH64_MEDIA_INSN_FMOVD, SEM_FN_NAME (sh64_media,fmovd) }, | |
5880 | { SH64_MEDIA_INSN_FMOVDQ, SEM_FN_NAME (sh64_media,fmovdq) }, | |
5881 | { SH64_MEDIA_INSN_FMOVLS, SEM_FN_NAME (sh64_media,fmovls) }, | |
5882 | { SH64_MEDIA_INSN_FMOVQD, SEM_FN_NAME (sh64_media,fmovqd) }, | |
5883 | { SH64_MEDIA_INSN_FMOVS, SEM_FN_NAME (sh64_media,fmovs) }, | |
5884 | { SH64_MEDIA_INSN_FMOVSL, SEM_FN_NAME (sh64_media,fmovsl) }, | |
5885 | { SH64_MEDIA_INSN_FMULD, SEM_FN_NAME (sh64_media,fmuld) }, | |
5886 | { SH64_MEDIA_INSN_FMULS, SEM_FN_NAME (sh64_media,fmuls) }, | |
5887 | { SH64_MEDIA_INSN_FNEGD, SEM_FN_NAME (sh64_media,fnegd) }, | |
5888 | { SH64_MEDIA_INSN_FNEGS, SEM_FN_NAME (sh64_media,fnegs) }, | |
5889 | { SH64_MEDIA_INSN_FPUTSCR, SEM_FN_NAME (sh64_media,fputscr) }, | |
5890 | { SH64_MEDIA_INSN_FSQRTD, SEM_FN_NAME (sh64_media,fsqrtd) }, | |
5891 | { SH64_MEDIA_INSN_FSQRTS, SEM_FN_NAME (sh64_media,fsqrts) }, | |
5892 | { SH64_MEDIA_INSN_FSTD, SEM_FN_NAME (sh64_media,fstd) }, | |
5893 | { SH64_MEDIA_INSN_FSTP, SEM_FN_NAME (sh64_media,fstp) }, | |
5894 | { SH64_MEDIA_INSN_FSTS, SEM_FN_NAME (sh64_media,fsts) }, | |
5895 | { SH64_MEDIA_INSN_FSTXD, SEM_FN_NAME (sh64_media,fstxd) }, | |
5896 | { SH64_MEDIA_INSN_FSTXP, SEM_FN_NAME (sh64_media,fstxp) }, | |
5897 | { SH64_MEDIA_INSN_FSTXS, SEM_FN_NAME (sh64_media,fstxs) }, | |
5898 | { SH64_MEDIA_INSN_FSUBD, SEM_FN_NAME (sh64_media,fsubd) }, | |
5899 | { SH64_MEDIA_INSN_FSUBS, SEM_FN_NAME (sh64_media,fsubs) }, | |
5900 | { SH64_MEDIA_INSN_FTRCDL, SEM_FN_NAME (sh64_media,ftrcdl) }, | |
5901 | { SH64_MEDIA_INSN_FTRCSL, SEM_FN_NAME (sh64_media,ftrcsl) }, | |
5902 | { SH64_MEDIA_INSN_FTRCDQ, SEM_FN_NAME (sh64_media,ftrcdq) }, | |
5903 | { SH64_MEDIA_INSN_FTRCSQ, SEM_FN_NAME (sh64_media,ftrcsq) }, | |
5904 | { SH64_MEDIA_INSN_FTRVS, SEM_FN_NAME (sh64_media,ftrvs) }, | |
5905 | { SH64_MEDIA_INSN_GETCFG, SEM_FN_NAME (sh64_media,getcfg) }, | |
5906 | { SH64_MEDIA_INSN_GETCON, SEM_FN_NAME (sh64_media,getcon) }, | |
5907 | { SH64_MEDIA_INSN_GETTR, SEM_FN_NAME (sh64_media,gettr) }, | |
5908 | { SH64_MEDIA_INSN_ICBI, SEM_FN_NAME (sh64_media,icbi) }, | |
5909 | { SH64_MEDIA_INSN_LDB, SEM_FN_NAME (sh64_media,ldb) }, | |
5910 | { SH64_MEDIA_INSN_LDL, SEM_FN_NAME (sh64_media,ldl) }, | |
5911 | { SH64_MEDIA_INSN_LDQ, SEM_FN_NAME (sh64_media,ldq) }, | |
5912 | { SH64_MEDIA_INSN_LDUB, SEM_FN_NAME (sh64_media,ldub) }, | |
5913 | { SH64_MEDIA_INSN_LDUW, SEM_FN_NAME (sh64_media,lduw) }, | |
5914 | { SH64_MEDIA_INSN_LDW, SEM_FN_NAME (sh64_media,ldw) }, | |
5915 | { SH64_MEDIA_INSN_LDHIL, SEM_FN_NAME (sh64_media,ldhil) }, | |
5916 | { SH64_MEDIA_INSN_LDHIQ, SEM_FN_NAME (sh64_media,ldhiq) }, | |
5917 | { SH64_MEDIA_INSN_LDLOL, SEM_FN_NAME (sh64_media,ldlol) }, | |
5918 | { SH64_MEDIA_INSN_LDLOQ, SEM_FN_NAME (sh64_media,ldloq) }, | |
5919 | { SH64_MEDIA_INSN_LDXB, SEM_FN_NAME (sh64_media,ldxb) }, | |
5920 | { SH64_MEDIA_INSN_LDXL, SEM_FN_NAME (sh64_media,ldxl) }, | |
5921 | { SH64_MEDIA_INSN_LDXQ, SEM_FN_NAME (sh64_media,ldxq) }, | |
5922 | { SH64_MEDIA_INSN_LDXUB, SEM_FN_NAME (sh64_media,ldxub) }, | |
5923 | { SH64_MEDIA_INSN_LDXUW, SEM_FN_NAME (sh64_media,ldxuw) }, | |
5924 | { SH64_MEDIA_INSN_LDXW, SEM_FN_NAME (sh64_media,ldxw) }, | |
5925 | { SH64_MEDIA_INSN_MABSL, SEM_FN_NAME (sh64_media,mabsl) }, | |
5926 | { SH64_MEDIA_INSN_MABSW, SEM_FN_NAME (sh64_media,mabsw) }, | |
5927 | { SH64_MEDIA_INSN_MADDL, SEM_FN_NAME (sh64_media,maddl) }, | |
5928 | { SH64_MEDIA_INSN_MADDW, SEM_FN_NAME (sh64_media,maddw) }, | |
5929 | { SH64_MEDIA_INSN_MADDSL, SEM_FN_NAME (sh64_media,maddsl) }, | |
5930 | { SH64_MEDIA_INSN_MADDSUB, SEM_FN_NAME (sh64_media,maddsub) }, | |
5931 | { SH64_MEDIA_INSN_MADDSW, SEM_FN_NAME (sh64_media,maddsw) }, | |
5932 | { SH64_MEDIA_INSN_MCMPEQB, SEM_FN_NAME (sh64_media,mcmpeqb) }, | |
5933 | { SH64_MEDIA_INSN_MCMPEQL, SEM_FN_NAME (sh64_media,mcmpeql) }, | |
5934 | { SH64_MEDIA_INSN_MCMPEQW, SEM_FN_NAME (sh64_media,mcmpeqw) }, | |
5935 | { SH64_MEDIA_INSN_MCMPGTL, SEM_FN_NAME (sh64_media,mcmpgtl) }, | |
5936 | { SH64_MEDIA_INSN_MCMPGTUB, SEM_FN_NAME (sh64_media,mcmpgtub) }, | |
5937 | { SH64_MEDIA_INSN_MCMPGTW, SEM_FN_NAME (sh64_media,mcmpgtw) }, | |
5938 | { SH64_MEDIA_INSN_MCMV, SEM_FN_NAME (sh64_media,mcmv) }, | |
5939 | { SH64_MEDIA_INSN_MCNVSLW, SEM_FN_NAME (sh64_media,mcnvslw) }, | |
5940 | { SH64_MEDIA_INSN_MCNVSWB, SEM_FN_NAME (sh64_media,mcnvswb) }, | |
5941 | { SH64_MEDIA_INSN_MCNVSWUB, SEM_FN_NAME (sh64_media,mcnvswub) }, | |
5942 | { SH64_MEDIA_INSN_MEXTR1, SEM_FN_NAME (sh64_media,mextr1) }, | |
5943 | { SH64_MEDIA_INSN_MEXTR2, SEM_FN_NAME (sh64_media,mextr2) }, | |
5944 | { SH64_MEDIA_INSN_MEXTR3, SEM_FN_NAME (sh64_media,mextr3) }, | |
5945 | { SH64_MEDIA_INSN_MEXTR4, SEM_FN_NAME (sh64_media,mextr4) }, | |
5946 | { SH64_MEDIA_INSN_MEXTR5, SEM_FN_NAME (sh64_media,mextr5) }, | |
5947 | { SH64_MEDIA_INSN_MEXTR6, SEM_FN_NAME (sh64_media,mextr6) }, | |
5948 | { SH64_MEDIA_INSN_MEXTR7, SEM_FN_NAME (sh64_media,mextr7) }, | |
5949 | { SH64_MEDIA_INSN_MMACFXWL, SEM_FN_NAME (sh64_media,mmacfxwl) }, | |
5950 | { SH64_MEDIA_INSN_MMACNFX_WL, SEM_FN_NAME (sh64_media,mmacnfx_wl) }, | |
5951 | { SH64_MEDIA_INSN_MMULL, SEM_FN_NAME (sh64_media,mmull) }, | |
5952 | { SH64_MEDIA_INSN_MMULW, SEM_FN_NAME (sh64_media,mmulw) }, | |
5953 | { SH64_MEDIA_INSN_MMULFXL, SEM_FN_NAME (sh64_media,mmulfxl) }, | |
5954 | { SH64_MEDIA_INSN_MMULFXW, SEM_FN_NAME (sh64_media,mmulfxw) }, | |
5955 | { SH64_MEDIA_INSN_MMULFXRPW, SEM_FN_NAME (sh64_media,mmulfxrpw) }, | |
5956 | { SH64_MEDIA_INSN_MMULHIWL, SEM_FN_NAME (sh64_media,mmulhiwl) }, | |
5957 | { SH64_MEDIA_INSN_MMULLOWL, SEM_FN_NAME (sh64_media,mmullowl) }, | |
5958 | { SH64_MEDIA_INSN_MMULSUMWQ, SEM_FN_NAME (sh64_media,mmulsumwq) }, | |
5959 | { SH64_MEDIA_INSN_MOVI, SEM_FN_NAME (sh64_media,movi) }, | |
5960 | { SH64_MEDIA_INSN_MPERMW, SEM_FN_NAME (sh64_media,mpermw) }, | |
5961 | { SH64_MEDIA_INSN_MSADUBQ, SEM_FN_NAME (sh64_media,msadubq) }, | |
5962 | { SH64_MEDIA_INSN_MSHALDSL, SEM_FN_NAME (sh64_media,mshaldsl) }, | |
5963 | { SH64_MEDIA_INSN_MSHALDSW, SEM_FN_NAME (sh64_media,mshaldsw) }, | |
5964 | { SH64_MEDIA_INSN_MSHARDL, SEM_FN_NAME (sh64_media,mshardl) }, | |
5965 | { SH64_MEDIA_INSN_MSHARDW, SEM_FN_NAME (sh64_media,mshardw) }, | |
5966 | { SH64_MEDIA_INSN_MSHARDSQ, SEM_FN_NAME (sh64_media,mshardsq) }, | |
5967 | { SH64_MEDIA_INSN_MSHFHIB, SEM_FN_NAME (sh64_media,mshfhib) }, | |
5968 | { SH64_MEDIA_INSN_MSHFHIL, SEM_FN_NAME (sh64_media,mshfhil) }, | |
5969 | { SH64_MEDIA_INSN_MSHFHIW, SEM_FN_NAME (sh64_media,mshfhiw) }, | |
5970 | { SH64_MEDIA_INSN_MSHFLOB, SEM_FN_NAME (sh64_media,mshflob) }, | |
5971 | { SH64_MEDIA_INSN_MSHFLOL, SEM_FN_NAME (sh64_media,mshflol) }, | |
5972 | { SH64_MEDIA_INSN_MSHFLOW, SEM_FN_NAME (sh64_media,mshflow) }, | |
5973 | { SH64_MEDIA_INSN_MSHLLDL, SEM_FN_NAME (sh64_media,mshlldl) }, | |
5974 | { SH64_MEDIA_INSN_MSHLLDW, SEM_FN_NAME (sh64_media,mshlldw) }, | |
5975 | { SH64_MEDIA_INSN_MSHLRDL, SEM_FN_NAME (sh64_media,mshlrdl) }, | |
5976 | { SH64_MEDIA_INSN_MSHLRDW, SEM_FN_NAME (sh64_media,mshlrdw) }, | |
5977 | { SH64_MEDIA_INSN_MSUBL, SEM_FN_NAME (sh64_media,msubl) }, | |
5978 | { SH64_MEDIA_INSN_MSUBW, SEM_FN_NAME (sh64_media,msubw) }, | |
5979 | { SH64_MEDIA_INSN_MSUBSL, SEM_FN_NAME (sh64_media,msubsl) }, | |
5980 | { SH64_MEDIA_INSN_MSUBSUB, SEM_FN_NAME (sh64_media,msubsub) }, | |
5981 | { SH64_MEDIA_INSN_MSUBSW, SEM_FN_NAME (sh64_media,msubsw) }, | |
5982 | { SH64_MEDIA_INSN_MULSL, SEM_FN_NAME (sh64_media,mulsl) }, | |
5983 | { SH64_MEDIA_INSN_MULUL, SEM_FN_NAME (sh64_media,mulul) }, | |
5984 | { SH64_MEDIA_INSN_NOP, SEM_FN_NAME (sh64_media,nop) }, | |
5985 | { SH64_MEDIA_INSN_NSB, SEM_FN_NAME (sh64_media,nsb) }, | |
5986 | { SH64_MEDIA_INSN_OCBI, SEM_FN_NAME (sh64_media,ocbi) }, | |
5987 | { SH64_MEDIA_INSN_OCBP, SEM_FN_NAME (sh64_media,ocbp) }, | |
5988 | { SH64_MEDIA_INSN_OCBWB, SEM_FN_NAME (sh64_media,ocbwb) }, | |
5989 | { SH64_MEDIA_INSN_OR, SEM_FN_NAME (sh64_media,or) }, | |
5990 | { SH64_MEDIA_INSN_ORI, SEM_FN_NAME (sh64_media,ori) }, | |
5991 | { SH64_MEDIA_INSN_PREFI, SEM_FN_NAME (sh64_media,prefi) }, | |
5992 | { SH64_MEDIA_INSN_PTA, SEM_FN_NAME (sh64_media,pta) }, | |
5993 | { SH64_MEDIA_INSN_PTABS, SEM_FN_NAME (sh64_media,ptabs) }, | |
5994 | { SH64_MEDIA_INSN_PTB, SEM_FN_NAME (sh64_media,ptb) }, | |
5995 | { SH64_MEDIA_INSN_PTREL, SEM_FN_NAME (sh64_media,ptrel) }, | |
5996 | { SH64_MEDIA_INSN_PUTCFG, SEM_FN_NAME (sh64_media,putcfg) }, | |
5997 | { SH64_MEDIA_INSN_PUTCON, SEM_FN_NAME (sh64_media,putcon) }, | |
5998 | { SH64_MEDIA_INSN_RTE, SEM_FN_NAME (sh64_media,rte) }, | |
5999 | { SH64_MEDIA_INSN_SHARD, SEM_FN_NAME (sh64_media,shard) }, | |
6000 | { SH64_MEDIA_INSN_SHARDL, SEM_FN_NAME (sh64_media,shardl) }, | |
6001 | { SH64_MEDIA_INSN_SHARI, SEM_FN_NAME (sh64_media,shari) }, | |
6002 | { SH64_MEDIA_INSN_SHARIL, SEM_FN_NAME (sh64_media,sharil) }, | |
6003 | { SH64_MEDIA_INSN_SHLLD, SEM_FN_NAME (sh64_media,shlld) }, | |
6004 | { SH64_MEDIA_INSN_SHLLDL, SEM_FN_NAME (sh64_media,shlldl) }, | |
6005 | { SH64_MEDIA_INSN_SHLLI, SEM_FN_NAME (sh64_media,shlli) }, | |
6006 | { SH64_MEDIA_INSN_SHLLIL, SEM_FN_NAME (sh64_media,shllil) }, | |
6007 | { SH64_MEDIA_INSN_SHLRD, SEM_FN_NAME (sh64_media,shlrd) }, | |
6008 | { SH64_MEDIA_INSN_SHLRDL, SEM_FN_NAME (sh64_media,shlrdl) }, | |
6009 | { SH64_MEDIA_INSN_SHLRI, SEM_FN_NAME (sh64_media,shlri) }, | |
6010 | { SH64_MEDIA_INSN_SHLRIL, SEM_FN_NAME (sh64_media,shlril) }, | |
6011 | { SH64_MEDIA_INSN_SHORI, SEM_FN_NAME (sh64_media,shori) }, | |
6012 | { SH64_MEDIA_INSN_SLEEP, SEM_FN_NAME (sh64_media,sleep) }, | |
6013 | { SH64_MEDIA_INSN_STB, SEM_FN_NAME (sh64_media,stb) }, | |
6014 | { SH64_MEDIA_INSN_STL, SEM_FN_NAME (sh64_media,stl) }, | |
6015 | { SH64_MEDIA_INSN_STQ, SEM_FN_NAME (sh64_media,stq) }, | |
6016 | { SH64_MEDIA_INSN_STW, SEM_FN_NAME (sh64_media,stw) }, | |
6017 | { SH64_MEDIA_INSN_STHIL, SEM_FN_NAME (sh64_media,sthil) }, | |
6018 | { SH64_MEDIA_INSN_STHIQ, SEM_FN_NAME (sh64_media,sthiq) }, | |
6019 | { SH64_MEDIA_INSN_STLOL, SEM_FN_NAME (sh64_media,stlol) }, | |
6020 | { SH64_MEDIA_INSN_STLOQ, SEM_FN_NAME (sh64_media,stloq) }, | |
6021 | { SH64_MEDIA_INSN_STXB, SEM_FN_NAME (sh64_media,stxb) }, | |
6022 | { SH64_MEDIA_INSN_STXL, SEM_FN_NAME (sh64_media,stxl) }, | |
6023 | { SH64_MEDIA_INSN_STXQ, SEM_FN_NAME (sh64_media,stxq) }, | |
6024 | { SH64_MEDIA_INSN_STXW, SEM_FN_NAME (sh64_media,stxw) }, | |
6025 | { SH64_MEDIA_INSN_SUB, SEM_FN_NAME (sh64_media,sub) }, | |
6026 | { SH64_MEDIA_INSN_SUBL, SEM_FN_NAME (sh64_media,subl) }, | |
6027 | { SH64_MEDIA_INSN_SWAPQ, SEM_FN_NAME (sh64_media,swapq) }, | |
6028 | { SH64_MEDIA_INSN_SYNCI, SEM_FN_NAME (sh64_media,synci) }, | |
6029 | { SH64_MEDIA_INSN_SYNCO, SEM_FN_NAME (sh64_media,synco) }, | |
6030 | { SH64_MEDIA_INSN_TRAPA, SEM_FN_NAME (sh64_media,trapa) }, | |
6031 | { SH64_MEDIA_INSN_XOR, SEM_FN_NAME (sh64_media,xor) }, | |
6032 | { SH64_MEDIA_INSN_XORI, SEM_FN_NAME (sh64_media,xori) }, | |
6033 | { 0, 0 } | |
6034 | }; | |
6035 | ||
6036 | /* Add the semantic fns to IDESC_TABLE. */ | |
6037 | ||
6038 | void | |
6039 | SEM_FN_NAME (sh64_media,init_idesc_table) (SIM_CPU *current_cpu) | |
6040 | { | |
6041 | IDESC *idesc_table = CPU_IDESC (current_cpu); | |
6042 | const struct sem_fn_desc *sf; | |
6043 | int mach_num = MACH_NUM (CPU_MACH (current_cpu)); | |
6044 | ||
6045 | for (sf = &sem_fns[0]; sf->fn != 0; ++sf) | |
6046 | { | |
6047 | const CGEN_INSN *insn = idesc_table[sf->index].idata; | |
6048 | int valid_p = (CGEN_INSN_VIRTUAL_P (insn) | |
6049 | || CGEN_INSN_MACH_HAS_P (insn, mach_num)); | |
6050 | #if FAST_P | |
6051 | if (valid_p) | |
6052 | idesc_table[sf->index].sem_fast = sf->fn; | |
6053 | else | |
6054 | idesc_table[sf->index].sem_fast = SEM_FN_NAME (sh64_media,x_invalid); | |
6055 | #else | |
6056 | if (valid_p) | |
6057 | idesc_table[sf->index].sem_full = sf->fn; | |
6058 | else | |
6059 | idesc_table[sf->index].sem_full = SEM_FN_NAME (sh64_media,x_invalid); | |
6060 | #endif | |
6061 | } | |
6062 | } | |
6063 |