1 /* Simulator instruction semantics for sh5_media.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 2000-2009 Red Hat, Inc.
7 This file is part of the Red Hat simulators.
18 using namespace sh5; // FIXME: namespace organization still wip
19 using namespace sh5_media; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh5_media_sem_x_invalid (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
27 sh5_media::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh5_media_scache* abuf = sem;
32 unsigned long long written = 0;
33 PCADDR pc = abuf->addr;
37 current_cpu->invalid_insn (pc);
42 current_cpu->done_insn (npc, status);
46 // ********** add: add $rm, $rn, $rd
49 sh5_media_sem_add (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
50 sh5_media::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_mcmv.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh5_media_scache* abuf = sem;
55 unsigned long long written = 0;
56 PCADDR pc = abuf->addr;
60 DI opval = ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)));
61 if (UNLIKELY(current_cpu->trace_result_p))
62 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
63 current_cpu->h_gr_set (FLD (f_dest), opval);
66 current_cpu->done_insn (npc, status);
70 // ********** addl: add.l $rm, $rn, $rd
73 sh5_media_sem_addl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
74 sh5_media::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_mcmv.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh5_media_scache* abuf = sem;
79 unsigned long long written = 0;
80 PCADDR pc = abuf->addr;
84 DI opval = ADDSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1));
85 if (UNLIKELY(current_cpu->trace_result_p))
86 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
87 current_cpu->h_gr_set (FLD (f_dest), opval);
90 current_cpu->done_insn (npc, status);
94 // ********** addi: addi $rm, $disp10, $rd
97 sh5_media_sem_addi (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
98 sh5_media::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_addi.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh5_media_scache* abuf = sem;
103 unsigned long long written = 0;
104 PCADDR pc = abuf->addr;
108 DI opval = ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10)));
109 if (UNLIKELY(current_cpu->trace_result_p))
110 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
111 current_cpu->h_gr_set (FLD (f_dest), opval);
114 current_cpu->done_insn (npc, status);
118 // ********** addil: addi.l $rm, $disp10, $rd
121 sh5_media_sem_addil (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
122 sh5_media::write_stacks &buf)
124 #define FLD(f) abuf->fields.sfmt_addi.f
125 sem_status status = SEM_STATUS_NORMAL;
126 sh5_media_scache* abuf = sem;
127 unsigned long long written = 0;
128 PCADDR pc = abuf->addr;
132 DI opval = EXTSIDI (ADDSI (EXTSISI (FLD (f_disp10)), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)));
133 if (UNLIKELY(current_cpu->trace_result_p))
134 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
135 current_cpu->h_gr_set (FLD (f_dest), opval);
138 current_cpu->done_insn (npc, status);
142 // ********** addzl: addz.l $rm, $rn, $rd
145 sh5_media_sem_addzl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
146 sh5_media::write_stacks &buf)
148 #define FLD(f) abuf->fields.sfmt_mcmv.f
149 sem_status status = SEM_STATUS_NORMAL;
150 sh5_media_scache* abuf = sem;
151 unsigned long long written = 0;
152 PCADDR pc = abuf->addr;
156 DI opval = ZEXTSIDI (ADDSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1)));
157 if (UNLIKELY(current_cpu->trace_result_p))
158 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
159 current_cpu->h_gr_set (FLD (f_dest), opval);
162 current_cpu->done_insn (npc, status);
166 // ********** alloco: alloco $rm, $disp6x32
169 sh5_media_sem_alloco (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
170 sh5_media::write_stacks &buf)
172 #define FLD(f) abuf->fields.sfmt_alloco.f
173 sem_status status = SEM_STATUS_NORMAL;
174 sh5_media_scache* abuf = sem;
175 unsigned long long written = 0;
176 PCADDR pc = abuf->addr;
181 DI opval = current_cpu->h_gr_get (FLD (f_left));
182 if (UNLIKELY(current_cpu->trace_result_p))
183 current_cpu->trace_stream << "gr" << '[' << FLD (f_left) << ']' << ":=0x" << hex << opval << dec << " ";
184 current_cpu->h_gr_set (FLD (f_left), opval);
189 current_cpu->done_insn (npc, status);
193 // ********** and: and $rm, $rn, $rd
196 sh5_media_sem_and (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
197 sh5_media::write_stacks &buf)
199 #define FLD(f) abuf->fields.sfmt_mcmv.f
200 sem_status status = SEM_STATUS_NORMAL;
201 sh5_media_scache* abuf = sem;
202 unsigned long long written = 0;
203 PCADDR pc = abuf->addr;
207 DI opval = ANDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)));
208 if (UNLIKELY(current_cpu->trace_result_p))
209 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
210 current_cpu->h_gr_set (FLD (f_dest), opval);
213 current_cpu->done_insn (npc, status);
217 // ********** andc: andc $rm, $rn, $rd
220 sh5_media_sem_andc (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
221 sh5_media::write_stacks &buf)
223 #define FLD(f) abuf->fields.sfmt_mcmv.f
224 sem_status status = SEM_STATUS_NORMAL;
225 sh5_media_scache* abuf = sem;
226 unsigned long long written = 0;
227 PCADDR pc = abuf->addr;
231 DI opval = ANDDI (current_cpu->h_gr_get (FLD (f_left)), INVDI (current_cpu->h_gr_get (FLD (f_right))));
232 if (UNLIKELY(current_cpu->trace_result_p))
233 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
234 current_cpu->h_gr_set (FLD (f_dest), opval);
237 current_cpu->done_insn (npc, status);
241 // ********** andi: andi $rm, $disp10, $rd
244 sh5_media_sem_andi (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
245 sh5_media::write_stacks &buf)
247 #define FLD(f) abuf->fields.sfmt_addi.f
248 sem_status status = SEM_STATUS_NORMAL;
249 sh5_media_scache* abuf = sem;
250 unsigned long long written = 0;
251 PCADDR pc = abuf->addr;
255 DI opval = ANDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10)));
256 if (UNLIKELY(current_cpu->trace_result_p))
257 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
258 current_cpu->h_gr_set (FLD (f_dest), opval);
261 current_cpu->done_insn (npc, status);
265 // ********** beq: beq$likely $rm, $rn, $tra
268 sh5_media_sem_beq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
269 sh5_media::write_stacks &buf)
271 #define FLD(f) abuf->fields.sfmt_beq.f
272 sem_status status = SEM_STATUS_NORMAL;
273 sh5_media_scache* abuf = sem;
274 unsigned long long written = 0;
275 PCADDR pc = abuf->addr;
279 current_cpu->save_branch_optimization (FLD (f_likely));
280 if (EQDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) {
282 UDI opval = current_cpu->hardware.h_tr[FLD (f_tra)];
283 written |= (1ULL << 4);
284 if (UNLIKELY(current_cpu->trace_result_p))
285 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
286 current_cpu->branch (opval, npc, status);
291 abuf->written = written;
292 current_cpu->done_cti_insn (npc, status);
296 // ********** beqi: beqi$likely $rm, $imm6, $tra
299 sh5_media_sem_beqi (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
300 sh5_media::write_stacks &buf)
302 #define FLD(f) abuf->fields.sfmt_beqi.f
303 sem_status status = SEM_STATUS_NORMAL;
304 sh5_media_scache* abuf = sem;
305 unsigned long long written = 0;
306 PCADDR pc = abuf->addr;
310 current_cpu->save_branch_optimization (FLD (f_likely));
311 if (EQDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_imm6)))) {
313 UDI opval = current_cpu->hardware.h_tr[FLD (f_tra)];
314 written |= (1ULL << 4);
315 if (UNLIKELY(current_cpu->trace_result_p))
316 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
317 current_cpu->branch (opval, npc, status);
322 abuf->written = written;
323 current_cpu->done_cti_insn (npc, status);
327 // ********** bge: bge$likely $rm, $rn, $tra
330 sh5_media_sem_bge (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
331 sh5_media::write_stacks &buf)
333 #define FLD(f) abuf->fields.sfmt_beq.f
334 sem_status status = SEM_STATUS_NORMAL;
335 sh5_media_scache* abuf = sem;
336 unsigned long long written = 0;
337 PCADDR pc = abuf->addr;
341 current_cpu->save_branch_optimization (FLD (f_likely));
342 if (GEDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) {
344 UDI opval = current_cpu->hardware.h_tr[FLD (f_tra)];
345 written |= (1ULL << 4);
346 if (UNLIKELY(current_cpu->trace_result_p))
347 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
348 current_cpu->branch (opval, npc, status);
353 abuf->written = written;
354 current_cpu->done_cti_insn (npc, status);
358 // ********** bgeu: bgeu$likely $rm, $rn, $tra
361 sh5_media_sem_bgeu (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
362 sh5_media::write_stacks &buf)
364 #define FLD(f) abuf->fields.sfmt_beq.f
365 sem_status status = SEM_STATUS_NORMAL;
366 sh5_media_scache* abuf = sem;
367 unsigned long long written = 0;
368 PCADDR pc = abuf->addr;
372 current_cpu->save_branch_optimization (FLD (f_likely));
373 if (GEUDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) {
375 UDI opval = current_cpu->hardware.h_tr[FLD (f_tra)];
376 written |= (1ULL << 4);
377 if (UNLIKELY(current_cpu->trace_result_p))
378 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
379 current_cpu->branch (opval, npc, status);
384 abuf->written = written;
385 current_cpu->done_cti_insn (npc, status);
389 // ********** bgt: bgt$likely $rm, $rn, $tra
392 sh5_media_sem_bgt (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
393 sh5_media::write_stacks &buf)
395 #define FLD(f) abuf->fields.sfmt_beq.f
396 sem_status status = SEM_STATUS_NORMAL;
397 sh5_media_scache* abuf = sem;
398 unsigned long long written = 0;
399 PCADDR pc = abuf->addr;
403 current_cpu->save_branch_optimization (FLD (f_likely));
404 if (GTDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) {
406 UDI opval = current_cpu->hardware.h_tr[FLD (f_tra)];
407 written |= (1ULL << 4);
408 if (UNLIKELY(current_cpu->trace_result_p))
409 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
410 current_cpu->branch (opval, npc, status);
415 abuf->written = written;
416 current_cpu->done_cti_insn (npc, status);
420 // ********** bgtu: bgtu$likely $rm, $rn, $tra
423 sh5_media_sem_bgtu (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
424 sh5_media::write_stacks &buf)
426 #define FLD(f) abuf->fields.sfmt_beq.f
427 sem_status status = SEM_STATUS_NORMAL;
428 sh5_media_scache* abuf = sem;
429 unsigned long long written = 0;
430 PCADDR pc = abuf->addr;
434 current_cpu->save_branch_optimization (FLD (f_likely));
435 if (GTUDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) {
437 UDI opval = current_cpu->hardware.h_tr[FLD (f_tra)];
438 written |= (1ULL << 4);
439 if (UNLIKELY(current_cpu->trace_result_p))
440 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
441 current_cpu->branch (opval, npc, status);
446 abuf->written = written;
447 current_cpu->done_cti_insn (npc, status);
451 // ********** blink: blink $trb, $rd
454 sh5_media_sem_blink (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
455 sh5_media::write_stacks &buf)
457 #define FLD(f) abuf->fields.sfmt_blink.f
458 sem_status status = SEM_STATUS_NORMAL;
459 sh5_media_scache* abuf = sem;
460 unsigned long long written = 0;
461 PCADDR pc = abuf->addr;
466 DI opval = ORDI (ADDDI (pc, 4), 1);
467 if (UNLIKELY(current_cpu->trace_result_p))
468 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
469 current_cpu->h_gr_set (FLD (f_dest), opval);
472 UDI opval = current_cpu->hardware.h_tr[FLD (f_trb)];
473 if (UNLIKELY(current_cpu->trace_result_p))
474 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
475 current_cpu->branch (opval, npc, status);
477 if (EQSI (FLD (f_dest), 63)) {
478 current_cpu->cg_profile_jump (pc, current_cpu->hardware.h_tr[FLD (f_trb)]);
480 current_cpu->cg_profile (pc, current_cpu->hardware.h_tr[FLD (f_trb)]);
484 current_cpu->done_cti_insn (npc, status);
488 // ********** bne: bne$likely $rm, $rn, $tra
491 sh5_media_sem_bne (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
492 sh5_media::write_stacks &buf)
494 #define FLD(f) abuf->fields.sfmt_beq.f
495 sem_status status = SEM_STATUS_NORMAL;
496 sh5_media_scache* abuf = sem;
497 unsigned long long written = 0;
498 PCADDR pc = abuf->addr;
502 current_cpu->save_branch_optimization (FLD (f_likely));
503 if (NEDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) {
505 UDI opval = current_cpu->hardware.h_tr[FLD (f_tra)];
506 written |= (1ULL << 4);
507 if (UNLIKELY(current_cpu->trace_result_p))
508 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
509 current_cpu->branch (opval, npc, status);
514 abuf->written = written;
515 current_cpu->done_cti_insn (npc, status);
519 // ********** bnei: bnei$likely $rm, $imm6, $tra
522 sh5_media_sem_bnei (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
523 sh5_media::write_stacks &buf)
525 #define FLD(f) abuf->fields.sfmt_beqi.f
526 sem_status status = SEM_STATUS_NORMAL;
527 sh5_media_scache* abuf = sem;
528 unsigned long long written = 0;
529 PCADDR pc = abuf->addr;
533 current_cpu->save_branch_optimization (FLD (f_likely));
534 if (NEDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_imm6)))) {
536 UDI opval = current_cpu->hardware.h_tr[FLD (f_tra)];
537 written |= (1ULL << 4);
538 if (UNLIKELY(current_cpu->trace_result_p))
539 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
540 current_cpu->branch (opval, npc, status);
545 abuf->written = written;
546 current_cpu->done_cti_insn (npc, status);
550 // ********** brk: brk
553 sh5_media_sem_brk (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
554 sh5_media::write_stacks &buf)
556 #define FLD(f) abuf->fields.fmt_empty.f
557 sem_status status = SEM_STATUS_NORMAL;
558 sh5_media_scache* abuf = sem;
559 unsigned long long written = 0;
560 PCADDR pc = abuf->addr;
563 current_cpu->sh64_break (pc);
565 current_cpu->done_insn (npc, status);
569 // ********** byterev: byterev $rm, $rd
572 sh5_media_sem_byterev (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
573 sh5_media::write_stacks &buf)
575 #define FLD(f) abuf->fields.sfmt_xori.f
576 sem_status status = SEM_STATUS_NORMAL;
577 sh5_media_scache* abuf = sem;
578 unsigned long long written = 0;
579 PCADDR pc = abuf->addr;
585 tmp_source = current_cpu->h_gr_get (FLD (f_left));
588 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
589 tmp_source = SRLDI (tmp_source, 8);
592 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
593 tmp_source = SRLDI (tmp_source, 8);
596 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
597 tmp_source = SRLDI (tmp_source, 8);
600 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
601 tmp_source = SRLDI (tmp_source, 8);
604 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
605 tmp_source = SRLDI (tmp_source, 8);
608 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
609 tmp_source = SRLDI (tmp_source, 8);
612 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
613 tmp_source = SRLDI (tmp_source, 8);
616 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
617 tmp_source = SRLDI (tmp_source, 8);
620 DI opval = tmp_result;
621 if (UNLIKELY(current_cpu->trace_result_p))
622 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
623 current_cpu->h_gr_set (FLD (f_dest), opval);
627 current_cpu->done_insn (npc, status);
631 // ********** cmpeq: cmpeq $rm, $rn, $rd
634 sh5_media_sem_cmpeq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
635 sh5_media::write_stacks &buf)
637 #define FLD(f) abuf->fields.sfmt_mcmv.f
638 sem_status status = SEM_STATUS_NORMAL;
639 sh5_media_scache* abuf = sem;
640 unsigned long long written = 0;
641 PCADDR pc = abuf->addr;
645 DI opval = ((EQDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) ? (1) : (0));
646 if (UNLIKELY(current_cpu->trace_result_p))
647 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
648 current_cpu->h_gr_set (FLD (f_dest), opval);
651 current_cpu->done_insn (npc, status);
655 // ********** cmpgt: cmpgt $rm, $rn, $rd
658 sh5_media_sem_cmpgt (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
659 sh5_media::write_stacks &buf)
661 #define FLD(f) abuf->fields.sfmt_mcmv.f
662 sem_status status = SEM_STATUS_NORMAL;
663 sh5_media_scache* abuf = sem;
664 unsigned long long written = 0;
665 PCADDR pc = abuf->addr;
669 DI opval = ((GTDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) ? (1) : (0));
670 if (UNLIKELY(current_cpu->trace_result_p))
671 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
672 current_cpu->h_gr_set (FLD (f_dest), opval);
675 current_cpu->done_insn (npc, status);
679 // ********** cmpgtu: cmpgtu $rm,$rn, $rd
682 sh5_media_sem_cmpgtu (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
683 sh5_media::write_stacks &buf)
685 #define FLD(f) abuf->fields.sfmt_mcmv.f
686 sem_status status = SEM_STATUS_NORMAL;
687 sh5_media_scache* abuf = sem;
688 unsigned long long written = 0;
689 PCADDR pc = abuf->addr;
693 DI opval = ((GTUDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))) ? (1) : (0));
694 if (UNLIKELY(current_cpu->trace_result_p))
695 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
696 current_cpu->h_gr_set (FLD (f_dest), opval);
699 current_cpu->done_insn (npc, status);
703 // ********** cmveq: cmveq $rm, $rn, $rd
706 sh5_media_sem_cmveq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
707 sh5_media::write_stacks &buf)
709 #define FLD(f) abuf->fields.sfmt_mcmv.f
710 sem_status status = SEM_STATUS_NORMAL;
711 sh5_media_scache* abuf = sem;
712 unsigned long long written = 0;
713 PCADDR pc = abuf->addr;
716 if (EQDI (current_cpu->h_gr_get (FLD (f_left)), 0)) {
718 DI opval = current_cpu->h_gr_get (FLD (f_right));
719 written |= (1ULL << 2);
720 if (UNLIKELY(current_cpu->trace_result_p))
721 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
722 current_cpu->h_gr_set (FLD (f_dest), opval);
726 abuf->written = written;
727 current_cpu->done_insn (npc, status);
731 // ********** cmvne: cmvne $rm, $rn, $rd
734 sh5_media_sem_cmvne (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
735 sh5_media::write_stacks &buf)
737 #define FLD(f) abuf->fields.sfmt_mcmv.f
738 sem_status status = SEM_STATUS_NORMAL;
739 sh5_media_scache* abuf = sem;
740 unsigned long long written = 0;
741 PCADDR pc = abuf->addr;
744 if (NEDI (current_cpu->h_gr_get (FLD (f_left)), 0)) {
746 DI opval = current_cpu->h_gr_get (FLD (f_right));
747 written |= (1ULL << 2);
748 if (UNLIKELY(current_cpu->trace_result_p))
749 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
750 current_cpu->h_gr_set (FLD (f_dest), opval);
754 abuf->written = written;
755 current_cpu->done_insn (npc, status);
759 // ********** fabsd: fabs.d $drgh, $drf
762 sh5_media_sem_fabsd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
763 sh5_media::write_stacks &buf)
765 #define FLD(f) abuf->fields.sfmt_fabsd.f
766 sem_status status = SEM_STATUS_NORMAL;
767 sh5_media_scache* abuf = sem;
768 unsigned long long written = 0;
769 PCADDR pc = abuf->addr;
773 DF opval = current_cpu->sh64_fabsd (current_cpu->h_dr_get (FLD (f_left_right)));
774 if (UNLIKELY(current_cpu->trace_result_p))
775 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
776 current_cpu->h_dr_set (FLD (f_dest), opval);
779 current_cpu->done_insn (npc, status);
783 // ********** fabss: fabs.s $frgh, $frf
786 sh5_media_sem_fabss (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
787 sh5_media::write_stacks &buf)
789 #define FLD(f) abuf->fields.sfmt_fabss.f
790 sem_status status = SEM_STATUS_NORMAL;
791 sh5_media_scache* abuf = sem;
792 unsigned long long written = 0;
793 PCADDR pc = abuf->addr;
797 SF opval = current_cpu->sh64_fabss (current_cpu->hardware.h_fr[FLD (f_left_right)]);
798 if (UNLIKELY(current_cpu->trace_result_p))
799 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
800 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
803 current_cpu->done_insn (npc, status);
807 // ********** faddd: fadd.d $drg, $drh, $drf
810 sh5_media_sem_faddd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
811 sh5_media::write_stacks &buf)
813 #define FLD(f) abuf->fields.sfmt_faddd.f
814 sem_status status = SEM_STATUS_NORMAL;
815 sh5_media_scache* abuf = sem;
816 unsigned long long written = 0;
817 PCADDR pc = abuf->addr;
821 DF opval = current_cpu->sh64_faddd (current_cpu->h_dr_get (FLD (f_left)), current_cpu->h_dr_get (FLD (f_right)));
822 if (UNLIKELY(current_cpu->trace_result_p))
823 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
824 current_cpu->h_dr_set (FLD (f_dest), opval);
827 current_cpu->done_insn (npc, status);
831 // ********** fadds: fadd.s $frg, $frh, $frf
834 sh5_media_sem_fadds (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
835 sh5_media::write_stacks &buf)
837 #define FLD(f) abuf->fields.sfmt_fmacs.f
838 sem_status status = SEM_STATUS_NORMAL;
839 sh5_media_scache* abuf = sem;
840 unsigned long long written = 0;
841 PCADDR pc = abuf->addr;
845 SF opval = current_cpu->sh64_fadds (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]);
846 if (UNLIKELY(current_cpu->trace_result_p))
847 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
848 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
851 current_cpu->done_insn (npc, status);
855 // ********** fcmpeqd: fcmpeq.d $drg, $drh, $rd
858 sh5_media_sem_fcmpeqd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
859 sh5_media::write_stacks &buf)
861 #define FLD(f) abuf->fields.sfmt_fcmpeqd.f
862 sem_status status = SEM_STATUS_NORMAL;
863 sh5_media_scache* abuf = sem;
864 unsigned long long written = 0;
865 PCADDR pc = abuf->addr;
869 DI opval = ZEXTBIDI (current_cpu->sh64_fcmpeqd (current_cpu->h_dr_get (FLD (f_left)), current_cpu->h_dr_get (FLD (f_right))));
870 if (UNLIKELY(current_cpu->trace_result_p))
871 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
872 current_cpu->h_gr_set (FLD (f_dest), opval);
875 current_cpu->done_insn (npc, status);
879 // ********** fcmpeqs: fcmpeq.s $frg, $frh, $rd
882 sh5_media_sem_fcmpeqs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
883 sh5_media::write_stacks &buf)
885 #define FLD(f) abuf->fields.sfmt_fcmpeqs.f
886 sem_status status = SEM_STATUS_NORMAL;
887 sh5_media_scache* abuf = sem;
888 unsigned long long written = 0;
889 PCADDR pc = abuf->addr;
893 DI opval = ZEXTBIDI (current_cpu->sh64_fcmpeqs (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]));
894 if (UNLIKELY(current_cpu->trace_result_p))
895 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
896 current_cpu->h_gr_set (FLD (f_dest), opval);
899 current_cpu->done_insn (npc, status);
903 // ********** fcmpged: fcmpge.d $drg, $drh, $rd
906 sh5_media_sem_fcmpged (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
907 sh5_media::write_stacks &buf)
909 #define FLD(f) abuf->fields.sfmt_fcmpeqd.f
910 sem_status status = SEM_STATUS_NORMAL;
911 sh5_media_scache* abuf = sem;
912 unsigned long long written = 0;
913 PCADDR pc = abuf->addr;
917 DI opval = ZEXTBIDI (current_cpu->sh64_fcmpged (current_cpu->h_dr_get (FLD (f_left)), current_cpu->h_dr_get (FLD (f_right))));
918 if (UNLIKELY(current_cpu->trace_result_p))
919 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
920 current_cpu->h_gr_set (FLD (f_dest), opval);
923 current_cpu->done_insn (npc, status);
927 // ********** fcmpges: fcmpge.s $frg, $frh, $rd
930 sh5_media_sem_fcmpges (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
931 sh5_media::write_stacks &buf)
933 #define FLD(f) abuf->fields.sfmt_fcmpeqs.f
934 sem_status status = SEM_STATUS_NORMAL;
935 sh5_media_scache* abuf = sem;
936 unsigned long long written = 0;
937 PCADDR pc = abuf->addr;
941 DI opval = ZEXTBIDI (current_cpu->sh64_fcmpges (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]));
942 if (UNLIKELY(current_cpu->trace_result_p))
943 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
944 current_cpu->h_gr_set (FLD (f_dest), opval);
947 current_cpu->done_insn (npc, status);
951 // ********** fcmpgtd: fcmpgt.d $drg, $drh, $rd
954 sh5_media_sem_fcmpgtd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
955 sh5_media::write_stacks &buf)
957 #define FLD(f) abuf->fields.sfmt_fcmpeqd.f
958 sem_status status = SEM_STATUS_NORMAL;
959 sh5_media_scache* abuf = sem;
960 unsigned long long written = 0;
961 PCADDR pc = abuf->addr;
965 DI opval = ZEXTBIDI (current_cpu->sh64_fcmpgtd (current_cpu->h_dr_get (FLD (f_left)), current_cpu->h_dr_get (FLD (f_right))));
966 if (UNLIKELY(current_cpu->trace_result_p))
967 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
968 current_cpu->h_gr_set (FLD (f_dest), opval);
971 current_cpu->done_insn (npc, status);
975 // ********** fcmpgts: fcmpgt.s $frg, $frh, $rd
978 sh5_media_sem_fcmpgts (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
979 sh5_media::write_stacks &buf)
981 #define FLD(f) abuf->fields.sfmt_fcmpeqs.f
982 sem_status status = SEM_STATUS_NORMAL;
983 sh5_media_scache* abuf = sem;
984 unsigned long long written = 0;
985 PCADDR pc = abuf->addr;
989 DI opval = ZEXTBIDI (current_cpu->sh64_fcmpgts (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]));
990 if (UNLIKELY(current_cpu->trace_result_p))
991 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
992 current_cpu->h_gr_set (FLD (f_dest), opval);
995 current_cpu->done_insn (npc, status);
999 // ********** fcmpund: fcmpun.d $drg, $drh, $rd
1002 sh5_media_sem_fcmpund (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1003 sh5_media::write_stacks &buf)
1005 #define FLD(f) abuf->fields.sfmt_fcmpeqd.f
1006 sem_status status = SEM_STATUS_NORMAL;
1007 sh5_media_scache* abuf = sem;
1008 unsigned long long written = 0;
1009 PCADDR pc = abuf->addr;
1010 PCADDR npc = pc + 4;
1013 DI opval = ZEXTBIDI (current_cpu->sh64_fcmpund (current_cpu->h_dr_get (FLD (f_left)), current_cpu->h_dr_get (FLD (f_right))));
1014 if (UNLIKELY(current_cpu->trace_result_p))
1015 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1016 current_cpu->h_gr_set (FLD (f_dest), opval);
1019 current_cpu->done_insn (npc, status);
1023 // ********** fcmpuns: fcmpun.s $frg, $frh, $rd
1026 sh5_media_sem_fcmpuns (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1027 sh5_media::write_stacks &buf)
1029 #define FLD(f) abuf->fields.sfmt_fcmpeqs.f
1030 sem_status status = SEM_STATUS_NORMAL;
1031 sh5_media_scache* abuf = sem;
1032 unsigned long long written = 0;
1033 PCADDR pc = abuf->addr;
1034 PCADDR npc = pc + 4;
1037 DI opval = ZEXTBIDI (current_cpu->sh64_fcmpuns (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]));
1038 if (UNLIKELY(current_cpu->trace_result_p))
1039 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1040 current_cpu->h_gr_set (FLD (f_dest), opval);
1043 current_cpu->done_insn (npc, status);
1047 // ********** fcnvds: fcnv.ds $drgh, $frf
1050 sh5_media_sem_fcnvds (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1051 sh5_media::write_stacks &buf)
1053 #define FLD(f) abuf->fields.sfmt_fcnvds.f
1054 sem_status status = SEM_STATUS_NORMAL;
1055 sh5_media_scache* abuf = sem;
1056 unsigned long long written = 0;
1057 PCADDR pc = abuf->addr;
1058 PCADDR npc = pc + 4;
1061 SF opval = current_cpu->sh64_fcnvds (current_cpu->h_dr_get (FLD (f_left_right)));
1062 if (UNLIKELY(current_cpu->trace_result_p))
1063 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1064 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1067 current_cpu->done_insn (npc, status);
1071 // ********** fcnvsd: fcnv.sd $frgh, $drf
1074 sh5_media_sem_fcnvsd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1075 sh5_media::write_stacks &buf)
1077 #define FLD(f) abuf->fields.sfmt_fcnvsd.f
1078 sem_status status = SEM_STATUS_NORMAL;
1079 sh5_media_scache* abuf = sem;
1080 unsigned long long written = 0;
1081 PCADDR pc = abuf->addr;
1082 PCADDR npc = pc + 4;
1085 DF opval = current_cpu->sh64_fcnvsd (current_cpu->hardware.h_fr[FLD (f_left_right)]);
1086 if (UNLIKELY(current_cpu->trace_result_p))
1087 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1088 current_cpu->h_dr_set (FLD (f_dest), opval);
1091 current_cpu->done_insn (npc, status);
1095 // ********** fdivd: fdiv.d $drg, $drh, $drf
1098 sh5_media_sem_fdivd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1099 sh5_media::write_stacks &buf)
1101 #define FLD(f) abuf->fields.sfmt_faddd.f
1102 sem_status status = SEM_STATUS_NORMAL;
1103 sh5_media_scache* abuf = sem;
1104 unsigned long long written = 0;
1105 PCADDR pc = abuf->addr;
1106 PCADDR npc = pc + 4;
1109 DF opval = current_cpu->sh64_fdivd (current_cpu->h_dr_get (FLD (f_left)), current_cpu->h_dr_get (FLD (f_right)));
1110 if (UNLIKELY(current_cpu->trace_result_p))
1111 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1112 current_cpu->h_dr_set (FLD (f_dest), opval);
1115 current_cpu->done_insn (npc, status);
1119 // ********** fdivs: fdiv.s $frg, $frh, $frf
1122 sh5_media_sem_fdivs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1123 sh5_media::write_stacks &buf)
1125 #define FLD(f) abuf->fields.sfmt_fmacs.f
1126 sem_status status = SEM_STATUS_NORMAL;
1127 sh5_media_scache* abuf = sem;
1128 unsigned long long written = 0;
1129 PCADDR pc = abuf->addr;
1130 PCADDR npc = pc + 4;
1133 SF opval = current_cpu->sh64_fdivs (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]);
1134 if (UNLIKELY(current_cpu->trace_result_p))
1135 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1136 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1139 current_cpu->done_insn (npc, status);
1143 // ********** fgetscr: fgetscr $frf
1146 sh5_media_sem_fgetscr (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1147 sh5_media::write_stacks &buf)
1149 #define FLD(f) abuf->fields.sfmt_fcnvds.f
1150 sem_status status = SEM_STATUS_NORMAL;
1151 sh5_media_scache* abuf = sem;
1152 unsigned long long written = 0;
1153 PCADDR pc = abuf->addr;
1154 PCADDR npc = pc + 4;
1157 SF opval = SUBWORDSISF (current_cpu->hardware.h_fpscr);
1158 if (UNLIKELY(current_cpu->trace_result_p))
1159 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1160 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1163 current_cpu->done_insn (npc, status);
1167 // ********** fiprs: fipr.s $fvg, $fvh, $frf
1170 sh5_media_sem_fiprs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1171 sh5_media::write_stacks &buf)
1173 #define FLD(f) abuf->fields.sfmt_fiprs.f
1174 sem_status status = SEM_STATUS_NORMAL;
1175 sh5_media_scache* abuf = sem;
1176 unsigned long long written = 0;
1177 PCADDR pc = abuf->addr;
1178 PCADDR npc = pc + 4;
1182 SF opval = current_cpu->h_fv_get (FLD (f_left));
1183 if (UNLIKELY(current_cpu->trace_result_p))
1184 current_cpu->trace_stream << "fv" << '[' << FLD (f_left) << ']' << ":=0x" << hex << opval << dec << " ";
1185 current_cpu->h_fv_set (FLD (f_left), opval);
1188 SF opval = current_cpu->h_fv_get (FLD (f_right));
1189 if (UNLIKELY(current_cpu->trace_result_p))
1190 current_cpu->trace_stream << "fv" << '[' << FLD (f_right) << ']' << ":=0x" << hex << opval << dec << " ";
1191 current_cpu->h_fv_set (FLD (f_right), opval);
1194 SF opval = current_cpu->sh64_fiprs (FLD (f_left), FLD (f_right));
1195 if (UNLIKELY(current_cpu->trace_result_p))
1196 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1197 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1201 current_cpu->done_insn (npc, status);
1205 // ********** fldd: fld.d $rm, $disp10x8, $drf
1208 sh5_media_sem_fldd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1209 sh5_media::write_stacks &buf)
1211 #define FLD(f) abuf->fields.sfmt_fldd.f
1212 sem_status status = SEM_STATUS_NORMAL;
1213 sh5_media_scache* abuf = sem;
1214 unsigned long long written = 0;
1215 PCADDR pc = abuf->addr;
1216 PCADDR npc = pc + 4;
1219 DF opval = current_cpu->GETMEMDF (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp10x8)));
1220 if (UNLIKELY(current_cpu->trace_result_p))
1221 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1222 current_cpu->h_dr_set (FLD (f_dest), opval);
1225 current_cpu->done_insn (npc, status);
1229 // ********** fldp: fld.p $rm, $disp10x8, $fpf
1232 sh5_media_sem_fldp (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1233 sh5_media::write_stacks &buf)
1235 #define FLD(f) abuf->fields.sfmt_fldp.f
1236 sem_status status = SEM_STATUS_NORMAL;
1237 sh5_media_scache* abuf = sem;
1238 unsigned long long written = 0;
1239 PCADDR pc = abuf->addr;
1240 PCADDR npc = pc + 4;
1244 SF opval = current_cpu->h_fp_get (FLD (f_dest));
1245 if (UNLIKELY(current_cpu->trace_result_p))
1246 current_cpu->trace_stream << "fp" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1247 current_cpu->h_fp_set (FLD (f_dest), opval);
1249 current_cpu->sh64_fldp (pc, current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp10x8), FLD (f_dest));
1252 current_cpu->done_insn (npc, status);
1256 // ********** flds: fld.s $rm, $disp10x4, $frf
1259 sh5_media_sem_flds (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1260 sh5_media::write_stacks &buf)
1262 #define FLD(f) abuf->fields.sfmt_flds.f
1263 sem_status status = SEM_STATUS_NORMAL;
1264 sh5_media_scache* abuf = sem;
1265 unsigned long long written = 0;
1266 PCADDR pc = abuf->addr;
1267 PCADDR npc = pc + 4;
1270 SF opval = current_cpu->GETMEMSF (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp10x4)));
1271 if (UNLIKELY(current_cpu->trace_result_p))
1272 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1273 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1276 current_cpu->done_insn (npc, status);
1280 // ********** fldxd: fldx.d $rm, $rn, $drf
1283 sh5_media_sem_fldxd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1284 sh5_media::write_stacks &buf)
1286 #define FLD(f) abuf->fields.sfmt_fldxd.f
1287 sem_status status = SEM_STATUS_NORMAL;
1288 sh5_media_scache* abuf = sem;
1289 unsigned long long written = 0;
1290 PCADDR pc = abuf->addr;
1291 PCADDR npc = pc + 4;
1294 DF opval = current_cpu->GETMEMDF (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))));
1295 if (UNLIKELY(current_cpu->trace_result_p))
1296 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1297 current_cpu->h_dr_set (FLD (f_dest), opval);
1300 current_cpu->done_insn (npc, status);
1304 // ********** fldxp: fldx.p $rm, $rn, $fpf
1307 sh5_media_sem_fldxp (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1308 sh5_media::write_stacks &buf)
1310 #define FLD(f) abuf->fields.sfmt_fldxp.f
1311 sem_status status = SEM_STATUS_NORMAL;
1312 sh5_media_scache* abuf = sem;
1313 unsigned long long written = 0;
1314 PCADDR pc = abuf->addr;
1315 PCADDR npc = pc + 4;
1319 SF opval = current_cpu->h_fp_get (FLD (f_dest));
1320 if (UNLIKELY(current_cpu->trace_result_p))
1321 current_cpu->trace_stream << "fp" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1322 current_cpu->h_fp_set (FLD (f_dest), opval);
1324 current_cpu->sh64_fldp (pc, current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)), FLD (f_dest));
1327 current_cpu->done_insn (npc, status);
1331 // ********** fldxs: fldx.s $rm, $rn, $frf
1334 sh5_media_sem_fldxs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1335 sh5_media::write_stacks &buf)
1337 #define FLD(f) abuf->fields.sfmt_fldxs.f
1338 sem_status status = SEM_STATUS_NORMAL;
1339 sh5_media_scache* abuf = sem;
1340 unsigned long long written = 0;
1341 PCADDR pc = abuf->addr;
1342 PCADDR npc = pc + 4;
1345 SF opval = current_cpu->GETMEMSF (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))));
1346 if (UNLIKELY(current_cpu->trace_result_p))
1347 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1348 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1351 current_cpu->done_insn (npc, status);
1355 // ********** floatld: float.ld $frgh, $drf
1358 sh5_media_sem_floatld (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1359 sh5_media::write_stacks &buf)
1361 #define FLD(f) abuf->fields.sfmt_fcnvsd.f
1362 sem_status status = SEM_STATUS_NORMAL;
1363 sh5_media_scache* abuf = sem;
1364 unsigned long long written = 0;
1365 PCADDR pc = abuf->addr;
1366 PCADDR npc = pc + 4;
1369 DF opval = current_cpu->sh64_floatld (current_cpu->hardware.h_fr[FLD (f_left_right)]);
1370 if (UNLIKELY(current_cpu->trace_result_p))
1371 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1372 current_cpu->h_dr_set (FLD (f_dest), opval);
1375 current_cpu->done_insn (npc, status);
1379 // ********** floatls: float.ls $frgh, $frf
1382 sh5_media_sem_floatls (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1383 sh5_media::write_stacks &buf)
1385 #define FLD(f) abuf->fields.sfmt_fabss.f
1386 sem_status status = SEM_STATUS_NORMAL;
1387 sh5_media_scache* abuf = sem;
1388 unsigned long long written = 0;
1389 PCADDR pc = abuf->addr;
1390 PCADDR npc = pc + 4;
1393 SF opval = current_cpu->sh64_floatls (current_cpu->hardware.h_fr[FLD (f_left_right)]);
1394 if (UNLIKELY(current_cpu->trace_result_p))
1395 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1396 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1399 current_cpu->done_insn (npc, status);
1403 // ********** floatqd: float.qd $drgh, $drf
1406 sh5_media_sem_floatqd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1407 sh5_media::write_stacks &buf)
1409 #define FLD(f) abuf->fields.sfmt_fabsd.f
1410 sem_status status = SEM_STATUS_NORMAL;
1411 sh5_media_scache* abuf = sem;
1412 unsigned long long written = 0;
1413 PCADDR pc = abuf->addr;
1414 PCADDR npc = pc + 4;
1417 DF opval = current_cpu->sh64_floatqd (current_cpu->h_dr_get (FLD (f_left_right)));
1418 if (UNLIKELY(current_cpu->trace_result_p))
1419 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1420 current_cpu->h_dr_set (FLD (f_dest), opval);
1423 current_cpu->done_insn (npc, status);
1427 // ********** floatqs: float.qs $drgh, $frf
1430 sh5_media_sem_floatqs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1431 sh5_media::write_stacks &buf)
1433 #define FLD(f) abuf->fields.sfmt_fcnvds.f
1434 sem_status status = SEM_STATUS_NORMAL;
1435 sh5_media_scache* abuf = sem;
1436 unsigned long long written = 0;
1437 PCADDR pc = abuf->addr;
1438 PCADDR npc = pc + 4;
1441 SF opval = current_cpu->sh64_floatqs (current_cpu->h_dr_get (FLD (f_left_right)));
1442 if (UNLIKELY(current_cpu->trace_result_p))
1443 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1444 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1447 current_cpu->done_insn (npc, status);
1451 // ********** fmacs: fmac.s $frg, $frh, $frf
1454 sh5_media_sem_fmacs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1455 sh5_media::write_stacks &buf)
1457 #define FLD(f) abuf->fields.sfmt_fmacs.f
1458 sem_status status = SEM_STATUS_NORMAL;
1459 sh5_media_scache* abuf = sem;
1460 unsigned long long written = 0;
1461 PCADDR pc = abuf->addr;
1462 PCADDR npc = pc + 4;
1465 SF opval = current_cpu->sh64_fadds (current_cpu->hardware.h_fr[FLD (f_dest)], current_cpu->sh64_fmuls (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]));
1466 if (UNLIKELY(current_cpu->trace_result_p))
1467 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1468 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1471 current_cpu->done_insn (npc, status);
1475 // ********** fmovd: fmov.d $drgh, $drf
1478 sh5_media_sem_fmovd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1479 sh5_media::write_stacks &buf)
1481 #define FLD(f) abuf->fields.sfmt_fabsd.f
1482 sem_status status = SEM_STATUS_NORMAL;
1483 sh5_media_scache* abuf = sem;
1484 unsigned long long written = 0;
1485 PCADDR pc = abuf->addr;
1486 PCADDR npc = pc + 4;
1489 DF opval = current_cpu->h_dr_get (FLD (f_left_right));
1490 if (UNLIKELY(current_cpu->trace_result_p))
1491 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1492 current_cpu->h_dr_set (FLD (f_dest), opval);
1495 current_cpu->done_insn (npc, status);
1499 // ********** fmovdq: fmov.dq $drgh, $rd
1502 sh5_media_sem_fmovdq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1503 sh5_media::write_stacks &buf)
1505 #define FLD(f) abuf->fields.sfmt_fmovdq.f
1506 sem_status status = SEM_STATUS_NORMAL;
1507 sh5_media_scache* abuf = sem;
1508 unsigned long long written = 0;
1509 PCADDR pc = abuf->addr;
1510 PCADDR npc = pc + 4;
1513 DI opval = SUBWORDDFDI (current_cpu->h_dr_get (FLD (f_left_right)));
1514 if (UNLIKELY(current_cpu->trace_result_p))
1515 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1516 current_cpu->h_gr_set (FLD (f_dest), opval);
1519 current_cpu->done_insn (npc, status);
1523 // ********** fmovls: fmov.ls $rm, $frf
1526 sh5_media_sem_fmovls (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1527 sh5_media::write_stacks &buf)
1529 #define FLD(f) abuf->fields.sfmt_flds.f
1530 sem_status status = SEM_STATUS_NORMAL;
1531 sh5_media_scache* abuf = sem;
1532 unsigned long long written = 0;
1533 PCADDR pc = abuf->addr;
1534 PCADDR npc = pc + 4;
1537 SF opval = SUBWORDSISF (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1));
1538 if (UNLIKELY(current_cpu->trace_result_p))
1539 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1540 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1543 current_cpu->done_insn (npc, status);
1547 // ********** fmovqd: fmov.qd $rm, $drf
1550 sh5_media_sem_fmovqd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1551 sh5_media::write_stacks &buf)
1553 #define FLD(f) abuf->fields.sfmt_fldd.f
1554 sem_status status = SEM_STATUS_NORMAL;
1555 sh5_media_scache* abuf = sem;
1556 unsigned long long written = 0;
1557 PCADDR pc = abuf->addr;
1558 PCADDR npc = pc + 4;
1561 DF opval = SUBWORDDIDF (current_cpu->h_gr_get (FLD (f_left)));
1562 if (UNLIKELY(current_cpu->trace_result_p))
1563 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1564 current_cpu->h_dr_set (FLD (f_dest), opval);
1567 current_cpu->done_insn (npc, status);
1571 // ********** fmovs: fmov.s $frgh, $frf
1574 sh5_media_sem_fmovs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1575 sh5_media::write_stacks &buf)
1577 #define FLD(f) abuf->fields.sfmt_fabss.f
1578 sem_status status = SEM_STATUS_NORMAL;
1579 sh5_media_scache* abuf = sem;
1580 unsigned long long written = 0;
1581 PCADDR pc = abuf->addr;
1582 PCADDR npc = pc + 4;
1585 SF opval = current_cpu->hardware.h_fr[FLD (f_left_right)];
1586 if (UNLIKELY(current_cpu->trace_result_p))
1587 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1588 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1591 current_cpu->done_insn (npc, status);
1595 // ********** fmovsl: fmov.sl $frgh, $rd
1598 sh5_media_sem_fmovsl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1599 sh5_media::write_stacks &buf)
1601 #define FLD(f) abuf->fields.sfmt_fmovsl.f
1602 sem_status status = SEM_STATUS_NORMAL;
1603 sh5_media_scache* abuf = sem;
1604 unsigned long long written = 0;
1605 PCADDR pc = abuf->addr;
1606 PCADDR npc = pc + 4;
1609 DI opval = EXTSIDI (SUBWORDSFSI (current_cpu->hardware.h_fr[FLD (f_left_right)]));
1610 if (UNLIKELY(current_cpu->trace_result_p))
1611 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1612 current_cpu->h_gr_set (FLD (f_dest), opval);
1615 current_cpu->done_insn (npc, status);
1619 // ********** fmuld: fmul.d $drg, $drh, $drf
1622 sh5_media_sem_fmuld (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1623 sh5_media::write_stacks &buf)
1625 #define FLD(f) abuf->fields.sfmt_faddd.f
1626 sem_status status = SEM_STATUS_NORMAL;
1627 sh5_media_scache* abuf = sem;
1628 unsigned long long written = 0;
1629 PCADDR pc = abuf->addr;
1630 PCADDR npc = pc + 4;
1633 DF opval = current_cpu->sh64_fmuld (current_cpu->h_dr_get (FLD (f_left)), current_cpu->h_dr_get (FLD (f_right)));
1634 if (UNLIKELY(current_cpu->trace_result_p))
1635 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1636 current_cpu->h_dr_set (FLD (f_dest), opval);
1639 current_cpu->done_insn (npc, status);
1643 // ********** fmuls: fmul.s $frg, $frh, $frf
1646 sh5_media_sem_fmuls (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1647 sh5_media::write_stacks &buf)
1649 #define FLD(f) abuf->fields.sfmt_fmacs.f
1650 sem_status status = SEM_STATUS_NORMAL;
1651 sh5_media_scache* abuf = sem;
1652 unsigned long long written = 0;
1653 PCADDR pc = abuf->addr;
1654 PCADDR npc = pc + 4;
1657 SF opval = current_cpu->sh64_fmuls (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]);
1658 if (UNLIKELY(current_cpu->trace_result_p))
1659 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1660 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1663 current_cpu->done_insn (npc, status);
1667 // ********** fnegd: fneg.d $drgh, $drf
1670 sh5_media_sem_fnegd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1671 sh5_media::write_stacks &buf)
1673 #define FLD(f) abuf->fields.sfmt_fabsd.f
1674 sem_status status = SEM_STATUS_NORMAL;
1675 sh5_media_scache* abuf = sem;
1676 unsigned long long written = 0;
1677 PCADDR pc = abuf->addr;
1678 PCADDR npc = pc + 4;
1681 DF opval = current_cpu->sh64_fnegd (current_cpu->h_dr_get (FLD (f_left_right)));
1682 if (UNLIKELY(current_cpu->trace_result_p))
1683 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1684 current_cpu->h_dr_set (FLD (f_dest), opval);
1687 current_cpu->done_insn (npc, status);
1691 // ********** fnegs: fneg.s $frgh, $frf
1694 sh5_media_sem_fnegs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1695 sh5_media::write_stacks &buf)
1697 #define FLD(f) abuf->fields.sfmt_fabss.f
1698 sem_status status = SEM_STATUS_NORMAL;
1699 sh5_media_scache* abuf = sem;
1700 unsigned long long written = 0;
1701 PCADDR pc = abuf->addr;
1702 PCADDR npc = pc + 4;
1705 SF opval = current_cpu->sh64_fnegs (current_cpu->hardware.h_fr[FLD (f_left_right)]);
1706 if (UNLIKELY(current_cpu->trace_result_p))
1707 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1708 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1711 current_cpu->done_insn (npc, status);
1715 // ********** fputscr: fputscr $frgh
1718 sh5_media_sem_fputscr (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1719 sh5_media::write_stacks &buf)
1721 #define FLD(f) abuf->fields.sfmt_fmovsl.f
1722 sem_status status = SEM_STATUS_NORMAL;
1723 sh5_media_scache* abuf = sem;
1724 unsigned long long written = 0;
1725 PCADDR pc = abuf->addr;
1726 PCADDR npc = pc + 4;
1729 SI opval = SUBWORDSFSI (current_cpu->hardware.h_fr[FLD (f_left_right)]);
1730 if (UNLIKELY(current_cpu->trace_result_p))
1731 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
1732 current_cpu->hardware.h_fpscr = opval;
1735 current_cpu->done_insn (npc, status);
1739 // ********** fsqrtd: fsqrt.d $drgh, $drf
1742 sh5_media_sem_fsqrtd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1743 sh5_media::write_stacks &buf)
1745 #define FLD(f) abuf->fields.sfmt_fabsd.f
1746 sem_status status = SEM_STATUS_NORMAL;
1747 sh5_media_scache* abuf = sem;
1748 unsigned long long written = 0;
1749 PCADDR pc = abuf->addr;
1750 PCADDR npc = pc + 4;
1753 DF opval = current_cpu->sh64_fsqrtd (current_cpu->h_dr_get (FLD (f_left_right)));
1754 if (UNLIKELY(current_cpu->trace_result_p))
1755 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1756 current_cpu->h_dr_set (FLD (f_dest), opval);
1759 current_cpu->done_insn (npc, status);
1763 // ********** fsqrts: fsqrt.s $frgh, $frf
1766 sh5_media_sem_fsqrts (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1767 sh5_media::write_stacks &buf)
1769 #define FLD(f) abuf->fields.sfmt_fabss.f
1770 sem_status status = SEM_STATUS_NORMAL;
1771 sh5_media_scache* abuf = sem;
1772 unsigned long long written = 0;
1773 PCADDR pc = abuf->addr;
1774 PCADDR npc = pc + 4;
1777 SF opval = current_cpu->sh64_fsqrts (current_cpu->hardware.h_fr[FLD (f_left_right)]);
1778 if (UNLIKELY(current_cpu->trace_result_p))
1779 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1780 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1783 current_cpu->done_insn (npc, status);
1787 // ********** fstd: fst.d $rm, $disp10x8, $drf
1790 sh5_media_sem_fstd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1791 sh5_media::write_stacks &buf)
1793 #define FLD(f) abuf->fields.sfmt_fstd.f
1794 sem_status status = SEM_STATUS_NORMAL;
1795 sh5_media_scache* abuf = sem;
1796 unsigned long long written = 0;
1797 PCADDR pc = abuf->addr;
1798 PCADDR npc = pc + 4;
1801 DF opval = current_cpu->h_dr_get (FLD (f_dest));
1802 if (UNLIKELY(current_cpu->trace_result_p))
1803 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp10x8)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1804 current_cpu->SETMEMDF (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp10x8)), opval);
1807 current_cpu->done_insn (npc, status);
1811 // ********** fstp: fst.p $rm, $disp10x8, $fpf
1814 sh5_media_sem_fstp (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1815 sh5_media::write_stacks &buf)
1817 #define FLD(f) abuf->fields.sfmt_fldp.f
1818 sem_status status = SEM_STATUS_NORMAL;
1819 sh5_media_scache* abuf = sem;
1820 unsigned long long written = 0;
1821 PCADDR pc = abuf->addr;
1822 PCADDR npc = pc + 4;
1826 SF opval = current_cpu->h_fp_get (FLD (f_dest));
1827 if (UNLIKELY(current_cpu->trace_result_p))
1828 current_cpu->trace_stream << "fp" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1829 current_cpu->h_fp_set (FLD (f_dest), opval);
1831 current_cpu->sh64_fstp (pc, current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp10x8), FLD (f_dest));
1834 current_cpu->done_insn (npc, status);
1838 // ********** fsts: fst.s $rm, $disp10x4, $frf
1841 sh5_media_sem_fsts (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1842 sh5_media::write_stacks &buf)
1844 #define FLD(f) abuf->fields.sfmt_fsts.f
1845 sem_status status = SEM_STATUS_NORMAL;
1846 sh5_media_scache* abuf = sem;
1847 unsigned long long written = 0;
1848 PCADDR pc = abuf->addr;
1849 PCADDR npc = pc + 4;
1852 SF opval = current_cpu->hardware.h_fr[FLD (f_dest)];
1853 if (UNLIKELY(current_cpu->trace_result_p))
1854 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp10x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1855 current_cpu->SETMEMSF (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp10x4)), opval);
1858 current_cpu->done_insn (npc, status);
1862 // ********** fstxd: fstx.d $rm, $rn, $drf
1865 sh5_media_sem_fstxd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1866 sh5_media::write_stacks &buf)
1868 #define FLD(f) abuf->fields.sfmt_fstxd.f
1869 sem_status status = SEM_STATUS_NORMAL;
1870 sh5_media_scache* abuf = sem;
1871 unsigned long long written = 0;
1872 PCADDR pc = abuf->addr;
1873 PCADDR npc = pc + 4;
1876 DF opval = current_cpu->h_dr_get (FLD (f_dest));
1877 if (UNLIKELY(current_cpu->trace_result_p))
1878 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1879 current_cpu->SETMEMDF (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))), opval);
1882 current_cpu->done_insn (npc, status);
1886 // ********** fstxp: fstx.p $rm, $rn, $fpf
1889 sh5_media_sem_fstxp (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1890 sh5_media::write_stacks &buf)
1892 #define FLD(f) abuf->fields.sfmt_fldxp.f
1893 sem_status status = SEM_STATUS_NORMAL;
1894 sh5_media_scache* abuf = sem;
1895 unsigned long long written = 0;
1896 PCADDR pc = abuf->addr;
1897 PCADDR npc = pc + 4;
1901 SF opval = current_cpu->h_fp_get (FLD (f_dest));
1902 if (UNLIKELY(current_cpu->trace_result_p))
1903 current_cpu->trace_stream << "fp" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1904 current_cpu->h_fp_set (FLD (f_dest), opval);
1906 current_cpu->sh64_fstp (pc, current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)), FLD (f_dest));
1909 current_cpu->done_insn (npc, status);
1913 // ********** fstxs: fstx.s $rm, $rn, $frf
1916 sh5_media_sem_fstxs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1917 sh5_media::write_stacks &buf)
1919 #define FLD(f) abuf->fields.sfmt_fstxs.f
1920 sem_status status = SEM_STATUS_NORMAL;
1921 sh5_media_scache* abuf = sem;
1922 unsigned long long written = 0;
1923 PCADDR pc = abuf->addr;
1924 PCADDR npc = pc + 4;
1927 SF opval = current_cpu->hardware.h_fr[FLD (f_dest)];
1928 if (UNLIKELY(current_cpu->trace_result_p))
1929 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1930 current_cpu->SETMEMSF (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))), opval);
1933 current_cpu->done_insn (npc, status);
1937 // ********** fsubd: fsub.d $drg, $drh, $drf
1940 sh5_media_sem_fsubd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1941 sh5_media::write_stacks &buf)
1943 #define FLD(f) abuf->fields.sfmt_faddd.f
1944 sem_status status = SEM_STATUS_NORMAL;
1945 sh5_media_scache* abuf = sem;
1946 unsigned long long written = 0;
1947 PCADDR pc = abuf->addr;
1948 PCADDR npc = pc + 4;
1951 DF opval = current_cpu->sh64_fsubd (current_cpu->h_dr_get (FLD (f_left)), current_cpu->h_dr_get (FLD (f_right)));
1952 if (UNLIKELY(current_cpu->trace_result_p))
1953 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1954 current_cpu->h_dr_set (FLD (f_dest), opval);
1957 current_cpu->done_insn (npc, status);
1961 // ********** fsubs: fsub.s $frg, $frh, $frf
1964 sh5_media_sem_fsubs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1965 sh5_media::write_stacks &buf)
1967 #define FLD(f) abuf->fields.sfmt_fmacs.f
1968 sem_status status = SEM_STATUS_NORMAL;
1969 sh5_media_scache* abuf = sem;
1970 unsigned long long written = 0;
1971 PCADDR pc = abuf->addr;
1972 PCADDR npc = pc + 4;
1975 SF opval = current_cpu->sh64_fsubs (current_cpu->hardware.h_fr[FLD (f_left)], current_cpu->hardware.h_fr[FLD (f_right)]);
1976 if (UNLIKELY(current_cpu->trace_result_p))
1977 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
1978 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
1981 current_cpu->done_insn (npc, status);
1985 // ********** ftrcdl: ftrc.dl $drgh, $frf
1988 sh5_media_sem_ftrcdl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
1989 sh5_media::write_stacks &buf)
1991 #define FLD(f) abuf->fields.sfmt_fcnvds.f
1992 sem_status status = SEM_STATUS_NORMAL;
1993 sh5_media_scache* abuf = sem;
1994 unsigned long long written = 0;
1995 PCADDR pc = abuf->addr;
1996 PCADDR npc = pc + 4;
1999 SF opval = current_cpu->sh64_ftrcdl (current_cpu->h_dr_get (FLD (f_left_right)));
2000 if (UNLIKELY(current_cpu->trace_result_p))
2001 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2002 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
2005 current_cpu->done_insn (npc, status);
2009 // ********** ftrcsl: ftrc.sl $frgh, $frf
2012 sh5_media_sem_ftrcsl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2013 sh5_media::write_stacks &buf)
2015 #define FLD(f) abuf->fields.sfmt_fabss.f
2016 sem_status status = SEM_STATUS_NORMAL;
2017 sh5_media_scache* abuf = sem;
2018 unsigned long long written = 0;
2019 PCADDR pc = abuf->addr;
2020 PCADDR npc = pc + 4;
2023 SF opval = current_cpu->sh64_ftrcsl (current_cpu->hardware.h_fr[FLD (f_left_right)]);
2024 if (UNLIKELY(current_cpu->trace_result_p))
2025 current_cpu->trace_stream << "fr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2026 current_cpu->hardware.h_fr[FLD (f_dest)] = opval;
2029 current_cpu->done_insn (npc, status);
2033 // ********** ftrcdq: ftrc.dq $drgh, $drf
2036 sh5_media_sem_ftrcdq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2037 sh5_media::write_stacks &buf)
2039 #define FLD(f) abuf->fields.sfmt_fabsd.f
2040 sem_status status = SEM_STATUS_NORMAL;
2041 sh5_media_scache* abuf = sem;
2042 unsigned long long written = 0;
2043 PCADDR pc = abuf->addr;
2044 PCADDR npc = pc + 4;
2047 DF opval = current_cpu->sh64_ftrcdq (current_cpu->h_dr_get (FLD (f_left_right)));
2048 if (UNLIKELY(current_cpu->trace_result_p))
2049 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2050 current_cpu->h_dr_set (FLD (f_dest), opval);
2053 current_cpu->done_insn (npc, status);
2057 // ********** ftrcsq: ftrc.sq $frgh, $drf
2060 sh5_media_sem_ftrcsq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2061 sh5_media::write_stacks &buf)
2063 #define FLD(f) abuf->fields.sfmt_fcnvsd.f
2064 sem_status status = SEM_STATUS_NORMAL;
2065 sh5_media_scache* abuf = sem;
2066 unsigned long long written = 0;
2067 PCADDR pc = abuf->addr;
2068 PCADDR npc = pc + 4;
2071 DF opval = current_cpu->sh64_ftrcsq (current_cpu->hardware.h_fr[FLD (f_left_right)]);
2072 if (UNLIKELY(current_cpu->trace_result_p))
2073 current_cpu->trace_stream << "dr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2074 current_cpu->h_dr_set (FLD (f_dest), opval);
2077 current_cpu->done_insn (npc, status);
2081 // ********** ftrvs: ftrv.s $mtrxg, $fvh, $fvf
2084 sh5_media_sem_ftrvs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2085 sh5_media::write_stacks &buf)
2087 #define FLD(f) abuf->fields.sfmt_ftrvs.f
2088 sem_status status = SEM_STATUS_NORMAL;
2089 sh5_media_scache* abuf = sem;
2090 unsigned long long written = 0;
2091 PCADDR pc = abuf->addr;
2092 PCADDR npc = pc + 4;
2096 SF opval = current_cpu->h_fmtx_get (FLD (f_left));
2097 if (UNLIKELY(current_cpu->trace_result_p))
2098 current_cpu->trace_stream << "fmtx" << '[' << FLD (f_left) << ']' << ":=0x" << hex << opval << dec << " ";
2099 current_cpu->h_fmtx_set (FLD (f_left), opval);
2102 SF opval = current_cpu->h_fv_get (FLD (f_right));
2103 if (UNLIKELY(current_cpu->trace_result_p))
2104 current_cpu->trace_stream << "fv" << '[' << FLD (f_right) << ']' << ":=0x" << hex << opval << dec << " ";
2105 current_cpu->h_fv_set (FLD (f_right), opval);
2108 SF opval = current_cpu->h_fv_get (FLD (f_dest));
2109 if (UNLIKELY(current_cpu->trace_result_p))
2110 current_cpu->trace_stream << "fv" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2111 current_cpu->h_fv_set (FLD (f_dest), opval);
2113 current_cpu->sh64_ftrvs (FLD (f_left), FLD (f_right), FLD (f_dest));
2116 current_cpu->done_insn (npc, status);
2120 // ********** getcfg: getcfg $rm, $disp6, $rd
2123 sh5_media_sem_getcfg (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2124 sh5_media::write_stacks &buf)
2126 #define FLD(f) abuf->fields.sfmt_getcfg.f
2127 sem_status status = SEM_STATUS_NORMAL;
2128 sh5_media_scache* abuf = sem;
2129 unsigned long long written = 0;
2130 PCADDR pc = abuf->addr;
2131 PCADDR npc = pc + 4;
2135 tmp_address = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
2136 current_cpu->sh64_save_cfg_address (tmp_address);
2138 DI opval = current_cpu->GETMEMSI (pc, tmp_address);
2139 if (UNLIKELY(current_cpu->trace_result_p))
2140 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2141 current_cpu->h_gr_set (FLD (f_dest), opval);
2145 current_cpu->done_insn (npc, status);
2149 // ********** getcon: getcon $crk, $rd
2152 sh5_media_sem_getcon (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2153 sh5_media::write_stacks &buf)
2155 #define FLD(f) abuf->fields.sfmt_xori.f
2156 sem_status status = SEM_STATUS_NORMAL;
2157 sh5_media_scache* abuf = sem;
2158 unsigned long long written = 0;
2159 PCADDR pc = abuf->addr;
2160 PCADDR npc = pc + 4;
2163 DI opval = current_cpu->h_cr_get (FLD (f_left));
2164 if (UNLIKELY(current_cpu->trace_result_p))
2165 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2166 current_cpu->h_gr_set (FLD (f_dest), opval);
2169 current_cpu->done_insn (npc, status);
2173 // ********** gettr: gettr $trb, $rd
2176 sh5_media_sem_gettr (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2177 sh5_media::write_stacks &buf)
2179 #define FLD(f) abuf->fields.sfmt_blink.f
2180 sem_status status = SEM_STATUS_NORMAL;
2181 sh5_media_scache* abuf = sem;
2182 unsigned long long written = 0;
2183 PCADDR pc = abuf->addr;
2184 PCADDR npc = pc + 4;
2187 DI opval = current_cpu->hardware.h_tr[FLD (f_trb)];
2188 if (UNLIKELY(current_cpu->trace_result_p))
2189 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2190 current_cpu->h_gr_set (FLD (f_dest), opval);
2193 current_cpu->done_insn (npc, status);
2197 // ********** icbi: icbi $rm, $disp6x32
2200 sh5_media_sem_icbi (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2201 sh5_media::write_stacks &buf)
2203 #define FLD(f) abuf->fields.sfmt_alloco.f
2204 sem_status status = SEM_STATUS_NORMAL;
2205 sh5_media_scache* abuf = sem;
2206 unsigned long long written = 0;
2207 PCADDR pc = abuf->addr;
2208 PCADDR npc = pc + 4;
2212 DI opval = current_cpu->h_gr_get (FLD (f_left));
2213 if (UNLIKELY(current_cpu->trace_result_p))
2214 current_cpu->trace_stream << "gr" << '[' << FLD (f_left) << ']' << ":=0x" << hex << opval << dec << " ";
2215 current_cpu->h_gr_set (FLD (f_left), opval);
2220 current_cpu->done_insn (npc, status);
2224 // ********** ldb: ld.b $rm, $disp10, $rd
2227 sh5_media_sem_ldb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2228 sh5_media::write_stacks &buf)
2230 #define FLD(f) abuf->fields.sfmt_addi.f
2231 sem_status status = SEM_STATUS_NORMAL;
2232 sh5_media_scache* abuf = sem;
2233 unsigned long long written = 0;
2234 PCADDR pc = abuf->addr;
2235 PCADDR npc = pc + 4;
2238 DI opval = EXTQIDI (current_cpu->GETMEMQI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10)))));
2239 if (UNLIKELY(current_cpu->trace_result_p))
2240 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2241 current_cpu->h_gr_set (FLD (f_dest), opval);
2244 current_cpu->done_insn (npc, status);
2248 // ********** ldl: ld.l $rm, $disp10x4, $rd
2251 sh5_media_sem_ldl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2252 sh5_media::write_stacks &buf)
2254 #define FLD(f) abuf->fields.sfmt_ldl.f
2255 sem_status status = SEM_STATUS_NORMAL;
2256 sh5_media_scache* abuf = sem;
2257 unsigned long long written = 0;
2258 PCADDR pc = abuf->addr;
2259 PCADDR npc = pc + 4;
2262 DI opval = EXTSIDI (current_cpu->GETMEMSI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x4)))));
2263 if (UNLIKELY(current_cpu->trace_result_p))
2264 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2265 current_cpu->h_gr_set (FLD (f_dest), opval);
2268 current_cpu->done_insn (npc, status);
2272 // ********** ldq: ld.q $rm, $disp10x8, $rd
2275 sh5_media_sem_ldq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2276 sh5_media::write_stacks &buf)
2278 #define FLD(f) abuf->fields.sfmt_ldq.f
2279 sem_status status = SEM_STATUS_NORMAL;
2280 sh5_media_scache* abuf = sem;
2281 unsigned long long written = 0;
2282 PCADDR pc = abuf->addr;
2283 PCADDR npc = pc + 4;
2286 DI opval = current_cpu->GETMEMDI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x8))));
2287 if (UNLIKELY(current_cpu->trace_result_p))
2288 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2289 current_cpu->h_gr_set (FLD (f_dest), opval);
2292 current_cpu->done_insn (npc, status);
2296 // ********** ldub: ld.ub $rm, $disp10, $rd
2299 sh5_media_sem_ldub (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2300 sh5_media::write_stacks &buf)
2302 #define FLD(f) abuf->fields.sfmt_addi.f
2303 sem_status status = SEM_STATUS_NORMAL;
2304 sh5_media_scache* abuf = sem;
2305 unsigned long long written = 0;
2306 PCADDR pc = abuf->addr;
2307 PCADDR npc = pc + 4;
2310 DI opval = ZEXTQIDI (current_cpu->GETMEMQI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10)))));
2311 if (UNLIKELY(current_cpu->trace_result_p))
2312 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2313 current_cpu->h_gr_set (FLD (f_dest), opval);
2316 current_cpu->done_insn (npc, status);
2320 // ********** lduw: ld.uw $rm, $disp10x2, $rd
2323 sh5_media_sem_lduw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2324 sh5_media::write_stacks &buf)
2326 #define FLD(f) abuf->fields.sfmt_lduw.f
2327 sem_status status = SEM_STATUS_NORMAL;
2328 sh5_media_scache* abuf = sem;
2329 unsigned long long written = 0;
2330 PCADDR pc = abuf->addr;
2331 PCADDR npc = pc + 4;
2334 DI opval = ZEXTHIDI (current_cpu->GETMEMHI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x2)))));
2335 if (UNLIKELY(current_cpu->trace_result_p))
2336 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2337 current_cpu->h_gr_set (FLD (f_dest), opval);
2340 current_cpu->done_insn (npc, status);
2344 // ********** ldw: ld.w $rm, $disp10x2, $rd
2347 sh5_media_sem_ldw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2348 sh5_media::write_stacks &buf)
2350 #define FLD(f) abuf->fields.sfmt_lduw.f
2351 sem_status status = SEM_STATUS_NORMAL;
2352 sh5_media_scache* abuf = sem;
2353 unsigned long long written = 0;
2354 PCADDR pc = abuf->addr;
2355 PCADDR npc = pc + 4;
2358 DI opval = EXTHIDI (current_cpu->GETMEMHI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x2)))));
2359 if (UNLIKELY(current_cpu->trace_result_p))
2360 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2361 current_cpu->h_gr_set (FLD (f_dest), opval);
2364 current_cpu->done_insn (npc, status);
2368 // ********** ldhil: ldhi.l $rm, $disp6, $rd
2371 sh5_media_sem_ldhil (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2372 sh5_media::write_stacks &buf)
2374 #define FLD(f) abuf->fields.sfmt_getcfg.f
2375 sem_status status = SEM_STATUS_NORMAL;
2376 sh5_media_scache* abuf = sem;
2377 unsigned long long written = 0;
2378 PCADDR pc = abuf->addr;
2379 PCADDR npc = pc + 4;
2385 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
2386 tmp_bytecount = ADDDI (ANDDI (tmp_addr, 3), 1);
2388 if (ANDQI (tmp_bytecount, 4)) {
2390 DI opval = EXTSIDI (current_cpu->GETMEMSI (pc, ANDDI (tmp_addr, -4)));
2391 written |= (1ULL << 6);
2392 if (UNLIKELY(current_cpu->trace_result_p))
2393 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2394 current_cpu->h_gr_set (FLD (f_dest), opval);
2397 if (current_cpu->h_endian_get ()) {
2399 if (ANDQI (tmp_bytecount, 2)) {
2400 tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (current_cpu->GETMEMHI (pc, ANDDI (tmp_addr, -4))));
2402 if (ANDQI (tmp_bytecount, 1)) {
2403 tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (current_cpu->GETMEMQI (pc, tmp_addr)));
2406 DI opval = EXTSIDI (tmp_val);
2407 written |= (1ULL << 6);
2408 if (UNLIKELY(current_cpu->trace_result_p))
2409 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2410 current_cpu->h_gr_set (FLD (f_dest), opval);
2415 if (ANDQI (tmp_bytecount, 1)) {
2416 tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (current_cpu->GETMEMQI (pc, tmp_addr)));
2418 if (ANDQI (tmp_bytecount, 2)) {
2419 tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (current_cpu->GETMEMHI (pc, ANDDI (tmp_addr, -4))));
2422 DI opval = EXTSIDI (SLLSI (tmp_val, SUBSI (32, MULSI (8, tmp_bytecount))));
2423 written |= (1ULL << 6);
2424 if (UNLIKELY(current_cpu->trace_result_p))
2425 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2426 current_cpu->h_gr_set (FLD (f_dest), opval);
2433 abuf->written = written;
2434 current_cpu->done_insn (npc, status);
2438 // ********** ldhiq: ldhi.q $rm, $disp6, $rd
2441 sh5_media_sem_ldhiq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2442 sh5_media::write_stacks &buf)
2444 #define FLD(f) abuf->fields.sfmt_getcfg.f
2445 sem_status status = SEM_STATUS_NORMAL;
2446 sh5_media_scache* abuf = sem;
2447 unsigned long long written = 0;
2448 PCADDR pc = abuf->addr;
2449 PCADDR npc = pc + 4;
2455 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
2456 tmp_bytecount = ADDDI (ANDDI (tmp_addr, 7), 1);
2458 if (ANDQI (tmp_bytecount, 8)) {
2460 DI opval = current_cpu->GETMEMDI (pc, ANDDI (tmp_addr, -8));
2461 written |= (1ULL << 7);
2462 if (UNLIKELY(current_cpu->trace_result_p))
2463 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2464 current_cpu->h_gr_set (FLD (f_dest), opval);
2467 if (current_cpu->h_endian_get ()) {
2469 if (ANDQI (tmp_bytecount, 4)) {
2470 tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (current_cpu->GETMEMSI (pc, ANDDI (tmp_addr, -8))));
2472 if (ANDQI (tmp_bytecount, 2)) {
2473 tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (current_cpu->GETMEMHI (pc, ANDDI (tmp_addr, -4))));
2475 if (ANDQI (tmp_bytecount, 1)) {
2476 tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (current_cpu->GETMEMQI (pc, tmp_addr)));
2480 written |= (1ULL << 7);
2481 if (UNLIKELY(current_cpu->trace_result_p))
2482 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2483 current_cpu->h_gr_set (FLD (f_dest), opval);
2488 if (ANDQI (tmp_bytecount, 1)) {
2489 tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (current_cpu->GETMEMQI (pc, tmp_addr)));
2491 if (ANDQI (tmp_bytecount, 2)) {
2492 tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (current_cpu->GETMEMHI (pc, ANDDI (tmp_addr, -4))));
2494 if (ANDQI (tmp_bytecount, 4)) {
2495 tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (current_cpu->GETMEMSI (pc, ANDDI (tmp_addr, -8))));
2498 DI opval = SLLDI (tmp_val, SUBSI (64, MULSI (8, tmp_bytecount)));
2499 written |= (1ULL << 7);
2500 if (UNLIKELY(current_cpu->trace_result_p))
2501 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2502 current_cpu->h_gr_set (FLD (f_dest), opval);
2509 abuf->written = written;
2510 current_cpu->done_insn (npc, status);
2514 // ********** ldlol: ldlo.l $rm, $disp6, $rd
2517 sh5_media_sem_ldlol (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2518 sh5_media::write_stacks &buf)
2520 #define FLD(f) abuf->fields.sfmt_getcfg.f
2521 sem_status status = SEM_STATUS_NORMAL;
2522 sh5_media_scache* abuf = sem;
2523 unsigned long long written = 0;
2524 PCADDR pc = abuf->addr;
2525 PCADDR npc = pc + 4;
2531 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
2532 tmp_bytecount = SUBSI (4, ANDDI (tmp_addr, 3));
2534 if (ANDQI (tmp_bytecount, 4)) {
2536 DI opval = EXTSIDI (current_cpu->GETMEMSI (pc, tmp_addr));
2537 written |= (1ULL << 6);
2538 if (UNLIKELY(current_cpu->trace_result_p))
2539 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2540 current_cpu->h_gr_set (FLD (f_dest), opval);
2543 if (current_cpu->h_endian_get ()) {
2545 if (ANDQI (tmp_bytecount, 1)) {
2546 tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (current_cpu->GETMEMQI (pc, tmp_addr)));
2548 if (ANDQI (tmp_bytecount, 2)) {
2549 tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (current_cpu->GETMEMHI (pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2552 DI opval = EXTSIDI (SLLSI (tmp_val, SUBSI (32, MULSI (8, tmp_bytecount))));
2553 written |= (1ULL << 6);
2554 if (UNLIKELY(current_cpu->trace_result_p))
2555 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2556 current_cpu->h_gr_set (FLD (f_dest), opval);
2561 if (ANDQI (tmp_bytecount, 2)) {
2562 tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (current_cpu->GETMEMHI (pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2564 if (ANDQI (tmp_bytecount, 1)) {
2565 tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (current_cpu->GETMEMQI (pc, tmp_addr)));
2568 DI opval = EXTSIDI (tmp_val);
2569 written |= (1ULL << 6);
2570 if (UNLIKELY(current_cpu->trace_result_p))
2571 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2572 current_cpu->h_gr_set (FLD (f_dest), opval);
2579 abuf->written = written;
2580 current_cpu->done_insn (npc, status);
2584 // ********** ldloq: ldlo.q $rm, $disp6, $rd
2587 sh5_media_sem_ldloq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2588 sh5_media::write_stacks &buf)
2590 #define FLD(f) abuf->fields.sfmt_getcfg.f
2591 sem_status status = SEM_STATUS_NORMAL;
2592 sh5_media_scache* abuf = sem;
2593 unsigned long long written = 0;
2594 PCADDR pc = abuf->addr;
2595 PCADDR npc = pc + 4;
2601 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
2602 tmp_bytecount = SUBSI (8, ANDDI (tmp_addr, 7));
2604 if (ANDQI (tmp_bytecount, 8)) {
2606 DI opval = current_cpu->GETMEMDI (pc, tmp_addr);
2607 written |= (1ULL << 7);
2608 if (UNLIKELY(current_cpu->trace_result_p))
2609 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2610 current_cpu->h_gr_set (FLD (f_dest), opval);
2613 if (current_cpu->h_endian_get ()) {
2615 if (ANDQI (tmp_bytecount, 1)) {
2616 tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (current_cpu->GETMEMQI (pc, tmp_addr)));
2618 if (ANDQI (tmp_bytecount, 2)) {
2619 tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (current_cpu->GETMEMHI (pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2621 if (ANDQI (tmp_bytecount, 4)) {
2622 tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (current_cpu->GETMEMSI (pc, ANDDI (ADDDI (tmp_addr, 3), -4))));
2625 DI opval = SLLDI (tmp_val, SUBSI (64, MULSI (8, tmp_bytecount)));
2626 written |= (1ULL << 7);
2627 if (UNLIKELY(current_cpu->trace_result_p))
2628 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2629 current_cpu->h_gr_set (FLD (f_dest), opval);
2634 if (ANDQI (tmp_bytecount, 4)) {
2635 tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (current_cpu->GETMEMSI (pc, ANDDI (ADDDI (tmp_addr, 3), -4))));
2637 if (ANDQI (tmp_bytecount, 2)) {
2638 tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (current_cpu->GETMEMHI (pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2640 if (ANDQI (tmp_bytecount, 1)) {
2641 tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (current_cpu->GETMEMQI (pc, tmp_addr)));
2645 written |= (1ULL << 7);
2646 if (UNLIKELY(current_cpu->trace_result_p))
2647 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2648 current_cpu->h_gr_set (FLD (f_dest), opval);
2655 abuf->written = written;
2656 current_cpu->done_insn (npc, status);
2660 // ********** ldxb: ldx.b $rm, $rn, $rd
2663 sh5_media_sem_ldxb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2664 sh5_media::write_stacks &buf)
2666 #define FLD(f) abuf->fields.sfmt_mcmv.f
2667 sem_status status = SEM_STATUS_NORMAL;
2668 sh5_media_scache* abuf = sem;
2669 unsigned long long written = 0;
2670 PCADDR pc = abuf->addr;
2671 PCADDR npc = pc + 4;
2674 DI opval = EXTQIDI (current_cpu->GETMEMQI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))));
2675 if (UNLIKELY(current_cpu->trace_result_p))
2676 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2677 current_cpu->h_gr_set (FLD (f_dest), opval);
2680 current_cpu->done_insn (npc, status);
2684 // ********** ldxl: ldx.l $rm, $rn, $rd
2687 sh5_media_sem_ldxl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2688 sh5_media::write_stacks &buf)
2690 #define FLD(f) abuf->fields.sfmt_mcmv.f
2691 sem_status status = SEM_STATUS_NORMAL;
2692 sh5_media_scache* abuf = sem;
2693 unsigned long long written = 0;
2694 PCADDR pc = abuf->addr;
2695 PCADDR npc = pc + 4;
2698 DI opval = EXTSIDI (current_cpu->GETMEMSI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))));
2699 if (UNLIKELY(current_cpu->trace_result_p))
2700 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2701 current_cpu->h_gr_set (FLD (f_dest), opval);
2704 current_cpu->done_insn (npc, status);
2708 // ********** ldxq: ldx.q $rm, $rn, $rd
2711 sh5_media_sem_ldxq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2712 sh5_media::write_stacks &buf)
2714 #define FLD(f) abuf->fields.sfmt_mcmv.f
2715 sem_status status = SEM_STATUS_NORMAL;
2716 sh5_media_scache* abuf = sem;
2717 unsigned long long written = 0;
2718 PCADDR pc = abuf->addr;
2719 PCADDR npc = pc + 4;
2722 DI opval = current_cpu->GETMEMDI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))));
2723 if (UNLIKELY(current_cpu->trace_result_p))
2724 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2725 current_cpu->h_gr_set (FLD (f_dest), opval);
2728 current_cpu->done_insn (npc, status);
2732 // ********** ldxub: ldx.ub $rm, $rn, $rd
2735 sh5_media_sem_ldxub (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2736 sh5_media::write_stacks &buf)
2738 #define FLD(f) abuf->fields.sfmt_mcmv.f
2739 sem_status status = SEM_STATUS_NORMAL;
2740 sh5_media_scache* abuf = sem;
2741 unsigned long long written = 0;
2742 PCADDR pc = abuf->addr;
2743 PCADDR npc = pc + 4;
2746 DI opval = ZEXTQIDI (current_cpu->GETMEMUQI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))));
2747 if (UNLIKELY(current_cpu->trace_result_p))
2748 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2749 current_cpu->h_gr_set (FLD (f_dest), opval);
2752 current_cpu->done_insn (npc, status);
2756 // ********** ldxuw: ldx.uw $rm, $rn, $rd
2759 sh5_media_sem_ldxuw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2760 sh5_media::write_stacks &buf)
2762 #define FLD(f) abuf->fields.sfmt_mcmv.f
2763 sem_status status = SEM_STATUS_NORMAL;
2764 sh5_media_scache* abuf = sem;
2765 unsigned long long written = 0;
2766 PCADDR pc = abuf->addr;
2767 PCADDR npc = pc + 4;
2770 DI opval = ZEXTHIDI (current_cpu->GETMEMUHI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))));
2771 if (UNLIKELY(current_cpu->trace_result_p))
2772 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2773 current_cpu->h_gr_set (FLD (f_dest), opval);
2776 current_cpu->done_insn (npc, status);
2780 // ********** ldxw: ldx.w $rm, $rn, $rd
2783 sh5_media_sem_ldxw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2784 sh5_media::write_stacks &buf)
2786 #define FLD(f) abuf->fields.sfmt_mcmv.f
2787 sem_status status = SEM_STATUS_NORMAL;
2788 sh5_media_scache* abuf = sem;
2789 unsigned long long written = 0;
2790 PCADDR pc = abuf->addr;
2791 PCADDR npc = pc + 4;
2794 DI opval = EXTHIDI (current_cpu->GETMEMHI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)))));
2795 if (UNLIKELY(current_cpu->trace_result_p))
2796 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2797 current_cpu->h_gr_set (FLD (f_dest), opval);
2800 current_cpu->done_insn (npc, status);
2804 // ********** mabsl: mabs.l $rm, $rd
2807 sh5_media_sem_mabsl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2808 sh5_media::write_stacks &buf)
2810 #define FLD(f) abuf->fields.sfmt_xori.f
2811 sem_status status = SEM_STATUS_NORMAL;
2812 sh5_media_scache* abuf = sem;
2813 unsigned long long written = 0;
2814 PCADDR pc = abuf->addr;
2815 PCADDR npc = pc + 4;
2820 tmp_result0 = ABSSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1));
2821 tmp_result1 = ABSSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0));
2823 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2824 if (UNLIKELY(current_cpu->trace_result_p))
2825 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2826 current_cpu->h_gr_set (FLD (f_dest), opval);
2830 current_cpu->done_insn (npc, status);
2834 // ********** mabsw: mabs.w $rm, $rd
2837 sh5_media_sem_mabsw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2838 sh5_media::write_stacks &buf)
2840 #define FLD(f) abuf->fields.sfmt_xori.f
2841 sem_status status = SEM_STATUS_NORMAL;
2842 sh5_media_scache* abuf = sem;
2843 unsigned long long written = 0;
2844 PCADDR pc = abuf->addr;
2845 PCADDR npc = pc + 4;
2852 tmp_result0 = ABSHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3));
2853 tmp_result1 = ABSHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2));
2854 tmp_result2 = ABSHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1));
2855 tmp_result3 = ABSHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0));
2857 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2858 if (UNLIKELY(current_cpu->trace_result_p))
2859 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2860 current_cpu->h_gr_set (FLD (f_dest), opval);
2864 current_cpu->done_insn (npc, status);
2868 // ********** maddl: madd.l $rm, $rn, $rd
2871 sh5_media_sem_maddl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2872 sh5_media::write_stacks &buf)
2874 #define FLD(f) abuf->fields.sfmt_mcmv.f
2875 sem_status status = SEM_STATUS_NORMAL;
2876 sh5_media_scache* abuf = sem;
2877 unsigned long long written = 0;
2878 PCADDR pc = abuf->addr;
2879 PCADDR npc = pc + 4;
2884 tmp_result0 = ADDSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1));
2885 tmp_result1 = ADDSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0));
2887 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2888 if (UNLIKELY(current_cpu->trace_result_p))
2889 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2890 current_cpu->h_gr_set (FLD (f_dest), opval);
2894 current_cpu->done_insn (npc, status);
2898 // ********** maddw: madd.w $rm, $rn, $rd
2901 sh5_media_sem_maddw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2902 sh5_media::write_stacks &buf)
2904 #define FLD(f) abuf->fields.sfmt_mcmv.f
2905 sem_status status = SEM_STATUS_NORMAL;
2906 sh5_media_scache* abuf = sem;
2907 unsigned long long written = 0;
2908 PCADDR pc = abuf->addr;
2909 PCADDR npc = pc + 4;
2916 tmp_result0 = ADDHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3));
2917 tmp_result1 = ADDHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2));
2918 tmp_result2 = ADDHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1));
2919 tmp_result3 = ADDHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0));
2921 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2922 if (UNLIKELY(current_cpu->trace_result_p))
2923 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2924 current_cpu->h_gr_set (FLD (f_dest), opval);
2928 current_cpu->done_insn (npc, status);
2932 // ********** maddsl: madds.l $rm, $rn, $rd
2935 sh5_media_sem_maddsl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2936 sh5_media::write_stacks &buf)
2938 #define FLD(f) abuf->fields.sfmt_mcmv.f
2939 sem_status status = SEM_STATUS_NORMAL;
2940 sh5_media_scache* abuf = sem;
2941 unsigned long long written = 0;
2942 PCADDR pc = abuf->addr;
2943 PCADDR npc = pc + 4;
2948 tmp_result0 = ((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1))), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
2949 tmp_result1 = ((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0))), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
2951 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2952 if (UNLIKELY(current_cpu->trace_result_p))
2953 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2954 current_cpu->h_gr_set (FLD (f_dest), opval);
2958 current_cpu->done_insn (npc, status);
2962 // ********** maddsub: madds.ub $rm, $rn, $rd
2965 sh5_media_sem_maddsub (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
2966 sh5_media::write_stacks &buf)
2968 #define FLD(f) abuf->fields.sfmt_mcmv.f
2969 sem_status status = SEM_STATUS_NORMAL;
2970 sh5_media_scache* abuf = sem;
2971 unsigned long long written = 0;
2972 PCADDR pc = abuf->addr;
2973 PCADDR npc = pc + 4;
2984 tmp_result0 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7)))) : (SUBQI (SLLQI (1, 8), 1)))));
2985 tmp_result1 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6)))) : (SUBQI (SLLQI (1, 8), 1)))));
2986 tmp_result2 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5)))) : (SUBQI (SLLQI (1, 8), 1)))));
2987 tmp_result3 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4)))) : (SUBQI (SLLQI (1, 8), 1)))));
2988 tmp_result4 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3)))) : (SUBQI (SLLQI (1, 8), 1)))));
2989 tmp_result5 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2)))) : (SUBQI (SLLQI (1, 8), 1)))));
2990 tmp_result6 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1)))) : (SUBQI (SLLQI (1, 8), 1)))));
2991 tmp_result7 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0)))) : (SUBQI (SLLQI (1, 8), 1)))));
2993 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))))))));
2994 if (UNLIKELY(current_cpu->trace_result_p))
2995 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
2996 current_cpu->h_gr_set (FLD (f_dest), opval);
3000 current_cpu->done_insn (npc, status);
3004 // ********** maddsw: madds.w $rm, $rn, $rd
3007 sh5_media_sem_maddsw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3008 sh5_media::write_stacks &buf)
3010 #define FLD(f) abuf->fields.sfmt_mcmv.f
3011 sem_status status = SEM_STATUS_NORMAL;
3012 sh5_media_scache* abuf = sem;
3013 unsigned long long written = 0;
3014 PCADDR pc = abuf->addr;
3015 PCADDR npc = pc + 4;
3022 tmp_result0 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3023 tmp_result1 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3024 tmp_result2 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3025 tmp_result3 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3027 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3028 if (UNLIKELY(current_cpu->trace_result_p))
3029 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3030 current_cpu->h_gr_set (FLD (f_dest), opval);
3034 current_cpu->done_insn (npc, status);
3038 // ********** mcmpeqb: mcmpeq.b $rm, $rn, $rd
3041 sh5_media_sem_mcmpeqb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3042 sh5_media::write_stacks &buf)
3044 #define FLD(f) abuf->fields.sfmt_mcmv.f
3045 sem_status status = SEM_STATUS_NORMAL;
3046 sh5_media_scache* abuf = sem;
3047 unsigned long long written = 0;
3048 PCADDR pc = abuf->addr;
3049 PCADDR npc = pc + 4;
3060 tmp_result0 = ((EQQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))) ? (INVQI (0)) : (0));
3061 tmp_result1 = ((EQQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))) ? (INVQI (0)) : (0));
3062 tmp_result2 = ((EQQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))) ? (INVQI (0)) : (0));
3063 tmp_result3 = ((EQQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))) ? (INVQI (0)) : (0));
3064 tmp_result4 = ((EQQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))) ? (INVQI (0)) : (0));
3065 tmp_result5 = ((EQQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))) ? (INVQI (0)) : (0));
3066 tmp_result6 = ((EQQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))) ? (INVQI (0)) : (0));
3067 tmp_result7 = ((EQQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0))) ? (INVQI (0)) : (0));
3069 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))))))));
3070 if (UNLIKELY(current_cpu->trace_result_p))
3071 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3072 current_cpu->h_gr_set (FLD (f_dest), opval);
3076 current_cpu->done_insn (npc, status);
3080 // ********** mcmpeql: mcmpeq.l $rm, $rn, $rd
3083 sh5_media_sem_mcmpeql (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3084 sh5_media::write_stacks &buf)
3086 #define FLD(f) abuf->fields.sfmt_mcmv.f
3087 sem_status status = SEM_STATUS_NORMAL;
3088 sh5_media_scache* abuf = sem;
3089 unsigned long long written = 0;
3090 PCADDR pc = abuf->addr;
3091 PCADDR npc = pc + 4;
3096 tmp_result0 = ((EQSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1))) ? (INVSI (0)) : (0));
3097 tmp_result1 = ((EQSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0))) ? (INVSI (0)) : (0));
3099 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3100 if (UNLIKELY(current_cpu->trace_result_p))
3101 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3102 current_cpu->h_gr_set (FLD (f_dest), opval);
3106 current_cpu->done_insn (npc, status);
3110 // ********** mcmpeqw: mcmpeq.w $rm, $rn, $rd
3113 sh5_media_sem_mcmpeqw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3114 sh5_media::write_stacks &buf)
3116 #define FLD(f) abuf->fields.sfmt_mcmv.f
3117 sem_status status = SEM_STATUS_NORMAL;
3118 sh5_media_scache* abuf = sem;
3119 unsigned long long written = 0;
3120 PCADDR pc = abuf->addr;
3121 PCADDR npc = pc + 4;
3128 tmp_result0 = ((EQHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3))) ? (INVHI (0)) : (0));
3129 tmp_result1 = ((EQHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2))) ? (INVHI (0)) : (0));
3130 tmp_result2 = ((EQHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1))) ? (INVHI (0)) : (0));
3131 tmp_result3 = ((EQHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0))) ? (INVHI (0)) : (0));
3133 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3134 if (UNLIKELY(current_cpu->trace_result_p))
3135 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3136 current_cpu->h_gr_set (FLD (f_dest), opval);
3140 current_cpu->done_insn (npc, status);
3144 // ********** mcmpgtl: mcmpgt.l $rm, $rn, $rd
3147 sh5_media_sem_mcmpgtl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3148 sh5_media::write_stacks &buf)
3150 #define FLD(f) abuf->fields.sfmt_mcmv.f
3151 sem_status status = SEM_STATUS_NORMAL;
3152 sh5_media_scache* abuf = sem;
3153 unsigned long long written = 0;
3154 PCADDR pc = abuf->addr;
3155 PCADDR npc = pc + 4;
3160 tmp_result0 = ((GTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1))) ? (INVSI (0)) : (0));
3161 tmp_result1 = ((GTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0))) ? (INVSI (0)) : (0));
3163 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3164 if (UNLIKELY(current_cpu->trace_result_p))
3165 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3166 current_cpu->h_gr_set (FLD (f_dest), opval);
3170 current_cpu->done_insn (npc, status);
3174 // ********** mcmpgtub: mcmpgt.ub $rm, $rn, $rd
3177 sh5_media_sem_mcmpgtub (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3178 sh5_media::write_stacks &buf)
3180 #define FLD(f) abuf->fields.sfmt_mcmv.f
3181 sem_status status = SEM_STATUS_NORMAL;
3182 sh5_media_scache* abuf = sem;
3183 unsigned long long written = 0;
3184 PCADDR pc = abuf->addr;
3185 PCADDR npc = pc + 4;
3196 tmp_result0 = ((GTUQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))) ? (INVQI (0)) : (0));
3197 tmp_result1 = ((GTUQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))) ? (INVQI (0)) : (0));
3198 tmp_result2 = ((GTUQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))) ? (INVQI (0)) : (0));
3199 tmp_result3 = ((GTUQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))) ? (INVQI (0)) : (0));
3200 tmp_result4 = ((GTUQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))) ? (INVQI (0)) : (0));
3201 tmp_result5 = ((GTUQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))) ? (INVQI (0)) : (0));
3202 tmp_result6 = ((GTUQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))) ? (INVQI (0)) : (0));
3203 tmp_result7 = ((GTUQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0))) ? (INVQI (0)) : (0));
3205 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))))))));
3206 if (UNLIKELY(current_cpu->trace_result_p))
3207 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3208 current_cpu->h_gr_set (FLD (f_dest), opval);
3212 current_cpu->done_insn (npc, status);
3216 // ********** mcmpgtw: mcmpgt.w $rm, $rn, $rd
3219 sh5_media_sem_mcmpgtw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3220 sh5_media::write_stacks &buf)
3222 #define FLD(f) abuf->fields.sfmt_mcmv.f
3223 sem_status status = SEM_STATUS_NORMAL;
3224 sh5_media_scache* abuf = sem;
3225 unsigned long long written = 0;
3226 PCADDR pc = abuf->addr;
3227 PCADDR npc = pc + 4;
3234 tmp_result0 = ((GTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3))) ? (INVHI (0)) : (0));
3235 tmp_result1 = ((GTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2))) ? (INVHI (0)) : (0));
3236 tmp_result2 = ((GTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1))) ? (INVHI (0)) : (0));
3237 tmp_result3 = ((GTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0))) ? (INVHI (0)) : (0));
3239 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3240 if (UNLIKELY(current_cpu->trace_result_p))
3241 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3242 current_cpu->h_gr_set (FLD (f_dest), opval);
3246 current_cpu->done_insn (npc, status);
3250 // ********** mcmv: mcmv $rm, $rn, $rd
3253 sh5_media_sem_mcmv (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3254 sh5_media::write_stacks &buf)
3256 #define FLD(f) abuf->fields.sfmt_mcmv.f
3257 sem_status status = SEM_STATUS_NORMAL;
3258 sh5_media_scache* abuf = sem;
3259 unsigned long long written = 0;
3260 PCADDR pc = abuf->addr;
3261 PCADDR npc = pc + 4;
3264 DI opval = ORDI (ANDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))), ANDDI (current_cpu->h_gr_get (FLD (f_dest)), INVDI (current_cpu->h_gr_get (FLD (f_right)))));
3265 if (UNLIKELY(current_cpu->trace_result_p))
3266 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3267 current_cpu->h_gr_set (FLD (f_dest), opval);
3270 current_cpu->done_insn (npc, status);
3274 // ********** mcnvslw: mcnvs.lw $rm, $rn, $rd
3277 sh5_media_sem_mcnvslw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3278 sh5_media::write_stacks &buf)
3280 #define FLD(f) abuf->fields.sfmt_mcmv.f
3281 sem_status status = SEM_STATUS_NORMAL;
3282 sh5_media_scache* abuf = sem;
3283 unsigned long long written = 0;
3284 PCADDR pc = abuf->addr;
3285 PCADDR npc = pc + 4;
3292 tmp_result0 = ((LTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3293 tmp_result1 = ((LTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3294 tmp_result2 = ((LTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3295 tmp_result3 = ((LTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3297 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3298 if (UNLIKELY(current_cpu->trace_result_p))
3299 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3300 current_cpu->h_gr_set (FLD (f_dest), opval);
3304 current_cpu->done_insn (npc, status);
3308 // ********** mcnvswb: mcnvs.wb $rm, $rn, $rd
3311 sh5_media_sem_mcnvswb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3312 sh5_media::write_stacks &buf)
3314 #define FLD(f) abuf->fields.sfmt_mcmv.f
3315 sem_status status = SEM_STATUS_NORMAL;
3316 sh5_media_scache* abuf = sem;
3317 unsigned long long written = 0;
3318 PCADDR pc = abuf->addr;
3319 PCADDR npc = pc + 4;
3330 tmp_result0 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3331 tmp_result1 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3332 tmp_result2 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3333 tmp_result3 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3334 tmp_result4 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3335 tmp_result5 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3336 tmp_result6 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3337 tmp_result7 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3339 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))))))));
3340 if (UNLIKELY(current_cpu->trace_result_p))
3341 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3342 current_cpu->h_gr_set (FLD (f_dest), opval);
3346 current_cpu->done_insn (npc, status);
3350 // ********** mcnvswub: mcnvs.wub $rm, $rn, $rd
3353 sh5_media_sem_mcnvswub (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3354 sh5_media::write_stacks &buf)
3356 #define FLD(f) abuf->fields.sfmt_mcmv.f
3357 sem_status status = SEM_STATUS_NORMAL;
3358 sh5_media_scache* abuf = sem;
3359 unsigned long long written = 0;
3360 PCADDR pc = abuf->addr;
3361 PCADDR npc = pc + 4;
3372 tmp_result0 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), SLLDI (1, 8))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)) : (SUBQI (SLLQI (1, 8), 1)))));
3373 tmp_result1 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), SLLDI (1, 8))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)) : (SUBQI (SLLQI (1, 8), 1)))));
3374 tmp_result2 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), SLLDI (1, 8))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)) : (SUBQI (SLLQI (1, 8), 1)))));
3375 tmp_result3 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), SLLDI (1, 8))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)) : (SUBQI (SLLQI (1, 8), 1)))));
3376 tmp_result4 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3), SLLDI (1, 8))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3)) : (SUBQI (SLLQI (1, 8), 1)))));
3377 tmp_result5 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2), SLLDI (1, 8))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2)) : (SUBQI (SLLQI (1, 8), 1)))));
3378 tmp_result6 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1), SLLDI (1, 8))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1)) : (SUBQI (SLLQI (1, 8), 1)))));
3379 tmp_result7 = ((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0), SLLDI (1, 8))) ? (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0)) : (SUBQI (SLLQI (1, 8), 1)))));
3381 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))))))));
3382 if (UNLIKELY(current_cpu->trace_result_p))
3383 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3384 current_cpu->h_gr_set (FLD (f_dest), opval);
3388 current_cpu->done_insn (npc, status);
3392 // ********** mextr1: mextr1 $rm, $rn, $rd
3395 sh5_media_sem_mextr1 (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3396 sh5_media::write_stacks &buf)
3398 #define FLD(f) abuf->fields.sfmt_mcmv.f
3399 sem_status status = SEM_STATUS_NORMAL;
3400 sh5_media_scache* abuf = sem;
3401 unsigned long long written = 0;
3402 PCADDR pc = abuf->addr;
3403 PCADDR npc = pc + 4;
3409 tmp_count = MULQI (8, 1);
3410 tmp_mask = SLLDI (INVSI (0), tmp_count);
3411 tmp_rhs = SRLDI (ANDDI (current_cpu->h_gr_get (FLD (f_left)), tmp_mask), tmp_count);
3412 tmp_count = MULQI (8, SUBQI (8, 1));
3413 tmp_mask = SRLDI (INVSI (0), tmp_count);
3415 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (current_cpu->h_gr_get (FLD (f_right)), tmp_mask), tmp_count));
3416 if (UNLIKELY(current_cpu->trace_result_p))
3417 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3418 current_cpu->h_gr_set (FLD (f_dest), opval);
3422 current_cpu->done_insn (npc, status);
3426 // ********** mextr2: mextr2 $rm, $rn, $rd
3429 sh5_media_sem_mextr2 (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3430 sh5_media::write_stacks &buf)
3432 #define FLD(f) abuf->fields.sfmt_mcmv.f
3433 sem_status status = SEM_STATUS_NORMAL;
3434 sh5_media_scache* abuf = sem;
3435 unsigned long long written = 0;
3436 PCADDR pc = abuf->addr;
3437 PCADDR npc = pc + 4;
3443 tmp_count = MULQI (8, 2);
3444 tmp_mask = SLLDI (INVSI (0), tmp_count);
3445 tmp_rhs = SRLDI (ANDDI (current_cpu->h_gr_get (FLD (f_left)), tmp_mask), tmp_count);
3446 tmp_count = MULQI (8, SUBQI (8, 2));
3447 tmp_mask = SRLDI (INVSI (0), tmp_count);
3449 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (current_cpu->h_gr_get (FLD (f_right)), tmp_mask), tmp_count));
3450 if (UNLIKELY(current_cpu->trace_result_p))
3451 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3452 current_cpu->h_gr_set (FLD (f_dest), opval);
3456 current_cpu->done_insn (npc, status);
3460 // ********** mextr3: mextr3 $rm, $rn, $rd
3463 sh5_media_sem_mextr3 (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3464 sh5_media::write_stacks &buf)
3466 #define FLD(f) abuf->fields.sfmt_mcmv.f
3467 sem_status status = SEM_STATUS_NORMAL;
3468 sh5_media_scache* abuf = sem;
3469 unsigned long long written = 0;
3470 PCADDR pc = abuf->addr;
3471 PCADDR npc = pc + 4;
3477 tmp_count = MULQI (8, 3);
3478 tmp_mask = SLLDI (INVSI (0), tmp_count);
3479 tmp_rhs = SRLDI (ANDDI (current_cpu->h_gr_get (FLD (f_left)), tmp_mask), tmp_count);
3480 tmp_count = MULQI (8, SUBQI (8, 3));
3481 tmp_mask = SRLDI (INVSI (0), tmp_count);
3483 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (current_cpu->h_gr_get (FLD (f_right)), tmp_mask), tmp_count));
3484 if (UNLIKELY(current_cpu->trace_result_p))
3485 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3486 current_cpu->h_gr_set (FLD (f_dest), opval);
3490 current_cpu->done_insn (npc, status);
3494 // ********** mextr4: mextr4 $rm, $rn, $rd
3497 sh5_media_sem_mextr4 (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3498 sh5_media::write_stacks &buf)
3500 #define FLD(f) abuf->fields.sfmt_mcmv.f
3501 sem_status status = SEM_STATUS_NORMAL;
3502 sh5_media_scache* abuf = sem;
3503 unsigned long long written = 0;
3504 PCADDR pc = abuf->addr;
3505 PCADDR npc = pc + 4;
3511 tmp_count = MULQI (8, 4);
3512 tmp_mask = SLLDI (INVSI (0), tmp_count);
3513 tmp_rhs = SRLDI (ANDDI (current_cpu->h_gr_get (FLD (f_left)), tmp_mask), tmp_count);
3514 tmp_count = MULQI (8, SUBQI (8, 4));
3515 tmp_mask = SRLDI (INVSI (0), tmp_count);
3517 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (current_cpu->h_gr_get (FLD (f_right)), tmp_mask), tmp_count));
3518 if (UNLIKELY(current_cpu->trace_result_p))
3519 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3520 current_cpu->h_gr_set (FLD (f_dest), opval);
3524 current_cpu->done_insn (npc, status);
3528 // ********** mextr5: mextr5 $rm, $rn, $rd
3531 sh5_media_sem_mextr5 (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3532 sh5_media::write_stacks &buf)
3534 #define FLD(f) abuf->fields.sfmt_mcmv.f
3535 sem_status status = SEM_STATUS_NORMAL;
3536 sh5_media_scache* abuf = sem;
3537 unsigned long long written = 0;
3538 PCADDR pc = abuf->addr;
3539 PCADDR npc = pc + 4;
3545 tmp_count = MULQI (8, 5);
3546 tmp_mask = SLLDI (INVSI (0), tmp_count);
3547 tmp_rhs = SRLDI (ANDDI (current_cpu->h_gr_get (FLD (f_left)), tmp_mask), tmp_count);
3548 tmp_count = MULQI (8, SUBQI (8, 5));
3549 tmp_mask = SRLDI (INVSI (0), tmp_count);
3551 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (current_cpu->h_gr_get (FLD (f_right)), tmp_mask), tmp_count));
3552 if (UNLIKELY(current_cpu->trace_result_p))
3553 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3554 current_cpu->h_gr_set (FLD (f_dest), opval);
3558 current_cpu->done_insn (npc, status);
3562 // ********** mextr6: mextr6 $rm, $rn, $rd
3565 sh5_media_sem_mextr6 (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3566 sh5_media::write_stacks &buf)
3568 #define FLD(f) abuf->fields.sfmt_mcmv.f
3569 sem_status status = SEM_STATUS_NORMAL;
3570 sh5_media_scache* abuf = sem;
3571 unsigned long long written = 0;
3572 PCADDR pc = abuf->addr;
3573 PCADDR npc = pc + 4;
3579 tmp_count = MULQI (8, 6);
3580 tmp_mask = SLLDI (INVSI (0), tmp_count);
3581 tmp_rhs = SRLDI (ANDDI (current_cpu->h_gr_get (FLD (f_left)), tmp_mask), tmp_count);
3582 tmp_count = MULQI (8, SUBQI (8, 6));
3583 tmp_mask = SRLDI (INVSI (0), tmp_count);
3585 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (current_cpu->h_gr_get (FLD (f_right)), tmp_mask), tmp_count));
3586 if (UNLIKELY(current_cpu->trace_result_p))
3587 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3588 current_cpu->h_gr_set (FLD (f_dest), opval);
3592 current_cpu->done_insn (npc, status);
3596 // ********** mextr7: mextr7 $rm, $rn, $rd
3599 sh5_media_sem_mextr7 (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3600 sh5_media::write_stacks &buf)
3602 #define FLD(f) abuf->fields.sfmt_mcmv.f
3603 sem_status status = SEM_STATUS_NORMAL;
3604 sh5_media_scache* abuf = sem;
3605 unsigned long long written = 0;
3606 PCADDR pc = abuf->addr;
3607 PCADDR npc = pc + 4;
3613 tmp_count = MULQI (8, 7);
3614 tmp_mask = SLLDI (INVSI (0), tmp_count);
3615 tmp_rhs = SRLDI (ANDDI (current_cpu->h_gr_get (FLD (f_left)), tmp_mask), tmp_count);
3616 tmp_count = MULQI (8, SUBQI (8, 7));
3617 tmp_mask = SRLDI (INVSI (0), tmp_count);
3619 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (current_cpu->h_gr_get (FLD (f_right)), tmp_mask), tmp_count));
3620 if (UNLIKELY(current_cpu->trace_result_p))
3621 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3622 current_cpu->h_gr_set (FLD (f_dest), opval);
3626 current_cpu->done_insn (npc, status);
3630 // ********** mmacfxwl: mmacfx.wl $rm, $rn, $rd
3633 sh5_media_sem_mmacfxwl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3634 sh5_media::write_stacks &buf)
3636 #define FLD(f) abuf->fields.sfmt_mcmv.f
3637 sem_status status = SEM_STATUS_NORMAL;
3638 sh5_media_scache* abuf = sem;
3639 unsigned long long written = 0;
3640 PCADDR pc = abuf->addr;
3641 PCADDR npc = pc + 4;
3647 tmp_result0 = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_dest)), 1);
3648 tmp_result1 = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_dest)), 0);
3649 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3)));
3650 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)))));
3651 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)))));
3652 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2)));
3653 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)))));
3654 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)))));
3656 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3657 if (UNLIKELY(current_cpu->trace_result_p))
3658 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3659 current_cpu->h_gr_set (FLD (f_dest), opval);
3663 current_cpu->done_insn (npc, status);
3667 // ********** mmacnfx.wl: mmacnfx.wl $rm, $rn, $rd
3670 sh5_media_sem_mmacnfx_wl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3671 sh5_media::write_stacks &buf)
3673 #define FLD(f) abuf->fields.sfmt_mcmv.f
3674 sem_status status = SEM_STATUS_NORMAL;
3675 sh5_media_scache* abuf = sem;
3676 unsigned long long written = 0;
3677 PCADDR pc = abuf->addr;
3678 PCADDR npc = pc + 4;
3684 tmp_result0 = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_dest)), 1);
3685 tmp_result1 = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_dest)), 0);
3686 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3)));
3687 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)))));
3688 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)))));
3689 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2)));
3690 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)))));
3691 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)))));
3693 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3694 if (UNLIKELY(current_cpu->trace_result_p))
3695 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3696 current_cpu->h_gr_set (FLD (f_dest), opval);
3700 current_cpu->done_insn (npc, status);
3704 // ********** mmull: mmul.l $rm, $rn, $rd
3707 sh5_media_sem_mmull (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3708 sh5_media::write_stacks &buf)
3710 #define FLD(f) abuf->fields.sfmt_mcmv.f
3711 sem_status status = SEM_STATUS_NORMAL;
3712 sh5_media_scache* abuf = sem;
3713 unsigned long long written = 0;
3714 PCADDR pc = abuf->addr;
3715 PCADDR npc = pc + 4;
3720 tmp_result0 = MULSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1));
3721 tmp_result1 = MULSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0));
3723 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3724 if (UNLIKELY(current_cpu->trace_result_p))
3725 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3726 current_cpu->h_gr_set (FLD (f_dest), opval);
3730 current_cpu->done_insn (npc, status);
3734 // ********** mmulw: mmul.w $rm, $rn, $rd
3737 sh5_media_sem_mmulw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3738 sh5_media::write_stacks &buf)
3740 #define FLD(f) abuf->fields.sfmt_mcmv.f
3741 sem_status status = SEM_STATUS_NORMAL;
3742 sh5_media_scache* abuf = sem;
3743 unsigned long long written = 0;
3744 PCADDR pc = abuf->addr;
3745 PCADDR npc = pc + 4;
3752 tmp_result0 = MULHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3));
3753 tmp_result1 = MULHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2));
3754 tmp_result2 = MULHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1));
3755 tmp_result3 = MULHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0));
3757 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3758 if (UNLIKELY(current_cpu->trace_result_p))
3759 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3760 current_cpu->h_gr_set (FLD (f_dest), opval);
3764 current_cpu->done_insn (npc, status);
3768 // ********** mmulfxl: mmulfx.l $rm, $rn, $rd
3771 sh5_media_sem_mmulfxl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3772 sh5_media::write_stacks &buf)
3774 #define FLD(f) abuf->fields.sfmt_mcmv.f
3775 sem_status status = SEM_STATUS_NORMAL;
3776 sh5_media_scache* abuf = sem;
3777 unsigned long long written = 0;
3778 PCADDR pc = abuf->addr;
3779 PCADDR npc = pc + 4;
3785 tmp_temp = MULDI (ZEXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1)));
3786 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)))));
3787 tmp_temp = MULDI (ZEXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0)));
3788 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)))));
3790 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3791 if (UNLIKELY(current_cpu->trace_result_p))
3792 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3793 current_cpu->h_gr_set (FLD (f_dest), opval);
3797 current_cpu->done_insn (npc, status);
3801 // ********** mmulfxw: mmulfx.w $rm, $rn, $rd
3804 sh5_media_sem_mmulfxw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3805 sh5_media::write_stacks &buf)
3807 #define FLD(f) abuf->fields.sfmt_mcmv.f
3808 sem_status status = SEM_STATUS_NORMAL;
3809 sh5_media_scache* abuf = sem;
3810 unsigned long long written = 0;
3811 PCADDR pc = abuf->addr;
3812 PCADDR npc = pc + 4;
3820 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3)));
3821 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)))));
3822 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2)));
3823 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)))));
3824 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1)));
3825 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)))));
3826 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0)));
3827 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)))));
3829 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3830 if (UNLIKELY(current_cpu->trace_result_p))
3831 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3832 current_cpu->h_gr_set (FLD (f_dest), opval);
3836 current_cpu->done_insn (npc, status);
3840 // ********** mmulfxrpw: mmulfxrp.w $rm, $rn, $rd
3843 sh5_media_sem_mmulfxrpw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3844 sh5_media::write_stacks &buf)
3846 #define FLD(f) abuf->fields.sfmt_mcmv.f
3847 sem_status status = SEM_STATUS_NORMAL;
3848 sh5_media_scache* abuf = sem;
3849 unsigned long long written = 0;
3850 PCADDR pc = abuf->addr;
3851 PCADDR npc = pc + 4;
3860 tmp_c = SLLSI (1, 14);
3861 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3)));
3862 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)))));
3863 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2)));
3864 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)))));
3865 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1)));
3866 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)))));
3867 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0)));
3868 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)))));
3870 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3871 if (UNLIKELY(current_cpu->trace_result_p))
3872 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3873 current_cpu->h_gr_set (FLD (f_dest), opval);
3877 current_cpu->done_insn (npc, status);
3881 // ********** mmulhiwl: mmulhi.wl $rm, $rn, $rd
3884 sh5_media_sem_mmulhiwl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3885 sh5_media::write_stacks &buf)
3887 #define FLD(f) abuf->fields.sfmt_mcmv.f
3888 sem_status status = SEM_STATUS_NORMAL;
3889 sh5_media_scache* abuf = sem;
3890 unsigned long long written = 0;
3891 PCADDR pc = abuf->addr;
3892 PCADDR npc = pc + 4;
3897 tmp_result0 = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1)));
3898 tmp_result1 = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0)));
3900 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3901 if (UNLIKELY(current_cpu->trace_result_p))
3902 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3903 current_cpu->h_gr_set (FLD (f_dest), opval);
3907 current_cpu->done_insn (npc, status);
3911 // ********** mmullowl: mmullo.wl $rm, $rn, $rd
3914 sh5_media_sem_mmullowl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3915 sh5_media::write_stacks &buf)
3917 #define FLD(f) abuf->fields.sfmt_mcmv.f
3918 sem_status status = SEM_STATUS_NORMAL;
3919 sh5_media_scache* abuf = sem;
3920 unsigned long long written = 0;
3921 PCADDR pc = abuf->addr;
3922 PCADDR npc = pc + 4;
3927 tmp_result0 = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3)));
3928 tmp_result1 = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2)));
3930 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3931 if (UNLIKELY(current_cpu->trace_result_p))
3932 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3933 current_cpu->h_gr_set (FLD (f_dest), opval);
3937 current_cpu->done_insn (npc, status);
3941 // ********** mmulsumwq: mmulsum.wq $rm, $rn, $rd
3944 sh5_media_sem_mmulsumwq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3945 sh5_media::write_stacks &buf)
3947 #define FLD(f) abuf->fields.sfmt_mcmv.f
3948 sem_status status = SEM_STATUS_NORMAL;
3949 sh5_media_scache* abuf = sem;
3950 unsigned long long written = 0;
3951 PCADDR pc = abuf->addr;
3952 PCADDR npc = pc + 4;
3956 tmp_acc = MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0)));
3957 tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1))));
3958 tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2))));
3959 tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3))));
3961 DI opval = ADDDI (current_cpu->h_gr_get (FLD (f_dest)), tmp_acc);
3962 if (UNLIKELY(current_cpu->trace_result_p))
3963 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3964 current_cpu->h_gr_set (FLD (f_dest), opval);
3968 current_cpu->done_insn (npc, status);
3972 // ********** movi: movi $imm16, $rd
3975 sh5_media_sem_movi (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
3976 sh5_media::write_stacks &buf)
3978 #define FLD(f) abuf->fields.sfmt_movi.f
3979 sem_status status = SEM_STATUS_NORMAL;
3980 sh5_media_scache* abuf = sem;
3981 unsigned long long written = 0;
3982 PCADDR pc = abuf->addr;
3983 PCADDR npc = pc + 4;
3986 DI opval = EXTSIDI (FLD (f_imm16));
3987 if (UNLIKELY(current_cpu->trace_result_p))
3988 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
3989 current_cpu->h_gr_set (FLD (f_dest), opval);
3992 current_cpu->done_insn (npc, status);
3996 // ********** mpermw: mperm.w $rm, $rn, $rd
3999 sh5_media_sem_mpermw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4000 sh5_media::write_stacks &buf)
4002 #define FLD(f) abuf->fields.sfmt_mcmv.f
4003 sem_status status = SEM_STATUS_NORMAL;
4004 sh5_media_scache* abuf = sem;
4005 unsigned long long written = 0;
4006 PCADDR pc = abuf->addr;
4007 PCADDR npc = pc + 4;
4015 tmp_control = ANDQI (current_cpu->h_gr_get (FLD (f_right)), 255);
4016 tmp_result0 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), SUBSI (3, ANDQI (tmp_control, 3)));
4017 tmp_result1 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 2), 3)));
4018 tmp_result2 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 4), 3)));
4019 tmp_result3 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 6), 3)));
4021 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4022 if (UNLIKELY(current_cpu->trace_result_p))
4023 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4024 current_cpu->h_gr_set (FLD (f_dest), opval);
4028 current_cpu->done_insn (npc, status);
4032 // ********** msadubq: msad.ubq $rm, $rn, $rd
4035 sh5_media_sem_msadubq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4036 sh5_media::write_stacks &buf)
4038 #define FLD(f) abuf->fields.sfmt_mcmv.f
4039 sem_status status = SEM_STATUS_NORMAL;
4040 sh5_media_scache* abuf = sem;
4041 unsigned long long written = 0;
4042 PCADDR pc = abuf->addr;
4043 PCADDR npc = pc + 4;
4047 tmp_acc = ABSDI (SUBQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0)));
4048 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))));
4049 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))));
4050 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))));
4051 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))));
4052 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))));
4053 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))));
4054 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7), SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))));
4056 DI opval = ADDDI (current_cpu->h_gr_get (FLD (f_dest)), tmp_acc);
4057 if (UNLIKELY(current_cpu->trace_result_p))
4058 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4059 current_cpu->h_gr_set (FLD (f_dest), opval);
4063 current_cpu->done_insn (npc, status);
4067 // ********** mshaldsl: mshalds.l $rm, $rn, $rd
4070 sh5_media_sem_mshaldsl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4071 sh5_media::write_stacks &buf)
4073 #define FLD(f) abuf->fields.sfmt_mcmv.f
4074 sem_status status = SEM_STATUS_NORMAL;
4075 sh5_media_scache* abuf = sem;
4076 unsigned long long written = 0;
4077 PCADDR pc = abuf->addr;
4078 PCADDR npc = pc + 4;
4083 tmp_result0 = ((LTDI (SLLDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31)), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
4084 tmp_result1 = ((LTDI (SLLDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31)), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
4086 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4087 if (UNLIKELY(current_cpu->trace_result_p))
4088 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4089 current_cpu->h_gr_set (FLD (f_dest), opval);
4093 current_cpu->done_insn (npc, status);
4097 // ********** mshaldsw: mshalds.w $rm, $rn, $rd
4100 sh5_media_sem_mshaldsw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4101 sh5_media::write_stacks &buf)
4103 #define FLD(f) abuf->fields.sfmt_mcmv.f
4104 sem_status status = SEM_STATUS_NORMAL;
4105 sh5_media_scache* abuf = sem;
4106 unsigned long long written = 0;
4107 PCADDR pc = abuf->addr;
4108 PCADDR npc = pc + 4;
4115 tmp_result0 = ((LTDI (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4116 tmp_result1 = ((LTDI (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4117 tmp_result2 = ((LTDI (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4118 tmp_result3 = ((LTDI (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4120 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4121 if (UNLIKELY(current_cpu->trace_result_p))
4122 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4123 current_cpu->h_gr_set (FLD (f_dest), opval);
4127 current_cpu->done_insn (npc, status);
4131 // ********** mshardl: mshard.l $rm, $rn, $rd
4134 sh5_media_sem_mshardl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4135 sh5_media::write_stacks &buf)
4137 #define FLD(f) abuf->fields.sfmt_mcmv.f
4138 sem_status status = SEM_STATUS_NORMAL;
4139 sh5_media_scache* abuf = sem;
4140 unsigned long long written = 0;
4141 PCADDR pc = abuf->addr;
4142 PCADDR npc = pc + 4;
4147 tmp_result0 = SRASI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31));
4148 tmp_result1 = SRASI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31));
4150 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4151 if (UNLIKELY(current_cpu->trace_result_p))
4152 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4153 current_cpu->h_gr_set (FLD (f_dest), opval);
4157 current_cpu->done_insn (npc, status);
4161 // ********** mshardw: mshard.w $rm, $rn, $rd
4164 sh5_media_sem_mshardw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4165 sh5_media::write_stacks &buf)
4167 #define FLD(f) abuf->fields.sfmt_mcmv.f
4168 sem_status status = SEM_STATUS_NORMAL;
4169 sh5_media_scache* abuf = sem;
4170 unsigned long long written = 0;
4171 PCADDR pc = abuf->addr;
4172 PCADDR npc = pc + 4;
4179 tmp_result0 = SRAHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4180 tmp_result1 = SRAHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4181 tmp_result2 = SRAHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4182 tmp_result3 = SRAHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4184 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4185 if (UNLIKELY(current_cpu->trace_result_p))
4186 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4187 current_cpu->h_gr_set (FLD (f_dest), opval);
4191 current_cpu->done_insn (npc, status);
4195 // ********** mshardsq: mshards.q $rm, $rn, $rd
4198 sh5_media_sem_mshardsq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4199 sh5_media::write_stacks &buf)
4201 #define FLD(f) abuf->fields.sfmt_mcmv.f
4202 sem_status status = SEM_STATUS_NORMAL;
4203 sh5_media_scache* abuf = sem;
4204 unsigned long long written = 0;
4205 PCADDR pc = abuf->addr;
4206 PCADDR npc = pc + 4;
4209 DI opval = ((LTDI (SRADI (current_cpu->h_gr_get (FLD (f_left)), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGDI (SLLDI (1, SUBSI (16, 1)))) : (((LTDI (SRADI (current_cpu->h_gr_get (FLD (f_left)), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63)), SLLDI (1, SUBSI (16, 1)))) ? (SRADI (current_cpu->h_gr_get (FLD (f_left)), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63))) : (SUBDI (SLLDI (1, SUBSI (16, 1)), 1)))));
4210 if (UNLIKELY(current_cpu->trace_result_p))
4211 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4212 current_cpu->h_gr_set (FLD (f_dest), opval);
4215 current_cpu->done_insn (npc, status);
4219 // ********** mshfhib: mshfhi.b $rm, $rn, $rd
4222 sh5_media_sem_mshfhib (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4223 sh5_media::write_stacks &buf)
4225 #define FLD(f) abuf->fields.sfmt_mcmv.f
4226 sem_status status = SEM_STATUS_NORMAL;
4227 sh5_media_scache* abuf = sem;
4228 unsigned long long written = 0;
4229 PCADDR pc = abuf->addr;
4230 PCADDR npc = pc + 4;
4241 tmp_result0 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3);
4242 tmp_result1 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3);
4243 tmp_result2 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2);
4244 tmp_result3 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2);
4245 tmp_result4 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1);
4246 tmp_result5 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1);
4247 tmp_result6 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0);
4248 tmp_result7 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0);
4250 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))))))));
4251 if (UNLIKELY(current_cpu->trace_result_p))
4252 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4253 current_cpu->h_gr_set (FLD (f_dest), opval);
4257 current_cpu->done_insn (npc, status);
4261 // ********** mshfhil: mshfhi.l $rm, $rn, $rd
4264 sh5_media_sem_mshfhil (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4265 sh5_media::write_stacks &buf)
4267 #define FLD(f) abuf->fields.sfmt_mcmv.f
4268 sem_status status = SEM_STATUS_NORMAL;
4269 sh5_media_scache* abuf = sem;
4270 unsigned long long written = 0;
4271 PCADDR pc = abuf->addr;
4272 PCADDR npc = pc + 4;
4277 tmp_result0 = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0);
4278 tmp_result1 = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0);
4280 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4281 if (UNLIKELY(current_cpu->trace_result_p))
4282 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4283 current_cpu->h_gr_set (FLD (f_dest), opval);
4287 current_cpu->done_insn (npc, status);
4291 // ********** mshfhiw: mshfhi.w $rm, $rn, $rd
4294 sh5_media_sem_mshfhiw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4295 sh5_media::write_stacks &buf)
4297 #define FLD(f) abuf->fields.sfmt_mcmv.f
4298 sem_status status = SEM_STATUS_NORMAL;
4299 sh5_media_scache* abuf = sem;
4300 unsigned long long written = 0;
4301 PCADDR pc = abuf->addr;
4302 PCADDR npc = pc + 4;
4309 tmp_result0 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1);
4310 tmp_result1 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1);
4311 tmp_result2 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0);
4312 tmp_result3 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0);
4314 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4315 if (UNLIKELY(current_cpu->trace_result_p))
4316 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4317 current_cpu->h_gr_set (FLD (f_dest), opval);
4321 current_cpu->done_insn (npc, status);
4325 // ********** mshflob: mshflo.b $rm, $rn, $rd
4328 sh5_media_sem_mshflob (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4329 sh5_media::write_stacks &buf)
4331 #define FLD(f) abuf->fields.sfmt_mcmv.f
4332 sem_status status = SEM_STATUS_NORMAL;
4333 sh5_media_scache* abuf = sem;
4334 unsigned long long written = 0;
4335 PCADDR pc = abuf->addr;
4336 PCADDR npc = pc + 4;
4347 tmp_result0 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7);
4348 tmp_result1 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7);
4349 tmp_result2 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6);
4350 tmp_result3 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6);
4351 tmp_result4 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5);
4352 tmp_result5 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5);
4353 tmp_result6 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4);
4354 tmp_result7 = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4);
4356 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))))))));
4357 if (UNLIKELY(current_cpu->trace_result_p))
4358 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4359 current_cpu->h_gr_set (FLD (f_dest), opval);
4363 current_cpu->done_insn (npc, status);
4367 // ********** mshflol: mshflo.l $rm, $rn, $rd
4370 sh5_media_sem_mshflol (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4371 sh5_media::write_stacks &buf)
4373 #define FLD(f) abuf->fields.sfmt_mcmv.f
4374 sem_status status = SEM_STATUS_NORMAL;
4375 sh5_media_scache* abuf = sem;
4376 unsigned long long written = 0;
4377 PCADDR pc = abuf->addr;
4378 PCADDR npc = pc + 4;
4383 tmp_result0 = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1);
4384 tmp_result1 = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1);
4386 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4387 if (UNLIKELY(current_cpu->trace_result_p))
4388 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4389 current_cpu->h_gr_set (FLD (f_dest), opval);
4393 current_cpu->done_insn (npc, status);
4397 // ********** mshflow: mshflo.w $rm, $rn, $rd
4400 sh5_media_sem_mshflow (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4401 sh5_media::write_stacks &buf)
4403 #define FLD(f) abuf->fields.sfmt_mcmv.f
4404 sem_status status = SEM_STATUS_NORMAL;
4405 sh5_media_scache* abuf = sem;
4406 unsigned long long written = 0;
4407 PCADDR pc = abuf->addr;
4408 PCADDR npc = pc + 4;
4415 tmp_result0 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3);
4416 tmp_result1 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3);
4417 tmp_result2 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2);
4418 tmp_result3 = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2);
4420 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4421 if (UNLIKELY(current_cpu->trace_result_p))
4422 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4423 current_cpu->h_gr_set (FLD (f_dest), opval);
4427 current_cpu->done_insn (npc, status);
4431 // ********** mshlldl: mshlld.l $rm, $rn, $rd
4434 sh5_media_sem_mshlldl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4435 sh5_media::write_stacks &buf)
4437 #define FLD(f) abuf->fields.sfmt_mcmv.f
4438 sem_status status = SEM_STATUS_NORMAL;
4439 sh5_media_scache* abuf = sem;
4440 unsigned long long written = 0;
4441 PCADDR pc = abuf->addr;
4442 PCADDR npc = pc + 4;
4447 tmp_result0 = SLLSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31));
4448 tmp_result1 = SLLSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31));
4450 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4451 if (UNLIKELY(current_cpu->trace_result_p))
4452 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4453 current_cpu->h_gr_set (FLD (f_dest), opval);
4457 current_cpu->done_insn (npc, status);
4461 // ********** mshlldw: mshlld.w $rm, $rn, $rd
4464 sh5_media_sem_mshlldw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4465 sh5_media::write_stacks &buf)
4467 #define FLD(f) abuf->fields.sfmt_mcmv.f
4468 sem_status status = SEM_STATUS_NORMAL;
4469 sh5_media_scache* abuf = sem;
4470 unsigned long long written = 0;
4471 PCADDR pc = abuf->addr;
4472 PCADDR npc = pc + 4;
4479 tmp_result0 = SLLHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4480 tmp_result1 = SLLHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4481 tmp_result2 = SLLHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4482 tmp_result3 = SLLHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4484 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4485 if (UNLIKELY(current_cpu->trace_result_p))
4486 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4487 current_cpu->h_gr_set (FLD (f_dest), opval);
4491 current_cpu->done_insn (npc, status);
4495 // ********** mshlrdl: mshlrd.l $rm, $rn, $rd
4498 sh5_media_sem_mshlrdl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4499 sh5_media::write_stacks &buf)
4501 #define FLD(f) abuf->fields.sfmt_mcmv.f
4502 sem_status status = SEM_STATUS_NORMAL;
4503 sh5_media_scache* abuf = sem;
4504 unsigned long long written = 0;
4505 PCADDR pc = abuf->addr;
4506 PCADDR npc = pc + 4;
4511 tmp_result0 = SRLSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31));
4512 tmp_result1 = SRLSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 31));
4514 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4515 if (UNLIKELY(current_cpu->trace_result_p))
4516 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4517 current_cpu->h_gr_set (FLD (f_dest), opval);
4521 current_cpu->done_insn (npc, status);
4525 // ********** mshlrdw: mshlrd.w $rm, $rn, $rd
4528 sh5_media_sem_mshlrdw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4529 sh5_media::write_stacks &buf)
4531 #define FLD(f) abuf->fields.sfmt_mcmv.f
4532 sem_status status = SEM_STATUS_NORMAL;
4533 sh5_media_scache* abuf = sem;
4534 unsigned long long written = 0;
4535 PCADDR pc = abuf->addr;
4536 PCADDR npc = pc + 4;
4543 tmp_result0 = SRLHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4544 tmp_result1 = SRLHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4545 tmp_result2 = SRLHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4546 tmp_result3 = SRLHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 15));
4548 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4549 if (UNLIKELY(current_cpu->trace_result_p))
4550 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4551 current_cpu->h_gr_set (FLD (f_dest), opval);
4555 current_cpu->done_insn (npc, status);
4559 // ********** msubl: msub.l $rm, $rn, $rd
4562 sh5_media_sem_msubl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4563 sh5_media::write_stacks &buf)
4565 #define FLD(f) abuf->fields.sfmt_mcmv.f
4566 sem_status status = SEM_STATUS_NORMAL;
4567 sh5_media_scache* abuf = sem;
4568 unsigned long long written = 0;
4569 PCADDR pc = abuf->addr;
4570 PCADDR npc = pc + 4;
4575 tmp_result0 = SUBSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1));
4576 tmp_result1 = SUBSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0));
4578 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4579 if (UNLIKELY(current_cpu->trace_result_p))
4580 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4581 current_cpu->h_gr_set (FLD (f_dest), opval);
4585 current_cpu->done_insn (npc, status);
4589 // ********** msubw: msub.w $rm, $rn, $rd
4592 sh5_media_sem_msubw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4593 sh5_media::write_stacks &buf)
4595 #define FLD(f) abuf->fields.sfmt_mcmv.f
4596 sem_status status = SEM_STATUS_NORMAL;
4597 sh5_media_scache* abuf = sem;
4598 unsigned long long written = 0;
4599 PCADDR pc = abuf->addr;
4600 PCADDR npc = pc + 4;
4607 tmp_result0 = SUBHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 3), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 3));
4608 tmp_result1 = SUBHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 2), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 2));
4609 tmp_result2 = SUBHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 1));
4610 tmp_result3 = SUBHI (SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_left)), 0), SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_right)), 0));
4612 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4613 if (UNLIKELY(current_cpu->trace_result_p))
4614 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4615 current_cpu->h_gr_set (FLD (f_dest), opval);
4619 current_cpu->done_insn (npc, status);
4623 // ********** msubsl: msubs.l $rm, $rn, $rd
4626 sh5_media_sem_msubsl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4627 sh5_media::write_stacks &buf)
4629 #define FLD(f) abuf->fields.sfmt_mcmv.f
4630 sem_status status = SEM_STATUS_NORMAL;
4631 sh5_media_scache* abuf = sem;
4632 unsigned long long written = 0;
4633 PCADDR pc = abuf->addr;
4634 PCADDR npc = pc + 4;
4639 tmp_result0 = ((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1))), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
4640 tmp_result1 = ((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0))), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 0)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
4642 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4643 if (UNLIKELY(current_cpu->trace_result_p))
4644 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4645 current_cpu->h_gr_set (FLD (f_dest), opval);
4649 current_cpu->done_insn (npc, status);
4653 // ********** msubsub: msubs.ub $rm, $rn, $rd
4656 sh5_media_sem_msubsub (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4657 sh5_media::write_stacks &buf)
4659 #define FLD(f) abuf->fields.sfmt_mcmv.f
4660 sem_status status = SEM_STATUS_NORMAL;
4661 sh5_media_scache* abuf = sem;
4662 unsigned long long written = 0;
4663 PCADDR pc = abuf->addr;
4664 PCADDR npc = pc + 4;
4675 tmp_result0 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7)))) : (SUBQI (SLLQI (1, 8), 1)))));
4676 tmp_result1 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6)))) : (SUBQI (SLLQI (1, 8), 1)))));
4677 tmp_result2 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5)))) : (SUBQI (SLLQI (1, 8), 1)))));
4678 tmp_result3 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4)))) : (SUBQI (SLLQI (1, 8), 1)))));
4679 tmp_result4 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3)))) : (SUBQI (SLLQI (1, 8), 1)))));
4680 tmp_result5 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2)))) : (SUBQI (SLLQI (1, 8), 1)))));
4681 tmp_result6 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1)))) : (SUBQI (SLLQI (1, 8), 1)))));
4682 tmp_result7 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0)))) : (SUBQI (SLLQI (1, 8), 1)))));
4684 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))))))));
4685 if (UNLIKELY(current_cpu->trace_result_p))
4686 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4687 current_cpu->h_gr_set (FLD (f_dest), opval);
4691 current_cpu->done_insn (npc, status);
4695 // ********** msubsw: msubs.w $rm, $rn, $rd
4698 sh5_media_sem_msubsw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4699 sh5_media::write_stacks &buf)
4701 #define FLD(f) abuf->fields.sfmt_mcmv.f
4702 sem_status status = SEM_STATUS_NORMAL;
4703 sh5_media_scache* abuf = sem;
4704 unsigned long long written = 0;
4705 PCADDR pc = abuf->addr;
4706 PCADDR npc = pc + 4;
4717 tmp_result0 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 7)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4718 tmp_result1 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 6)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4719 tmp_result2 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 5)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4720 tmp_result3 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 4)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4721 tmp_result4 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 3)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4722 tmp_result5 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 2)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4723 tmp_result6 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 1)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4724 tmp_result7 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_right)), 0)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4726 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))))))));
4727 if (UNLIKELY(current_cpu->trace_result_p))
4728 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4729 current_cpu->h_gr_set (FLD (f_dest), opval);
4733 current_cpu->done_insn (npc, status);
4737 // ********** mulsl: muls.l $rm, $rn, $rd
4740 sh5_media_sem_mulsl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4741 sh5_media::write_stacks &buf)
4743 #define FLD(f) abuf->fields.sfmt_mcmv.f
4744 sem_status status = SEM_STATUS_NORMAL;
4745 sh5_media_scache* abuf = sem;
4746 unsigned long long written = 0;
4747 PCADDR pc = abuf->addr;
4748 PCADDR npc = pc + 4;
4751 DI opval = MULDI (EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1)));
4752 if (UNLIKELY(current_cpu->trace_result_p))
4753 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4754 current_cpu->h_gr_set (FLD (f_dest), opval);
4757 current_cpu->done_insn (npc, status);
4761 // ********** mulul: mulu.l $rm, $rn, $rd
4764 sh5_media_sem_mulul (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4765 sh5_media::write_stacks &buf)
4767 #define FLD(f) abuf->fields.sfmt_mcmv.f
4768 sem_status status = SEM_STATUS_NORMAL;
4769 sh5_media_scache* abuf = sem;
4770 unsigned long long written = 0;
4771 PCADDR pc = abuf->addr;
4772 PCADDR npc = pc + 4;
4775 DI opval = MULDI (ZEXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1)), ZEXTSIDI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1)));
4776 if (UNLIKELY(current_cpu->trace_result_p))
4777 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4778 current_cpu->h_gr_set (FLD (f_dest), opval);
4781 current_cpu->done_insn (npc, status);
4785 // ********** nop: nop
4788 sh5_media_sem_nop (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4789 sh5_media::write_stacks &buf)
4791 #define FLD(f) abuf->fields.fmt_empty.f
4792 sem_status status = SEM_STATUS_NORMAL;
4793 sh5_media_scache* abuf = sem;
4794 unsigned long long written = 0;
4795 PCADDR pc = abuf->addr;
4796 PCADDR npc = pc + 4;
4800 current_cpu->done_insn (npc, status);
4804 // ********** nsb: nsb $rm, $rd
4807 sh5_media_sem_nsb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4808 sh5_media::write_stacks &buf)
4810 #define FLD(f) abuf->fields.sfmt_xori.f
4811 sem_status status = SEM_STATUS_NORMAL;
4812 sh5_media_scache* abuf = sem;
4813 unsigned long long written = 0;
4814 PCADDR pc = abuf->addr;
4815 PCADDR npc = pc + 4;
4818 DI opval = current_cpu->sh64_nsb (current_cpu->h_gr_get (FLD (f_left)));
4819 if (UNLIKELY(current_cpu->trace_result_p))
4820 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4821 current_cpu->h_gr_set (FLD (f_dest), opval);
4824 current_cpu->done_insn (npc, status);
4828 // ********** ocbi: ocbi $rm, $disp6x32
4831 sh5_media_sem_ocbi (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4832 sh5_media::write_stacks &buf)
4834 #define FLD(f) abuf->fields.sfmt_alloco.f
4835 sem_status status = SEM_STATUS_NORMAL;
4836 sh5_media_scache* abuf = sem;
4837 unsigned long long written = 0;
4838 PCADDR pc = abuf->addr;
4839 PCADDR npc = pc + 4;
4843 DI opval = current_cpu->h_gr_get (FLD (f_left));
4844 if (UNLIKELY(current_cpu->trace_result_p))
4845 current_cpu->trace_stream << "gr" << '[' << FLD (f_left) << ']' << ":=0x" << hex << opval << dec << " ";
4846 current_cpu->h_gr_set (FLD (f_left), opval);
4851 current_cpu->done_insn (npc, status);
4855 // ********** ocbp: ocbp $rm, $disp6x32
4858 sh5_media_sem_ocbp (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4859 sh5_media::write_stacks &buf)
4861 #define FLD(f) abuf->fields.sfmt_alloco.f
4862 sem_status status = SEM_STATUS_NORMAL;
4863 sh5_media_scache* abuf = sem;
4864 unsigned long long written = 0;
4865 PCADDR pc = abuf->addr;
4866 PCADDR npc = pc + 4;
4870 DI opval = current_cpu->h_gr_get (FLD (f_left));
4871 if (UNLIKELY(current_cpu->trace_result_p))
4872 current_cpu->trace_stream << "gr" << '[' << FLD (f_left) << ']' << ":=0x" << hex << opval << dec << " ";
4873 current_cpu->h_gr_set (FLD (f_left), opval);
4878 current_cpu->done_insn (npc, status);
4882 // ********** ocbwb: ocbwb $rm, $disp6x32
4885 sh5_media_sem_ocbwb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4886 sh5_media::write_stacks &buf)
4888 #define FLD(f) abuf->fields.sfmt_alloco.f
4889 sem_status status = SEM_STATUS_NORMAL;
4890 sh5_media_scache* abuf = sem;
4891 unsigned long long written = 0;
4892 PCADDR pc = abuf->addr;
4893 PCADDR npc = pc + 4;
4897 DI opval = current_cpu->h_gr_get (FLD (f_left));
4898 if (UNLIKELY(current_cpu->trace_result_p))
4899 current_cpu->trace_stream << "gr" << '[' << FLD (f_left) << ']' << ":=0x" << hex << opval << dec << " ";
4900 current_cpu->h_gr_set (FLD (f_left), opval);
4905 current_cpu->done_insn (npc, status);
4909 // ********** or: or $rm, $rn, $rd
4912 sh5_media_sem_or (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4913 sh5_media::write_stacks &buf)
4915 #define FLD(f) abuf->fields.sfmt_mcmv.f
4916 sem_status status = SEM_STATUS_NORMAL;
4917 sh5_media_scache* abuf = sem;
4918 unsigned long long written = 0;
4919 PCADDR pc = abuf->addr;
4920 PCADDR npc = pc + 4;
4923 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)));
4924 if (UNLIKELY(current_cpu->trace_result_p))
4925 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4926 current_cpu->h_gr_set (FLD (f_dest), opval);
4929 current_cpu->done_insn (npc, status);
4933 // ********** ori: ori $rm, $imm10, $rd
4936 sh5_media_sem_ori (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4937 sh5_media::write_stacks &buf)
4939 #define FLD(f) abuf->fields.sfmt_ori.f
4940 sem_status status = SEM_STATUS_NORMAL;
4941 sh5_media_scache* abuf = sem;
4942 unsigned long long written = 0;
4943 PCADDR pc = abuf->addr;
4944 PCADDR npc = pc + 4;
4947 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_imm10)));
4948 if (UNLIKELY(current_cpu->trace_result_p))
4949 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
4950 current_cpu->h_gr_set (FLD (f_dest), opval);
4953 current_cpu->done_insn (npc, status);
4957 // ********** prefi: prefi $rm, $disp6x32
4960 sh5_media_sem_prefi (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4961 sh5_media::write_stacks &buf)
4963 #define FLD(f) abuf->fields.sfmt_alloco.f
4964 sem_status status = SEM_STATUS_NORMAL;
4965 sh5_media_scache* abuf = sem;
4966 unsigned long long written = 0;
4967 PCADDR pc = abuf->addr;
4968 PCADDR npc = pc + 4;
4972 DI opval = current_cpu->h_gr_get (FLD (f_left));
4973 if (UNLIKELY(current_cpu->trace_result_p))
4974 current_cpu->trace_stream << "gr" << '[' << FLD (f_left) << ']' << ":=0x" << hex << opval << dec << " ";
4975 current_cpu->h_gr_set (FLD (f_left), opval);
4980 current_cpu->done_insn (npc, status);
4984 // ********** pta: pta$likely $disp16, $tra
4987 sh5_media_sem_pta (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
4988 sh5_media::write_stacks &buf)
4990 #define FLD(f) abuf->fields.sfmt_pta.f
4991 sem_status status = SEM_STATUS_NORMAL;
4992 sh5_media_scache* abuf = sem;
4993 unsigned long long written = 0;
4994 PCADDR pc = abuf->addr;
4995 PCADDR npc = pc + 4;
4998 current_cpu->save_branch_prediction (FLD (f_tra), FLD (f_likely));
5000 DI opval = ADDSI (FLD (f_disp16), 1);
5001 if (UNLIKELY(current_cpu->trace_result_p))
5002 current_cpu->trace_stream << "tr" << '[' << FLD (f_tra) << ']' << ":=0x" << hex << opval << dec << " ";
5003 current_cpu->hardware.h_tr[FLD (f_tra)] = opval;
5007 current_cpu->done_insn (npc, status);
5011 // ********** ptabs: ptabs$likely $rn, $tra
5014 sh5_media_sem_ptabs (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5015 sh5_media::write_stacks &buf)
5017 #define FLD(f) abuf->fields.sfmt_ptabs.f
5018 sem_status status = SEM_STATUS_NORMAL;
5019 sh5_media_scache* abuf = sem;
5020 unsigned long long written = 0;
5021 PCADDR pc = abuf->addr;
5022 PCADDR npc = pc + 4;
5025 current_cpu->save_branch_prediction (FLD (f_tra), FLD (f_likely));
5027 DI opval = current_cpu->h_gr_get (FLD (f_right));
5028 if (UNLIKELY(current_cpu->trace_result_p))
5029 current_cpu->trace_stream << "tr" << '[' << FLD (f_tra) << ']' << ":=0x" << hex << opval << dec << " ";
5030 current_cpu->hardware.h_tr[FLD (f_tra)] = opval;
5034 current_cpu->done_insn (npc, status);
5038 // ********** ptb: ptb$likely $disp16, $tra
5041 sh5_media_sem_ptb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5042 sh5_media::write_stacks &buf)
5044 #define FLD(f) abuf->fields.sfmt_pta.f
5045 sem_status status = SEM_STATUS_NORMAL;
5046 sh5_media_scache* abuf = sem;
5047 unsigned long long written = 0;
5048 PCADDR pc = abuf->addr;
5049 PCADDR npc = pc + 4;
5052 current_cpu->save_branch_prediction (FLD (f_tra), FLD (f_likely));
5054 DI opval = FLD (f_disp16);
5055 if (UNLIKELY(current_cpu->trace_result_p))
5056 current_cpu->trace_stream << "tr" << '[' << FLD (f_tra) << ']' << ":=0x" << hex << opval << dec << " ";
5057 current_cpu->hardware.h_tr[FLD (f_tra)] = opval;
5061 current_cpu->done_insn (npc, status);
5065 // ********** ptrel: ptrel$likely $rn, $tra
5068 sh5_media_sem_ptrel (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5069 sh5_media::write_stacks &buf)
5071 #define FLD(f) abuf->fields.sfmt_ptabs.f
5072 sem_status status = SEM_STATUS_NORMAL;
5073 sh5_media_scache* abuf = sem;
5074 unsigned long long written = 0;
5075 PCADDR pc = abuf->addr;
5076 PCADDR npc = pc + 4;
5079 current_cpu->save_branch_prediction (FLD (f_tra), FLD (f_likely));
5081 DI opval = ADDDI (pc, current_cpu->h_gr_get (FLD (f_right)));
5082 if (UNLIKELY(current_cpu->trace_result_p))
5083 current_cpu->trace_stream << "tr" << '[' << FLD (f_tra) << ']' << ":=0x" << hex << opval << dec << " ";
5084 current_cpu->hardware.h_tr[FLD (f_tra)] = opval;
5088 current_cpu->done_insn (npc, status);
5092 // ********** putcfg: putcfg $rm, $disp6, $rd
5095 sh5_media_sem_putcfg (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5096 sh5_media::write_stacks &buf)
5098 #define FLD(f) abuf->fields.sfmt_putcfg.f
5099 sem_status status = SEM_STATUS_NORMAL;
5100 sh5_media_scache* abuf = sem;
5101 unsigned long long written = 0;
5102 PCADDR pc = abuf->addr;
5103 PCADDR npc = pc + 4;
5107 tmp_address = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
5108 current_cpu->sh64_save_cfg_address (tmp_address);
5110 SI opval = current_cpu->h_gr_get (FLD (f_dest));
5111 if (UNLIKELY(current_cpu->trace_result_p))
5112 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_address << dec << ']' << ":=0x" << hex << opval << dec << " ";
5113 current_cpu->SETMEMSI (pc, tmp_address, opval);
5117 current_cpu->done_insn (npc, status);
5121 // ********** putcon: putcon $rm, $crj
5124 sh5_media_sem_putcon (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5125 sh5_media::write_stacks &buf)
5127 #define FLD(f) abuf->fields.sfmt_xori.f
5128 sem_status status = SEM_STATUS_NORMAL;
5129 sh5_media_scache* abuf = sem;
5130 unsigned long long written = 0;
5131 PCADDR pc = abuf->addr;
5132 PCADDR npc = pc + 4;
5135 DI opval = current_cpu->h_gr_get (FLD (f_left));
5136 if (UNLIKELY(current_cpu->trace_result_p))
5137 current_cpu->trace_stream << "cr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5138 current_cpu->h_cr_set (FLD (f_dest), opval);
5141 current_cpu->done_insn (npc, status);
5145 // ********** rte: rte
5148 sh5_media_sem_rte (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5149 sh5_media::write_stacks &buf)
5151 #define FLD(f) abuf->fields.fmt_empty.f
5152 sem_status status = SEM_STATUS_NORMAL;
5153 sh5_media_scache* abuf = sem;
5154 unsigned long long written = 0;
5155 PCADDR pc = abuf->addr;
5156 PCADDR npc = pc + 4;
5160 current_cpu->done_insn (npc, status);
5164 // ********** shard: shard $rm, $rn, $rd
5167 sh5_media_sem_shard (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5168 sh5_media::write_stacks &buf)
5170 #define FLD(f) abuf->fields.sfmt_mcmv.f
5171 sem_status status = SEM_STATUS_NORMAL;
5172 sh5_media_scache* abuf = sem;
5173 unsigned long long written = 0;
5174 PCADDR pc = abuf->addr;
5175 PCADDR npc = pc + 4;
5178 DI opval = SRADI (current_cpu->h_gr_get (FLD (f_left)), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63));
5179 if (UNLIKELY(current_cpu->trace_result_p))
5180 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5181 current_cpu->h_gr_set (FLD (f_dest), opval);
5184 current_cpu->done_insn (npc, status);
5188 // ********** shardl: shard.l $rm, $rn, $rd
5191 sh5_media_sem_shardl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5192 sh5_media::write_stacks &buf)
5194 #define FLD(f) abuf->fields.sfmt_mcmv.f
5195 sem_status status = SEM_STATUS_NORMAL;
5196 sh5_media_scache* abuf = sem;
5197 unsigned long long written = 0;
5198 PCADDR pc = abuf->addr;
5199 PCADDR npc = pc + 4;
5202 DI opval = EXTSIDI (SRASI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63)));
5203 if (UNLIKELY(current_cpu->trace_result_p))
5204 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5205 current_cpu->h_gr_set (FLD (f_dest), opval);
5208 current_cpu->done_insn (npc, status);
5212 // ********** shari: shari $rm, $uimm6, $rd
5215 sh5_media_sem_shari (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5216 sh5_media::write_stacks &buf)
5218 #define FLD(f) abuf->fields.sfmt_shari.f
5219 sem_status status = SEM_STATUS_NORMAL;
5220 sh5_media_scache* abuf = sem;
5221 unsigned long long written = 0;
5222 PCADDR pc = abuf->addr;
5223 PCADDR npc = pc + 4;
5226 DI opval = SRADI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_uimm6));
5227 if (UNLIKELY(current_cpu->trace_result_p))
5228 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5229 current_cpu->h_gr_set (FLD (f_dest), opval);
5232 current_cpu->done_insn (npc, status);
5236 // ********** sharil: shari.l $rm, $uimm6, $rd
5239 sh5_media_sem_sharil (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5240 sh5_media::write_stacks &buf)
5242 #define FLD(f) abuf->fields.sfmt_shari.f
5243 sem_status status = SEM_STATUS_NORMAL;
5244 sh5_media_scache* abuf = sem;
5245 unsigned long long written = 0;
5246 PCADDR pc = abuf->addr;
5247 PCADDR npc = pc + 4;
5250 DI opval = EXTSIDI (SRASI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
5251 if (UNLIKELY(current_cpu->trace_result_p))
5252 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5253 current_cpu->h_gr_set (FLD (f_dest), opval);
5256 current_cpu->done_insn (npc, status);
5260 // ********** shlld: shlld $rm, $rn, $rd
5263 sh5_media_sem_shlld (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5264 sh5_media::write_stacks &buf)
5266 #define FLD(f) abuf->fields.sfmt_mcmv.f
5267 sem_status status = SEM_STATUS_NORMAL;
5268 sh5_media_scache* abuf = sem;
5269 unsigned long long written = 0;
5270 PCADDR pc = abuf->addr;
5271 PCADDR npc = pc + 4;
5274 DI opval = SLLDI (current_cpu->h_gr_get (FLD (f_left)), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63));
5275 if (UNLIKELY(current_cpu->trace_result_p))
5276 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5277 current_cpu->h_gr_set (FLD (f_dest), opval);
5280 current_cpu->done_insn (npc, status);
5284 // ********** shlldl: shlld.l $rm, $rn, $rd
5287 sh5_media_sem_shlldl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5288 sh5_media::write_stacks &buf)
5290 #define FLD(f) abuf->fields.sfmt_mcmv.f
5291 sem_status status = SEM_STATUS_NORMAL;
5292 sh5_media_scache* abuf = sem;
5293 unsigned long long written = 0;
5294 PCADDR pc = abuf->addr;
5295 PCADDR npc = pc + 4;
5298 DI opval = EXTSIDI (SLLSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63)));
5299 if (UNLIKELY(current_cpu->trace_result_p))
5300 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5301 current_cpu->h_gr_set (FLD (f_dest), opval);
5304 current_cpu->done_insn (npc, status);
5308 // ********** shlli: shlli $rm, $uimm6, $rd
5311 sh5_media_sem_shlli (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5312 sh5_media::write_stacks &buf)
5314 #define FLD(f) abuf->fields.sfmt_shari.f
5315 sem_status status = SEM_STATUS_NORMAL;
5316 sh5_media_scache* abuf = sem;
5317 unsigned long long written = 0;
5318 PCADDR pc = abuf->addr;
5319 PCADDR npc = pc + 4;
5322 DI opval = SLLDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_uimm6));
5323 if (UNLIKELY(current_cpu->trace_result_p))
5324 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5325 current_cpu->h_gr_set (FLD (f_dest), opval);
5328 current_cpu->done_insn (npc, status);
5332 // ********** shllil: shlli.l $rm, $uimm6, $rd
5335 sh5_media_sem_shllil (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5336 sh5_media::write_stacks &buf)
5338 #define FLD(f) abuf->fields.sfmt_shari.f
5339 sem_status status = SEM_STATUS_NORMAL;
5340 sh5_media_scache* abuf = sem;
5341 unsigned long long written = 0;
5342 PCADDR pc = abuf->addr;
5343 PCADDR npc = pc + 4;
5346 DI opval = EXTSIDI (SLLSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
5347 if (UNLIKELY(current_cpu->trace_result_p))
5348 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5349 current_cpu->h_gr_set (FLD (f_dest), opval);
5352 current_cpu->done_insn (npc, status);
5356 // ********** shlrd: shlrd $rm, $rn, $rd
5359 sh5_media_sem_shlrd (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5360 sh5_media::write_stacks &buf)
5362 #define FLD(f) abuf->fields.sfmt_mcmv.f
5363 sem_status status = SEM_STATUS_NORMAL;
5364 sh5_media_scache* abuf = sem;
5365 unsigned long long written = 0;
5366 PCADDR pc = abuf->addr;
5367 PCADDR npc = pc + 4;
5370 DI opval = SRLDI (current_cpu->h_gr_get (FLD (f_left)), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63));
5371 if (UNLIKELY(current_cpu->trace_result_p))
5372 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5373 current_cpu->h_gr_set (FLD (f_dest), opval);
5376 current_cpu->done_insn (npc, status);
5380 // ********** shlrdl: shlrd.l $rm, $rn, $rd
5383 sh5_media_sem_shlrdl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5384 sh5_media::write_stacks &buf)
5386 #define FLD(f) abuf->fields.sfmt_mcmv.f
5387 sem_status status = SEM_STATUS_NORMAL;
5388 sh5_media_scache* abuf = sem;
5389 unsigned long long written = 0;
5390 PCADDR pc = abuf->addr;
5391 PCADDR npc = pc + 4;
5394 DI opval = EXTSIDI (SRLSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDDI (current_cpu->h_gr_get (FLD (f_right)), 63)));
5395 if (UNLIKELY(current_cpu->trace_result_p))
5396 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5397 current_cpu->h_gr_set (FLD (f_dest), opval);
5400 current_cpu->done_insn (npc, status);
5404 // ********** shlri: shlri $rm, $uimm6, $rd
5407 sh5_media_sem_shlri (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5408 sh5_media::write_stacks &buf)
5410 #define FLD(f) abuf->fields.sfmt_shari.f
5411 sem_status status = SEM_STATUS_NORMAL;
5412 sh5_media_scache* abuf = sem;
5413 unsigned long long written = 0;
5414 PCADDR pc = abuf->addr;
5415 PCADDR npc = pc + 4;
5418 DI opval = SRLDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_uimm6));
5419 if (UNLIKELY(current_cpu->trace_result_p))
5420 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5421 current_cpu->h_gr_set (FLD (f_dest), opval);
5424 current_cpu->done_insn (npc, status);
5428 // ********** shlril: shlri.l $rm, $uimm6, $rd
5431 sh5_media_sem_shlril (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5432 sh5_media::write_stacks &buf)
5434 #define FLD(f) abuf->fields.sfmt_shari.f
5435 sem_status status = SEM_STATUS_NORMAL;
5436 sh5_media_scache* abuf = sem;
5437 unsigned long long written = 0;
5438 PCADDR pc = abuf->addr;
5439 PCADDR npc = pc + 4;
5442 DI opval = EXTSIDI (SRLSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
5443 if (UNLIKELY(current_cpu->trace_result_p))
5444 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5445 current_cpu->h_gr_set (FLD (f_dest), opval);
5448 current_cpu->done_insn (npc, status);
5452 // ********** shori: shori $uimm16, $rd
5455 sh5_media_sem_shori (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5456 sh5_media::write_stacks &buf)
5458 #define FLD(f) abuf->fields.sfmt_shori.f
5459 sem_status status = SEM_STATUS_NORMAL;
5460 sh5_media_scache* abuf = sem;
5461 unsigned long long written = 0;
5462 PCADDR pc = abuf->addr;
5463 PCADDR npc = pc + 4;
5466 DI opval = ORDI (SLLDI (current_cpu->h_gr_get (FLD (f_dest)), 16), ZEXTSIDI (FLD (f_uimm16)));
5467 if (UNLIKELY(current_cpu->trace_result_p))
5468 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
5469 current_cpu->h_gr_set (FLD (f_dest), opval);
5472 current_cpu->done_insn (npc, status);
5476 // ********** sleep: sleep
5479 sh5_media_sem_sleep (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5480 sh5_media::write_stacks &buf)
5482 #define FLD(f) abuf->fields.fmt_empty.f
5483 sem_status status = SEM_STATUS_NORMAL;
5484 sh5_media_scache* abuf = sem;
5485 unsigned long long written = 0;
5486 PCADDR pc = abuf->addr;
5487 PCADDR npc = pc + 4;
5491 current_cpu->done_insn (npc, status);
5495 // ********** stb: st.b $rm, $disp10, $rd
5498 sh5_media_sem_stb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5499 sh5_media::write_stacks &buf)
5501 #define FLD(f) abuf->fields.sfmt_stb.f
5502 sem_status status = SEM_STATUS_NORMAL;
5503 sh5_media_scache* abuf = sem;
5504 unsigned long long written = 0;
5505 PCADDR pc = abuf->addr;
5506 PCADDR npc = pc + 4;
5509 UQI opval = ANDQI (current_cpu->h_gr_get (FLD (f_dest)), 255);
5510 if (UNLIKELY(current_cpu->trace_result_p))
5511 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10))) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5512 current_cpu->SETMEMUQI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10))), opval);
5515 current_cpu->done_insn (npc, status);
5519 // ********** stl: st.l $rm, $disp10x4, $rd
5522 sh5_media_sem_stl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5523 sh5_media::write_stacks &buf)
5525 #define FLD(f) abuf->fields.sfmt_stl.f
5526 sem_status status = SEM_STATUS_NORMAL;
5527 sh5_media_scache* abuf = sem;
5528 unsigned long long written = 0;
5529 PCADDR pc = abuf->addr;
5530 PCADDR npc = pc + 4;
5533 SI opval = ANDSI (current_cpu->h_gr_get (FLD (f_dest)), 0xffffffff);
5534 if (UNLIKELY(current_cpu->trace_result_p))
5535 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x4))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5536 current_cpu->SETMEMSI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x4))), opval);
5539 current_cpu->done_insn (npc, status);
5543 // ********** stq: st.q $rm, $disp10x8, $rd
5546 sh5_media_sem_stq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5547 sh5_media::write_stacks &buf)
5549 #define FLD(f) abuf->fields.sfmt_stq.f
5550 sem_status status = SEM_STATUS_NORMAL;
5551 sh5_media_scache* abuf = sem;
5552 unsigned long long written = 0;
5553 PCADDR pc = abuf->addr;
5554 PCADDR npc = pc + 4;
5557 DI opval = current_cpu->h_gr_get (FLD (f_dest));
5558 if (UNLIKELY(current_cpu->trace_result_p))
5559 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x8))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5560 current_cpu->SETMEMDI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x8))), opval);
5563 current_cpu->done_insn (npc, status);
5567 // ********** stw: st.w $rm, $disp10x2, $rd
5570 sh5_media_sem_stw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5571 sh5_media::write_stacks &buf)
5573 #define FLD(f) abuf->fields.sfmt_stw.f
5574 sem_status status = SEM_STATUS_NORMAL;
5575 sh5_media_scache* abuf = sem;
5576 unsigned long long written = 0;
5577 PCADDR pc = abuf->addr;
5578 PCADDR npc = pc + 4;
5581 HI opval = ANDHI (current_cpu->h_gr_get (FLD (f_dest)), 65535);
5582 if (UNLIKELY(current_cpu->trace_result_p))
5583 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x2))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5584 current_cpu->SETMEMHI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_disp10x2))), opval);
5587 current_cpu->done_insn (npc, status);
5591 // ********** sthil: sthi.l $rm, $disp6, $rd
5594 sh5_media_sem_sthil (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5595 sh5_media::write_stacks &buf)
5597 #define FLD(f) abuf->fields.sfmt_putcfg.f
5598 sem_status status = SEM_STATUS_NORMAL;
5599 sh5_media_scache* abuf = sem;
5600 unsigned long long written = 0;
5601 PCADDR pc = abuf->addr;
5602 PCADDR npc = pc + 4;
5608 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
5609 tmp_bytecount = ADDDI (ANDDI (tmp_addr, 3), 1);
5610 if (ANDQI (tmp_bytecount, 4)) {
5612 SI opval = current_cpu->h_gr_get (FLD (f_dest));
5613 written |= (1ULL << 5);
5614 if (UNLIKELY(current_cpu->trace_result_p))
5615 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (tmp_addr, -4) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5616 current_cpu->SETMEMSI (pc, ANDDI (tmp_addr, -4), opval);
5619 if (current_cpu->h_endian_get ()) {
5621 tmp_val = current_cpu->h_gr_get (FLD (f_dest));
5622 if (ANDQI (tmp_bytecount, 1)) {
5625 UQI opval = ANDQI (tmp_val, 255);
5626 written |= (1ULL << 6);
5627 if (UNLIKELY(current_cpu->trace_result_p))
5628 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5629 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5631 tmp_val = SRLDI (tmp_val, 8);
5634 if (ANDQI (tmp_bytecount, 2)) {
5637 HI opval = ANDHI (tmp_val, 65535);
5638 written |= (1ULL << 4);
5639 if (UNLIKELY(current_cpu->trace_result_p))
5640 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (tmp_addr, -4) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5641 current_cpu->SETMEMHI (pc, ANDDI (tmp_addr, -4), opval);
5643 tmp_val = SRLDI (tmp_val, 16);
5649 tmp_val = SRLDI (current_cpu->h_gr_get (FLD (f_dest)), SUBSI (32, MULSI (8, tmp_bytecount)));
5650 if (ANDQI (tmp_bytecount, 2)) {
5653 HI opval = ANDHI (tmp_val, 65535);
5654 written |= (1ULL << 4);
5655 if (UNLIKELY(current_cpu->trace_result_p))
5656 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (tmp_addr, -4) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5657 current_cpu->SETMEMHI (pc, ANDDI (tmp_addr, -4), opval);
5659 tmp_val = SRLDI (tmp_val, 16);
5662 if (ANDQI (tmp_bytecount, 1)) {
5665 UQI opval = ANDQI (tmp_val, 255);
5666 written |= (1ULL << 6);
5667 if (UNLIKELY(current_cpu->trace_result_p))
5668 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5669 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5671 tmp_val = SRLDI (tmp_val, 8);
5679 abuf->written = written;
5680 current_cpu->done_insn (npc, status);
5684 // ********** sthiq: sthi.q $rm, $disp6, $rd
5687 sh5_media_sem_sthiq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5688 sh5_media::write_stacks &buf)
5690 #define FLD(f) abuf->fields.sfmt_putcfg.f
5691 sem_status status = SEM_STATUS_NORMAL;
5692 sh5_media_scache* abuf = sem;
5693 unsigned long long written = 0;
5694 PCADDR pc = abuf->addr;
5695 PCADDR npc = pc + 4;
5701 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
5702 tmp_bytecount = ADDDI (ANDDI (tmp_addr, 7), 1);
5703 if (ANDQI (tmp_bytecount, 8)) {
5705 DI opval = current_cpu->h_gr_get (FLD (f_dest));
5706 written |= (1ULL << 4);
5707 if (UNLIKELY(current_cpu->trace_result_p))
5708 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (tmp_addr, -8) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5709 current_cpu->SETMEMDI (pc, ANDDI (tmp_addr, -8), opval);
5712 if (current_cpu->h_endian_get ()) {
5714 tmp_val = current_cpu->h_gr_get (FLD (f_dest));
5715 if (ANDQI (tmp_bytecount, 1)) {
5718 UQI opval = ANDQI (tmp_val, 255);
5719 written |= (1ULL << 7);
5720 if (UNLIKELY(current_cpu->trace_result_p))
5721 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5722 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5724 tmp_val = SRLDI (tmp_val, 8);
5727 if (ANDQI (tmp_bytecount, 2)) {
5730 HI opval = ANDHI (tmp_val, 65535);
5731 written |= (1ULL << 5);
5732 if (UNLIKELY(current_cpu->trace_result_p))
5733 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (tmp_addr, -4) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5734 current_cpu->SETMEMHI (pc, ANDDI (tmp_addr, -4), opval);
5736 tmp_val = SRLDI (tmp_val, 16);
5739 if (ANDQI (tmp_bytecount, 4)) {
5742 SI opval = ANDSI (tmp_val, 0xffffffff);
5743 written |= (1ULL << 6);
5744 if (UNLIKELY(current_cpu->trace_result_p))
5745 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (tmp_addr, -8) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5746 current_cpu->SETMEMSI (pc, ANDDI (tmp_addr, -8), opval);
5748 tmp_val = SRLDI (tmp_val, 32);
5754 tmp_val = SRLDI (current_cpu->h_gr_get (FLD (f_dest)), SUBSI (64, MULSI (8, tmp_bytecount)));
5755 if (ANDQI (tmp_bytecount, 4)) {
5758 SI opval = ANDSI (tmp_val, 0xffffffff);
5759 written |= (1ULL << 6);
5760 if (UNLIKELY(current_cpu->trace_result_p))
5761 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (tmp_addr, -8) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5762 current_cpu->SETMEMSI (pc, ANDDI (tmp_addr, -8), opval);
5764 tmp_val = SRLDI (tmp_val, 32);
5767 if (ANDQI (tmp_bytecount, 2)) {
5770 HI opval = ANDHI (tmp_val, 65535);
5771 written |= (1ULL << 5);
5772 if (UNLIKELY(current_cpu->trace_result_p))
5773 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (tmp_addr, -4) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5774 current_cpu->SETMEMHI (pc, ANDDI (tmp_addr, -4), opval);
5776 tmp_val = SRLDI (tmp_val, 16);
5779 if (ANDQI (tmp_bytecount, 1)) {
5782 UQI opval = ANDQI (tmp_val, 255);
5783 written |= (1ULL << 7);
5784 if (UNLIKELY(current_cpu->trace_result_p))
5785 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5786 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5788 tmp_val = SRLDI (tmp_val, 8);
5796 abuf->written = written;
5797 current_cpu->done_insn (npc, status);
5801 // ********** stlol: stlo.l $rm, $disp6, $rd
5804 sh5_media_sem_stlol (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5805 sh5_media::write_stacks &buf)
5807 #define FLD(f) abuf->fields.sfmt_putcfg.f
5808 sem_status status = SEM_STATUS_NORMAL;
5809 sh5_media_scache* abuf = sem;
5810 unsigned long long written = 0;
5811 PCADDR pc = abuf->addr;
5812 PCADDR npc = pc + 4;
5818 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
5819 tmp_bytecount = SUBSI (4, ANDDI (tmp_addr, 3));
5820 if (ANDQI (tmp_bytecount, 4)) {
5822 USI opval = current_cpu->h_gr_get (FLD (f_dest));
5823 written |= (1ULL << 6);
5824 if (UNLIKELY(current_cpu->trace_result_p))
5825 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5826 current_cpu->SETMEMUSI (pc, tmp_addr, opval);
5829 if (current_cpu->h_endian_get ()) {
5831 tmp_val = SRLDI (current_cpu->h_gr_get (FLD (f_dest)), SUBSI (32, MULSI (8, tmp_bytecount)));
5832 if (ANDQI (tmp_bytecount, 2)) {
5835 UHI opval = ANDHI (tmp_val, 65535);
5836 written |= (1ULL << 4);
5837 if (UNLIKELY(current_cpu->trace_result_p))
5838 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (ADDDI (tmp_addr, 1), -2) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5839 current_cpu->SETMEMUHI (pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5841 tmp_val = SRLDI (tmp_val, 16);
5844 if (ANDQI (tmp_bytecount, 1)) {
5847 UQI opval = ANDQI (tmp_val, 255);
5848 written |= (1ULL << 5);
5849 if (UNLIKELY(current_cpu->trace_result_p))
5850 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5851 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5853 tmp_val = SRLDI (tmp_val, 8);
5859 tmp_val = current_cpu->h_gr_get (FLD (f_dest));
5860 if (ANDQI (tmp_bytecount, 1)) {
5863 UQI opval = ANDQI (tmp_val, 255);
5864 written |= (1ULL << 5);
5865 if (UNLIKELY(current_cpu->trace_result_p))
5866 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5867 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5869 tmp_val = SRLDI (tmp_val, 8);
5872 if (ANDQI (tmp_bytecount, 2)) {
5875 UHI opval = ANDHI (tmp_val, 65535);
5876 written |= (1ULL << 4);
5877 if (UNLIKELY(current_cpu->trace_result_p))
5878 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (ADDDI (tmp_addr, 1), -2) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5879 current_cpu->SETMEMUHI (pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5881 tmp_val = SRLDI (tmp_val, 16);
5889 abuf->written = written;
5890 current_cpu->done_insn (npc, status);
5894 // ********** stloq: stlo.q $rm, $disp6, $rd
5897 sh5_media_sem_stloq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
5898 sh5_media::write_stacks &buf)
5900 #define FLD(f) abuf->fields.sfmt_putcfg.f
5901 sem_status status = SEM_STATUS_NORMAL;
5902 sh5_media_scache* abuf = sem;
5903 unsigned long long written = 0;
5904 PCADDR pc = abuf->addr;
5905 PCADDR npc = pc + 4;
5911 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), FLD (f_disp6));
5912 tmp_bytecount = SUBSI (8, ANDDI (tmp_addr, 7));
5913 if (ANDQI (tmp_bytecount, 8)) {
5915 UDI opval = current_cpu->h_gr_get (FLD (f_dest));
5916 written |= (1ULL << 4);
5917 if (UNLIKELY(current_cpu->trace_result_p))
5918 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5919 current_cpu->SETMEMUDI (pc, tmp_addr, opval);
5922 if (current_cpu->h_endian_get ()) {
5924 tmp_val = SRLDI (current_cpu->h_gr_get (FLD (f_dest)), SUBSI (64, MULSI (8, tmp_bytecount)));
5925 if (ANDQI (tmp_bytecount, 4)) {
5928 USI opval = ANDSI (tmp_val, 0xffffffff);
5929 written |= (1ULL << 7);
5930 if (UNLIKELY(current_cpu->trace_result_p))
5931 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (ADDDI (tmp_addr, 3), -4) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5932 current_cpu->SETMEMUSI (pc, ANDDI (ADDDI (tmp_addr, 3), -4), opval);
5934 tmp_val = SRLDI (tmp_val, 32);
5937 if (ANDQI (tmp_bytecount, 2)) {
5940 UHI opval = ANDHI (tmp_val, 65535);
5941 written |= (1ULL << 5);
5942 if (UNLIKELY(current_cpu->trace_result_p))
5943 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (ADDDI (tmp_addr, 1), -2) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5944 current_cpu->SETMEMUHI (pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5946 tmp_val = SRLDI (tmp_val, 16);
5949 if (ANDQI (tmp_bytecount, 1)) {
5952 UQI opval = ANDQI (tmp_val, 255);
5953 written |= (1ULL << 6);
5954 if (UNLIKELY(current_cpu->trace_result_p))
5955 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5956 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5958 tmp_val = SRLDI (tmp_val, 8);
5964 tmp_val = current_cpu->h_gr_get (FLD (f_dest));
5965 if (ANDQI (tmp_bytecount, 1)) {
5968 UQI opval = ANDQI (tmp_val, 255);
5969 written |= (1ULL << 6);
5970 if (UNLIKELY(current_cpu->trace_result_p))
5971 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5972 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5974 tmp_val = SRLDI (tmp_val, 8);
5977 if (ANDQI (tmp_bytecount, 2)) {
5980 UHI opval = ANDHI (tmp_val, 65535);
5981 written |= (1ULL << 5);
5982 if (UNLIKELY(current_cpu->trace_result_p))
5983 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (ADDDI (tmp_addr, 1), -2) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5984 current_cpu->SETMEMUHI (pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5986 tmp_val = SRLDI (tmp_val, 16);
5989 if (ANDQI (tmp_bytecount, 4)) {
5992 USI opval = ANDSI (tmp_val, 0xffffffff);
5993 written |= (1ULL << 7);
5994 if (UNLIKELY(current_cpu->trace_result_p))
5995 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ANDDI (ADDDI (tmp_addr, 3), -4) << dec << ']' << ":=0x" << hex << opval << dec << " ";
5996 current_cpu->SETMEMUSI (pc, ANDDI (ADDDI (tmp_addr, 3), -4), opval);
5998 tmp_val = SRLDI (tmp_val, 32);
6006 abuf->written = written;
6007 current_cpu->done_insn (npc, status);
6011 // ********** stxb: stx.b $rm, $rn, $rd
6014 sh5_media_sem_stxb (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6015 sh5_media::write_stacks &buf)
6017 #define FLD(f) abuf->fields.sfmt_mcmv.f
6018 sem_status status = SEM_STATUS_NORMAL;
6019 sh5_media_scache* abuf = sem;
6020 unsigned long long written = 0;
6021 PCADDR pc = abuf->addr;
6022 PCADDR npc = pc + 4;
6025 UQI opval = SUBWORDDIQI (current_cpu->h_gr_get (FLD (f_dest)), 7);
6026 if (UNLIKELY(current_cpu->trace_result_p))
6027 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
6028 current_cpu->SETMEMUQI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))), opval);
6031 current_cpu->done_insn (npc, status);
6035 // ********** stxl: stx.l $rm, $rn, $rd
6038 sh5_media_sem_stxl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6039 sh5_media::write_stacks &buf)
6041 #define FLD(f) abuf->fields.sfmt_mcmv.f
6042 sem_status status = SEM_STATUS_NORMAL;
6043 sh5_media_scache* abuf = sem;
6044 unsigned long long written = 0;
6045 PCADDR pc = abuf->addr;
6046 PCADDR npc = pc + 4;
6049 SI opval = SUBWORDDISI (current_cpu->h_gr_get (FLD (f_dest)), 1);
6050 if (UNLIKELY(current_cpu->trace_result_p))
6051 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
6052 current_cpu->SETMEMSI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))), opval);
6055 current_cpu->done_insn (npc, status);
6059 // ********** stxq: stx.q $rm, $rn, $rd
6062 sh5_media_sem_stxq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6063 sh5_media::write_stacks &buf)
6065 #define FLD(f) abuf->fields.sfmt_mcmv.f
6066 sem_status status = SEM_STATUS_NORMAL;
6067 sh5_media_scache* abuf = sem;
6068 unsigned long long written = 0;
6069 PCADDR pc = abuf->addr;
6070 PCADDR npc = pc + 4;
6073 DI opval = current_cpu->h_gr_get (FLD (f_dest));
6074 if (UNLIKELY(current_cpu->trace_result_p))
6075 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
6076 current_cpu->SETMEMDI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))), opval);
6079 current_cpu->done_insn (npc, status);
6083 // ********** stxw: stx.w $rm, $rn, $rd
6086 sh5_media_sem_stxw (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6087 sh5_media::write_stacks &buf)
6089 #define FLD(f) abuf->fields.sfmt_mcmv.f
6090 sem_status status = SEM_STATUS_NORMAL;
6091 sh5_media_scache* abuf = sem;
6092 unsigned long long written = 0;
6093 PCADDR pc = abuf->addr;
6094 PCADDR npc = pc + 4;
6097 HI opval = SUBWORDDIHI (current_cpu->h_gr_get (FLD (f_dest)), 3);
6098 if (UNLIKELY(current_cpu->trace_result_p))
6099 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
6100 current_cpu->SETMEMHI (pc, ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right))), opval);
6103 current_cpu->done_insn (npc, status);
6107 // ********** sub: sub $rm, $rn, $rd
6110 sh5_media_sem_sub (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6111 sh5_media::write_stacks &buf)
6113 #define FLD(f) abuf->fields.sfmt_mcmv.f
6114 sem_status status = SEM_STATUS_NORMAL;
6115 sh5_media_scache* abuf = sem;
6116 unsigned long long written = 0;
6117 PCADDR pc = abuf->addr;
6118 PCADDR npc = pc + 4;
6121 DI opval = SUBDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)));
6122 if (UNLIKELY(current_cpu->trace_result_p))
6123 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
6124 current_cpu->h_gr_set (FLD (f_dest), opval);
6127 current_cpu->done_insn (npc, status);
6131 // ********** subl: sub.l $rm, $rn, $rd
6134 sh5_media_sem_subl (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6135 sh5_media::write_stacks &buf)
6137 #define FLD(f) abuf->fields.sfmt_mcmv.f
6138 sem_status status = SEM_STATUS_NORMAL;
6139 sh5_media_scache* abuf = sem;
6140 unsigned long long written = 0;
6141 PCADDR pc = abuf->addr;
6142 PCADDR npc = pc + 4;
6145 DI opval = EXTSIDI (SUBSI (SUBWORDDISI (current_cpu->h_gr_get (FLD (f_left)), 1), SUBWORDDISI (current_cpu->h_gr_get (FLD (f_right)), 1)));
6146 if (UNLIKELY(current_cpu->trace_result_p))
6147 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
6148 current_cpu->h_gr_set (FLD (f_dest), opval);
6151 current_cpu->done_insn (npc, status);
6155 // ********** swapq: swap.q $rm, $rn, $rd
6158 sh5_media_sem_swapq (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6159 sh5_media::write_stacks &buf)
6161 #define FLD(f) abuf->fields.sfmt_mcmv.f
6162 sem_status status = SEM_STATUS_NORMAL;
6163 sh5_media_scache* abuf = sem;
6164 unsigned long long written = 0;
6165 PCADDR pc = abuf->addr;
6166 PCADDR npc = pc + 4;
6171 tmp_addr = ADDDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)));
6172 tmp_temp = current_cpu->GETMEMDI (pc, tmp_addr);
6174 DI opval = current_cpu->h_gr_get (FLD (f_dest));
6175 if (UNLIKELY(current_cpu->trace_result_p))
6176 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
6177 current_cpu->SETMEMDI (pc, tmp_addr, opval);
6180 DI opval = tmp_temp;
6181 if (UNLIKELY(current_cpu->trace_result_p))
6182 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
6183 current_cpu->h_gr_set (FLD (f_dest), opval);
6187 current_cpu->done_insn (npc, status);
6191 // ********** synci: synci
6194 sh5_media_sem_synci (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6195 sh5_media::write_stacks &buf)
6197 #define FLD(f) abuf->fields.fmt_empty.f
6198 sem_status status = SEM_STATUS_NORMAL;
6199 sh5_media_scache* abuf = sem;
6200 unsigned long long written = 0;
6201 PCADDR pc = abuf->addr;
6202 PCADDR npc = pc + 4;
6206 current_cpu->done_insn (npc, status);
6210 // ********** synco: synco
6213 sh5_media_sem_synco (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6214 sh5_media::write_stacks &buf)
6216 #define FLD(f) abuf->fields.fmt_empty.f
6217 sem_status status = SEM_STATUS_NORMAL;
6218 sh5_media_scache* abuf = sem;
6219 unsigned long long written = 0;
6220 PCADDR pc = abuf->addr;
6221 PCADDR npc = pc + 4;
6225 current_cpu->done_insn (npc, status);
6229 // ********** trapa: trapa $rm
6232 sh5_media_sem_trapa (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6233 sh5_media::write_stacks &buf)
6235 #define FLD(f) abuf->fields.sfmt_alloco.f
6236 sem_status status = SEM_STATUS_NORMAL;
6237 sh5_media_scache* abuf = sem;
6238 unsigned long long written = 0;
6239 PCADDR pc = abuf->addr;
6240 PCADDR npc = pc + 4;
6242 current_cpu->sh64_trapa (current_cpu->h_gr_get (FLD (f_left)), pc);
6244 current_cpu->done_insn (npc, status);
6248 // ********** xor: xor $rm, $rn, $rd
6251 sh5_media_sem_xor (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6252 sh5_media::write_stacks &buf)
6254 #define FLD(f) abuf->fields.sfmt_mcmv.f
6255 sem_status status = SEM_STATUS_NORMAL;
6256 sh5_media_scache* abuf = sem;
6257 unsigned long long written = 0;
6258 PCADDR pc = abuf->addr;
6259 PCADDR npc = pc + 4;
6262 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_left)), current_cpu->h_gr_get (FLD (f_right)));
6263 if (UNLIKELY(current_cpu->trace_result_p))
6264 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
6265 current_cpu->h_gr_set (FLD (f_dest), opval);
6268 current_cpu->done_insn (npc, status);
6272 // ********** xori: xori $rm, $imm6, $rd
6275 sh5_media_sem_xori (sh5_cpu* current_cpu, sh5_media_scache* sem, const int tick,
6276 sh5_media::write_stacks &buf)
6278 #define FLD(f) abuf->fields.sfmt_xori.f
6279 sem_status status = SEM_STATUS_NORMAL;
6280 sh5_media_scache* abuf = sem;
6281 unsigned long long written = 0;
6282 PCADDR pc = abuf->addr;
6283 PCADDR npc = pc + 4;
6286 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_left)), EXTSIDI (FLD (f_imm6)));
6287 if (UNLIKELY(current_cpu->trace_result_p))
6288 current_cpu->trace_stream << "gr" << '[' << FLD (f_dest) << ']' << ":=0x" << hex << opval << dec << " ";
6289 current_cpu->h_gr_set (FLD (f_dest), opval);
6292 current_cpu->done_insn (npc, status);