Fix migration failure with in-kernel IOAPIC emulation
[qemu-kvm/fedora.git] / target-ppc / op.c
blobc950579a1b536d07966b5ee8c86f4b2b2645e45a
1 /*
2 * PowerPC emulation micro-operations for qemu.
4 * Copyright (c) 2003-2007 Jocelyn Mayer
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 //#define DEBUG_OP
23 #include "config.h"
24 #include "exec.h"
25 #include "host-utils.h"
26 #include "helper_regs.h"
27 #include "op_helper.h"
29 #define REG 0
30 #include "op_template.h"
32 #define REG 1
33 #include "op_template.h"
35 #define REG 2
36 #include "op_template.h"
38 #define REG 3
39 #include "op_template.h"
41 #define REG 4
42 #include "op_template.h"
44 #define REG 5
45 #include "op_template.h"
47 #define REG 6
48 #include "op_template.h"
50 #define REG 7
51 #include "op_template.h"
53 #define REG 8
54 #include "op_template.h"
56 #define REG 9
57 #include "op_template.h"
59 #define REG 10
60 #include "op_template.h"
62 #define REG 11
63 #include "op_template.h"
65 #define REG 12
66 #include "op_template.h"
68 #define REG 13
69 #include "op_template.h"
71 #define REG 14
72 #include "op_template.h"
74 #define REG 15
75 #include "op_template.h"
77 #define REG 16
78 #include "op_template.h"
80 #define REG 17
81 #include "op_template.h"
83 #define REG 18
84 #include "op_template.h"
86 #define REG 19
87 #include "op_template.h"
89 #define REG 20
90 #include "op_template.h"
92 #define REG 21
93 #include "op_template.h"
95 #define REG 22
96 #include "op_template.h"
98 #define REG 23
99 #include "op_template.h"
101 #define REG 24
102 #include "op_template.h"
104 #define REG 25
105 #include "op_template.h"
107 #define REG 26
108 #include "op_template.h"
110 #define REG 27
111 #include "op_template.h"
113 #define REG 28
114 #include "op_template.h"
116 #define REG 29
117 #include "op_template.h"
119 #define REG 30
120 #include "op_template.h"
122 #define REG 31
123 #include "op_template.h"
125 void OPPROTO op_print_mem_EA (void)
127 do_print_mem_EA(T0);
128 RETURN();
131 /* PowerPC state maintenance operations */
132 /* set_Rc0 */
133 void OPPROTO op_set_Rc0 (void)
135 env->crf[0] = T0 | xer_so;
136 RETURN();
139 /* Constants load */
140 void OPPROTO op_reset_T0 (void)
142 T0 = 0;
143 RETURN();
146 void OPPROTO op_set_T0 (void)
148 T0 = (uint32_t)PARAM1;
149 RETURN();
152 #if defined(TARGET_PPC64)
153 void OPPROTO op_set_T0_64 (void)
155 T0 = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
156 RETURN();
158 #endif
160 void OPPROTO op_set_T1 (void)
162 T1 = (uint32_t)PARAM1;
163 RETURN();
166 #if defined(TARGET_PPC64)
167 void OPPROTO op_set_T1_64 (void)
169 T1 = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
170 RETURN();
172 #endif
174 #if 0 // unused
175 void OPPROTO op_set_T2 (void)
177 T2 = (uint32_t)PARAM1;
178 RETURN();
180 #endif
182 void OPPROTO op_move_T1_T0 (void)
184 T1 = T0;
185 RETURN();
188 void OPPROTO op_move_T2_T0 (void)
190 T2 = T0;
191 RETURN();
194 void OPPROTO op_moven_T2_T0 (void)
196 T2 = ~T0;
197 RETURN();
200 /* Generate exceptions */
201 void OPPROTO op_raise_exception_err (void)
203 do_raise_exception_err(PARAM1, PARAM2);
206 void OPPROTO op_update_nip (void)
208 env->nip = (uint32_t)PARAM1;
209 RETURN();
212 #if defined(TARGET_PPC64)
213 void OPPROTO op_update_nip_64 (void)
215 env->nip = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
216 RETURN();
218 #endif
220 void OPPROTO op_debug (void)
222 do_raise_exception(EXCP_DEBUG);
225 void OPPROTO op_exit_tb (void)
227 EXIT_TB();
230 /* Load/store special registers */
231 void OPPROTO op_load_cr (void)
233 do_load_cr();
234 RETURN();
237 void OPPROTO op_store_cr (void)
239 do_store_cr(PARAM1);
240 RETURN();
243 void OPPROTO op_load_cro (void)
245 T0 = env->crf[PARAM1];
246 RETURN();
249 void OPPROTO op_store_cro (void)
251 env->crf[PARAM1] = T0;
252 RETURN();
255 void OPPROTO op_load_xer_cr (void)
257 T0 = (xer_so << 3) | (xer_ov << 2) | (xer_ca << 1);
258 RETURN();
261 void OPPROTO op_clear_xer_ov (void)
263 xer_so = 0;
264 xer_ov = 0;
265 RETURN();
268 void OPPROTO op_clear_xer_ca (void)
270 xer_ca = 0;
271 RETURN();
274 void OPPROTO op_load_xer_bc (void)
276 T1 = xer_bc;
277 RETURN();
280 void OPPROTO op_store_xer_bc (void)
282 xer_bc = T0;
283 RETURN();
286 void OPPROTO op_load_xer (void)
288 T0 = hreg_load_xer(env);
289 RETURN();
292 void OPPROTO op_store_xer (void)
294 hreg_store_xer(env, T0);
295 RETURN();
298 #if defined(TARGET_PPC64)
299 void OPPROTO op_store_pri (void)
301 do_store_pri(PARAM1);
302 RETURN();
304 #endif
306 #if !defined(CONFIG_USER_ONLY)
307 /* Segment registers load and store */
308 void OPPROTO op_load_sr (void)
310 T0 = env->sr[T1];
311 RETURN();
314 void OPPROTO op_store_sr (void)
316 do_store_sr(env, T1, T0);
317 RETURN();
320 #if defined(TARGET_PPC64)
321 void OPPROTO op_load_slb (void)
323 T0 = ppc_load_slb(env, T1);
324 RETURN();
327 void OPPROTO op_store_slb (void)
329 ppc_store_slb(env, T1, T0);
330 RETURN();
332 #endif /* defined(TARGET_PPC64) */
334 void OPPROTO op_load_sdr1 (void)
336 T0 = env->sdr1;
337 RETURN();
340 void OPPROTO op_store_sdr1 (void)
342 do_store_sdr1(env, T0);
343 RETURN();
346 #if defined (TARGET_PPC64)
347 void OPPROTO op_load_asr (void)
349 T0 = env->asr;
350 RETURN();
353 void OPPROTO op_store_asr (void)
355 ppc_store_asr(env, T0);
356 RETURN();
358 #endif
360 void OPPROTO op_load_msr (void)
362 T0 = env->msr;
363 RETURN();
366 void OPPROTO op_store_msr (void)
368 do_store_msr();
369 RETURN();
372 #if defined (TARGET_PPC64)
373 void OPPROTO op_store_msr_32 (void)
375 T0 = (env->msr & ~0xFFFFFFFFULL) | (T0 & 0xFFFFFFFF);
376 do_store_msr();
377 RETURN();
379 #endif
381 void OPPROTO op_update_riee (void)
383 /* We don't call do_store_msr here as we won't trigger
384 * any special case nor change hflags
386 T0 &= (1 << MSR_RI) | (1 << MSR_EE);
387 env->msr &= ~(1 << MSR_RI) | (1 << MSR_EE);
388 env->msr |= T0;
389 RETURN();
391 #endif
393 /* SPR */
394 void OPPROTO op_load_spr (void)
396 T0 = env->spr[PARAM1];
397 RETURN();
400 void OPPROTO op_store_spr (void)
402 env->spr[PARAM1] = T0;
403 RETURN();
406 void OPPROTO op_load_dump_spr (void)
408 T0 = ppc_load_dump_spr(PARAM1);
409 RETURN();
412 void OPPROTO op_store_dump_spr (void)
414 ppc_store_dump_spr(PARAM1, T0);
415 RETURN();
418 void OPPROTO op_mask_spr (void)
420 env->spr[PARAM1] &= ~T0;
421 RETURN();
424 void OPPROTO op_load_lr (void)
426 T0 = env->lr;
427 RETURN();
430 void OPPROTO op_store_lr (void)
432 env->lr = T0;
433 RETURN();
436 void OPPROTO op_load_ctr (void)
438 T0 = env->ctr;
439 RETURN();
442 void OPPROTO op_store_ctr (void)
444 env->ctr = T0;
445 RETURN();
448 void OPPROTO op_load_tbl (void)
450 T0 = cpu_ppc_load_tbl(env);
451 RETURN();
454 void OPPROTO op_load_tbu (void)
456 T0 = cpu_ppc_load_tbu(env);
457 RETURN();
460 void OPPROTO op_load_atbl (void)
462 T0 = cpu_ppc_load_atbl(env);
463 RETURN();
466 void OPPROTO op_load_atbu (void)
468 T0 = cpu_ppc_load_atbu(env);
469 RETURN();
472 #if !defined(CONFIG_USER_ONLY)
473 void OPPROTO op_store_tbl (void)
475 cpu_ppc_store_tbl(env, T0);
476 RETURN();
479 void OPPROTO op_store_tbu (void)
481 cpu_ppc_store_tbu(env, T0);
482 RETURN();
485 void OPPROTO op_store_atbl (void)
487 cpu_ppc_store_atbl(env, T0);
488 RETURN();
491 void OPPROTO op_store_atbu (void)
493 cpu_ppc_store_atbu(env, T0);
494 RETURN();
497 void OPPROTO op_load_decr (void)
499 T0 = cpu_ppc_load_decr(env);
500 RETURN();
503 void OPPROTO op_store_decr (void)
505 cpu_ppc_store_decr(env, T0);
506 RETURN();
509 void OPPROTO op_load_ibat (void)
511 T0 = env->IBAT[PARAM1][PARAM2];
512 RETURN();
515 void OPPROTO op_store_ibatu (void)
517 do_store_ibatu(env, PARAM1, T0);
518 RETURN();
521 void OPPROTO op_store_ibatl (void)
523 #if 1
524 env->IBAT[1][PARAM1] = T0;
525 #else
526 do_store_ibatl(env, PARAM1, T0);
527 #endif
528 RETURN();
531 void OPPROTO op_load_dbat (void)
533 T0 = env->DBAT[PARAM1][PARAM2];
534 RETURN();
537 void OPPROTO op_store_dbatu (void)
539 do_store_dbatu(env, PARAM1, T0);
540 RETURN();
543 void OPPROTO op_store_dbatl (void)
545 #if 1
546 env->DBAT[1][PARAM1] = T0;
547 #else
548 do_store_dbatl(env, PARAM1, T0);
549 #endif
550 RETURN();
552 #endif /* !defined(CONFIG_USER_ONLY) */
554 /* FPSCR */
555 #ifdef CONFIG_SOFTFLOAT
556 void OPPROTO op_reset_fpstatus (void)
558 env->fp_status.float_exception_flags = 0;
559 RETURN();
561 #endif
563 void OPPROTO op_compute_fprf (void)
565 do_compute_fprf(PARAM1);
566 RETURN();
569 #ifdef CONFIG_SOFTFLOAT
570 void OPPROTO op_float_check_status (void)
572 do_float_check_status();
573 RETURN();
575 #else
576 void OPPROTO op_float_check_status (void)
578 if (env->exception_index == POWERPC_EXCP_PROGRAM &&
579 (env->error_code & POWERPC_EXCP_FP)) {
580 /* Differred floating-point exception after target FPR update */
581 if (msr_fe0 != 0 || msr_fe1 != 0)
582 do_raise_exception_err(env->exception_index, env->error_code);
584 RETURN();
586 #endif
588 #if defined(WORDS_BIGENDIAN)
589 #define WORD0 0
590 #define WORD1 1
591 #else
592 #define WORD0 1
593 #define WORD1 0
594 #endif
595 void OPPROTO op_load_fpscr_FT0 (void)
597 /* The 32 MSB of the target fpr are undefined.
598 * They'll be zero...
600 union {
601 float64 d;
602 struct {
603 uint32_t u[2];
604 } s;
605 } u;
607 u.s.u[WORD0] = 0;
608 u.s.u[WORD1] = env->fpscr;
609 FT0 = u.d;
610 RETURN();
613 void OPPROTO op_set_FT0 (void)
615 union {
616 float64 d;
617 struct {
618 uint32_t u[2];
619 } s;
620 } u;
622 u.s.u[WORD0] = 0;
623 u.s.u[WORD1] = PARAM1;
624 FT0 = u.d;
625 RETURN();
627 #undef WORD0
628 #undef WORD1
630 void OPPROTO op_load_fpscr_T0 (void)
632 T0 = (env->fpscr >> PARAM1) & 0xF;
633 RETURN();
636 void OPPROTO op_load_fpcc (void)
638 T0 = fpscr_fpcc;
639 RETURN();
642 void OPPROTO op_fpscr_resetbit (void)
644 env->fpscr &= PARAM1;
645 RETURN();
648 void OPPROTO op_fpscr_setbit (void)
650 do_fpscr_setbit(PARAM1);
651 RETURN();
654 void OPPROTO op_store_fpscr (void)
656 do_store_fpscr(PARAM1);
657 RETURN();
660 /* Branch */
661 #define EIP env->nip
663 void OPPROTO op_setlr (void)
665 env->lr = (uint32_t)PARAM1;
666 RETURN();
669 #if defined (TARGET_PPC64)
670 void OPPROTO op_setlr_64 (void)
672 env->lr = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
673 RETURN();
675 #endif
677 void OPPROTO op_goto_tb0 (void)
679 GOTO_TB(op_goto_tb0, PARAM1, 0);
682 void OPPROTO op_goto_tb1 (void)
684 GOTO_TB(op_goto_tb1, PARAM1, 1);
687 void OPPROTO op_b_T1 (void)
689 env->nip = (uint32_t)(T1 & ~3);
690 RETURN();
693 #if defined (TARGET_PPC64)
694 void OPPROTO op_b_T1_64 (void)
696 env->nip = (uint64_t)(T1 & ~3);
697 RETURN();
699 #endif
701 void OPPROTO op_jz_T0 (void)
703 if (!T0)
704 GOTO_LABEL_PARAM(1);
705 RETURN();
708 void OPPROTO op_btest_T1 (void)
710 if (T0) {
711 env->nip = (uint32_t)(T1 & ~3);
712 } else {
713 env->nip = (uint32_t)PARAM1;
715 RETURN();
718 #if defined (TARGET_PPC64)
719 void OPPROTO op_btest_T1_64 (void)
721 if (T0) {
722 env->nip = (uint64_t)(T1 & ~3);
723 } else {
724 env->nip = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
726 RETURN();
728 #endif
730 void OPPROTO op_movl_T1_ctr (void)
732 T1 = env->ctr;
733 RETURN();
736 void OPPROTO op_movl_T1_lr (void)
738 T1 = env->lr;
739 RETURN();
742 /* tests with result in T0 */
743 void OPPROTO op_test_ctr (void)
745 T0 = (uint32_t)env->ctr;
746 RETURN();
749 #if defined(TARGET_PPC64)
750 void OPPROTO op_test_ctr_64 (void)
752 T0 = (uint64_t)env->ctr;
753 RETURN();
755 #endif
757 void OPPROTO op_test_ctr_true (void)
759 T0 = ((uint32_t)env->ctr != 0 && (T0 & PARAM1) != 0);
760 RETURN();
763 #if defined(TARGET_PPC64)
764 void OPPROTO op_test_ctr_true_64 (void)
766 T0 = ((uint64_t)env->ctr != 0 && (T0 & PARAM1) != 0);
767 RETURN();
769 #endif
771 void OPPROTO op_test_ctr_false (void)
773 T0 = ((uint32_t)env->ctr != 0 && (T0 & PARAM1) == 0);
774 RETURN();
777 #if defined(TARGET_PPC64)
778 void OPPROTO op_test_ctr_false_64 (void)
780 T0 = ((uint64_t)env->ctr != 0 && (T0 & PARAM1) == 0);
781 RETURN();
783 #endif
785 void OPPROTO op_test_ctrz (void)
787 T0 = ((uint32_t)env->ctr == 0);
788 RETURN();
791 #if defined(TARGET_PPC64)
792 void OPPROTO op_test_ctrz_64 (void)
794 T0 = ((uint64_t)env->ctr == 0);
795 RETURN();
797 #endif
799 void OPPROTO op_test_ctrz_true (void)
801 T0 = ((uint32_t)env->ctr == 0 && (T0 & PARAM1) != 0);
802 RETURN();
805 #if defined(TARGET_PPC64)
806 void OPPROTO op_test_ctrz_true_64 (void)
808 T0 = ((uint64_t)env->ctr == 0 && (T0 & PARAM1) != 0);
809 RETURN();
811 #endif
813 void OPPROTO op_test_ctrz_false (void)
815 T0 = ((uint32_t)env->ctr == 0 && (T0 & PARAM1) == 0);
816 RETURN();
819 #if defined(TARGET_PPC64)
820 void OPPROTO op_test_ctrz_false_64 (void)
822 T0 = ((uint64_t)env->ctr == 0 && (T0 & PARAM1) == 0);
823 RETURN();
825 #endif
827 void OPPROTO op_test_true (void)
829 T0 = (T0 & PARAM1);
830 RETURN();
833 void OPPROTO op_test_false (void)
835 T0 = ((T0 & PARAM1) == 0);
836 RETURN();
839 /* CTR maintenance */
840 void OPPROTO op_dec_ctr (void)
842 env->ctr--;
843 RETURN();
846 /*** Integer arithmetic ***/
847 /* add */
848 void OPPROTO op_add (void)
850 T0 += T1;
851 RETURN();
854 void OPPROTO op_check_addo (void)
856 xer_ov = (((uint32_t)T2 ^ (uint32_t)T1 ^ UINT32_MAX) &
857 ((uint32_t)T2 ^ (uint32_t)T0)) >> 31;
858 xer_so |= xer_ov;
859 RETURN();
862 #if defined(TARGET_PPC64)
863 void OPPROTO op_check_addo_64 (void)
865 xer_ov = (((uint64_t)T2 ^ (uint64_t)T1 ^ UINT64_MAX) &
866 ((uint64_t)T2 ^ (uint64_t)T0)) >> 63;
867 xer_so |= xer_ov;
868 RETURN();
870 #endif
872 /* add carrying */
873 void OPPROTO op_check_addc (void)
875 if (likely((uint32_t)T0 >= (uint32_t)T2)) {
876 xer_ca = 0;
877 } else {
878 xer_ca = 1;
880 RETURN();
883 #if defined(TARGET_PPC64)
884 void OPPROTO op_check_addc_64 (void)
886 if (likely((uint64_t)T0 >= (uint64_t)T2)) {
887 xer_ca = 0;
888 } else {
889 xer_ca = 1;
891 RETURN();
893 #endif
895 /* add extended */
896 void OPPROTO op_adde (void)
898 do_adde();
899 RETURN();
902 #if defined(TARGET_PPC64)
903 void OPPROTO op_adde_64 (void)
905 do_adde_64();
906 RETURN();
908 #endif
910 /* add immediate */
911 void OPPROTO op_addi (void)
913 T0 += (int32_t)PARAM1;
914 RETURN();
917 /* add to minus one extended */
918 void OPPROTO op_add_me (void)
920 T0 += xer_ca + (-1);
921 if (likely((uint32_t)T1 != 0))
922 xer_ca = 1;
923 else
924 xer_ca = 0;
925 RETURN();
928 #if defined(TARGET_PPC64)
929 void OPPROTO op_add_me_64 (void)
931 T0 += xer_ca + (-1);
932 if (likely((uint64_t)T1 != 0))
933 xer_ca = 1;
934 else
935 xer_ca = 0;
936 RETURN();
938 #endif
940 void OPPROTO op_addmeo (void)
942 do_addmeo();
943 RETURN();
946 void OPPROTO op_addmeo_64 (void)
948 do_addmeo();
949 RETURN();
952 /* add to zero extended */
953 void OPPROTO op_add_ze (void)
955 T0 += xer_ca;
956 RETURN();
959 /* divide word */
960 void OPPROTO op_divw (void)
962 if (unlikely(((int32_t)T0 == INT32_MIN && (int32_t)T1 == (int32_t)-1) ||
963 (int32_t)T1 == 0)) {
964 T0 = (int32_t)(UINT32_MAX * ((uint32_t)T0 >> 31));
965 } else {
966 T0 = (int32_t)T0 / (int32_t)T1;
968 RETURN();
971 #if defined(TARGET_PPC64)
972 void OPPROTO op_divd (void)
974 if (unlikely(((int64_t)T0 == INT64_MIN && (int64_t)T1 == (int64_t)-1LL) ||
975 (int64_t)T1 == 0)) {
976 T0 = (int64_t)(UINT64_MAX * ((uint64_t)T0 >> 63));
977 } else {
978 T0 = (int64_t)T0 / (int64_t)T1;
980 RETURN();
982 #endif
984 void OPPROTO op_divwo (void)
986 do_divwo();
987 RETURN();
990 #if defined(TARGET_PPC64)
991 void OPPROTO op_divdo (void)
993 do_divdo();
994 RETURN();
996 #endif
998 /* divide word unsigned */
999 void OPPROTO op_divwu (void)
1001 if (unlikely(T1 == 0)) {
1002 T0 = 0;
1003 } else {
1004 T0 = (uint32_t)T0 / (uint32_t)T1;
1006 RETURN();
1009 #if defined(TARGET_PPC64)
1010 void OPPROTO op_divdu (void)
1012 if (unlikely(T1 == 0)) {
1013 T0 = 0;
1014 } else {
1015 T0 /= T1;
1017 RETURN();
1019 #endif
1021 void OPPROTO op_divwuo (void)
1023 do_divwuo();
1024 RETURN();
1027 #if defined(TARGET_PPC64)
1028 void OPPROTO op_divduo (void)
1030 do_divduo();
1031 RETURN();
1033 #endif
1035 /* multiply high word */
1036 void OPPROTO op_mulhw (void)
1038 T0 = ((int64_t)((int32_t)T0) * (int64_t)((int32_t)T1)) >> 32;
1039 RETURN();
1042 #if defined(TARGET_PPC64)
1043 void OPPROTO op_mulhd (void)
1045 uint64_t tl, th;
1047 muls64(&tl, &th, T0, T1);
1048 T0 = th;
1049 RETURN();
1051 #endif
1053 /* multiply high word unsigned */
1054 void OPPROTO op_mulhwu (void)
1056 T0 = ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1) >> 32;
1057 RETURN();
1060 #if defined(TARGET_PPC64)
1061 void OPPROTO op_mulhdu (void)
1063 uint64_t tl, th;
1065 mulu64(&tl, &th, T0, T1);
1066 T0 = th;
1067 RETURN();
1069 #endif
1071 /* multiply low immediate */
1072 void OPPROTO op_mulli (void)
1074 T0 = ((int32_t)T0 * (int32_t)PARAM1);
1075 RETURN();
1078 /* multiply low word */
1079 void OPPROTO op_mullw (void)
1081 T0 = (int32_t)(T0 * T1);
1082 RETURN();
1085 #if defined(TARGET_PPC64)
1086 void OPPROTO op_mulld (void)
1088 T0 *= T1;
1089 RETURN();
1091 #endif
1093 void OPPROTO op_mullwo (void)
1095 do_mullwo();
1096 RETURN();
1099 #if defined(TARGET_PPC64)
1100 void OPPROTO op_mulldo (void)
1102 do_mulldo();
1103 RETURN();
1105 #endif
1107 /* negate */
1108 void OPPROTO op_neg (void)
1110 if (likely(T0 != INT32_MIN)) {
1111 T0 = -(int32_t)T0;
1113 RETURN();
1116 #if defined(TARGET_PPC64)
1117 void OPPROTO op_neg_64 (void)
1119 if (likely(T0 != INT64_MIN)) {
1120 T0 = -(int64_t)T0;
1122 RETURN();
1124 #endif
1126 void OPPROTO op_nego (void)
1128 do_nego();
1129 RETURN();
1132 #if defined(TARGET_PPC64)
1133 void OPPROTO op_nego_64 (void)
1135 do_nego_64();
1136 RETURN();
1138 #endif
1140 /* subtract from */
1141 void OPPROTO op_subf (void)
1143 T0 = T1 - T0;
1144 RETURN();
1147 /* subtract from carrying */
1148 void OPPROTO op_check_subfc (void)
1150 if (likely((uint32_t)T0 > (uint32_t)T1)) {
1151 xer_ca = 0;
1152 } else {
1153 xer_ca = 1;
1155 RETURN();
1158 #if defined(TARGET_PPC64)
1159 void OPPROTO op_check_subfc_64 (void)
1161 if (likely((uint64_t)T0 > (uint64_t)T1)) {
1162 xer_ca = 0;
1163 } else {
1164 xer_ca = 1;
1166 RETURN();
1168 #endif
1170 /* subtract from extended */
1171 void OPPROTO op_subfe (void)
1173 do_subfe();
1174 RETURN();
1177 #if defined(TARGET_PPC64)
1178 void OPPROTO op_subfe_64 (void)
1180 do_subfe_64();
1181 RETURN();
1183 #endif
1185 /* subtract from immediate carrying */
1186 void OPPROTO op_subfic (void)
1188 T0 = (int32_t)PARAM1 + ~T0 + 1;
1189 if ((uint32_t)T0 <= (uint32_t)PARAM1) {
1190 xer_ca = 1;
1191 } else {
1192 xer_ca = 0;
1194 RETURN();
1197 #if defined(TARGET_PPC64)
1198 void OPPROTO op_subfic_64 (void)
1200 T0 = (int64_t)PARAM1 + ~T0 + 1;
1201 if ((uint64_t)T0 <= (uint64_t)PARAM1) {
1202 xer_ca = 1;
1203 } else {
1204 xer_ca = 0;
1206 RETURN();
1208 #endif
1210 /* subtract from minus one extended */
1211 void OPPROTO op_subfme (void)
1213 T0 = ~T0 + xer_ca - 1;
1214 if (likely((uint32_t)T0 != UINT32_MAX))
1215 xer_ca = 1;
1216 else
1217 xer_ca = 0;
1218 RETURN();
1221 #if defined(TARGET_PPC64)
1222 void OPPROTO op_subfme_64 (void)
1224 T0 = ~T0 + xer_ca - 1;
1225 if (likely((uint64_t)T0 != UINT64_MAX))
1226 xer_ca = 1;
1227 else
1228 xer_ca = 0;
1229 RETURN();
1231 #endif
1233 void OPPROTO op_subfmeo (void)
1235 do_subfmeo();
1236 RETURN();
1239 #if defined(TARGET_PPC64)
1240 void OPPROTO op_subfmeo_64 (void)
1242 do_subfmeo_64();
1243 RETURN();
1245 #endif
1247 /* subtract from zero extended */
1248 void OPPROTO op_subfze (void)
1250 T1 = ~T0;
1251 T0 = T1 + xer_ca;
1252 if ((uint32_t)T0 < (uint32_t)T1) {
1253 xer_ca = 1;
1254 } else {
1255 xer_ca = 0;
1257 RETURN();
1260 #if defined(TARGET_PPC64)
1261 void OPPROTO op_subfze_64 (void)
1263 T1 = ~T0;
1264 T0 = T1 + xer_ca;
1265 if ((uint64_t)T0 < (uint64_t)T1) {
1266 xer_ca = 1;
1267 } else {
1268 xer_ca = 0;
1270 RETURN();
1272 #endif
1274 void OPPROTO op_subfzeo (void)
1276 do_subfzeo();
1277 RETURN();
1280 #if defined(TARGET_PPC64)
1281 void OPPROTO op_subfzeo_64 (void)
1283 do_subfzeo_64();
1284 RETURN();
1286 #endif
1288 /*** Integer comparison ***/
1289 /* compare */
1290 void OPPROTO op_cmp (void)
1292 if ((int32_t)T0 < (int32_t)T1) {
1293 T0 = 0x08;
1294 } else if ((int32_t)T0 > (int32_t)T1) {
1295 T0 = 0x04;
1296 } else {
1297 T0 = 0x02;
1299 T0 |= xer_so;
1300 RETURN();
1303 #if defined(TARGET_PPC64)
1304 void OPPROTO op_cmp_64 (void)
1306 if ((int64_t)T0 < (int64_t)T1) {
1307 T0 = 0x08;
1308 } else if ((int64_t)T0 > (int64_t)T1) {
1309 T0 = 0x04;
1310 } else {
1311 T0 = 0x02;
1313 T0 |= xer_so;
1314 RETURN();
1316 #endif
1318 /* compare immediate */
1319 void OPPROTO op_cmpi (void)
1321 if ((int32_t)T0 < (int32_t)PARAM1) {
1322 T0 = 0x08;
1323 } else if ((int32_t)T0 > (int32_t)PARAM1) {
1324 T0 = 0x04;
1325 } else {
1326 T0 = 0x02;
1328 T0 |= xer_so;
1329 RETURN();
1332 #if defined(TARGET_PPC64)
1333 void OPPROTO op_cmpi_64 (void)
1335 if ((int64_t)T0 < (int64_t)((int32_t)PARAM1)) {
1336 T0 = 0x08;
1337 } else if ((int64_t)T0 > (int64_t)((int32_t)PARAM1)) {
1338 T0 = 0x04;
1339 } else {
1340 T0 = 0x02;
1342 T0 |= xer_so;
1343 RETURN();
1345 #endif
1347 /* compare logical */
1348 void OPPROTO op_cmpl (void)
1350 if ((uint32_t)T0 < (uint32_t)T1) {
1351 T0 = 0x08;
1352 } else if ((uint32_t)T0 > (uint32_t)T1) {
1353 T0 = 0x04;
1354 } else {
1355 T0 = 0x02;
1357 T0 |= xer_so;
1358 RETURN();
1361 #if defined(TARGET_PPC64)
1362 void OPPROTO op_cmpl_64 (void)
1364 if ((uint64_t)T0 < (uint64_t)T1) {
1365 T0 = 0x08;
1366 } else if ((uint64_t)T0 > (uint64_t)T1) {
1367 T0 = 0x04;
1368 } else {
1369 T0 = 0x02;
1371 T0 |= xer_so;
1372 RETURN();
1374 #endif
1376 /* compare logical immediate */
1377 void OPPROTO op_cmpli (void)
1379 if ((uint32_t)T0 < (uint32_t)PARAM1) {
1380 T0 = 0x08;
1381 } else if ((uint32_t)T0 > (uint32_t)PARAM1) {
1382 T0 = 0x04;
1383 } else {
1384 T0 = 0x02;
1386 T0 |= xer_so;
1387 RETURN();
1390 #if defined(TARGET_PPC64)
1391 void OPPROTO op_cmpli_64 (void)
1393 if ((uint64_t)T0 < (uint64_t)PARAM1) {
1394 T0 = 0x08;
1395 } else if ((uint64_t)T0 > (uint64_t)PARAM1) {
1396 T0 = 0x04;
1397 } else {
1398 T0 = 0x02;
1400 T0 |= xer_so;
1401 RETURN();
1403 #endif
1405 void OPPROTO op_isel (void)
1407 if (T0)
1408 T0 = T1;
1409 else
1410 T0 = T2;
1411 RETURN();
1414 void OPPROTO op_popcntb (void)
1416 do_popcntb();
1417 RETURN();
1420 #if defined(TARGET_PPC64)
1421 void OPPROTO op_popcntb_64 (void)
1423 do_popcntb_64();
1424 RETURN();
1426 #endif
1428 /*** Integer logical ***/
1429 /* and */
1430 void OPPROTO op_and (void)
1432 T0 &= T1;
1433 RETURN();
1436 /* andc */
1437 void OPPROTO op_andc (void)
1439 T0 &= ~T1;
1440 RETURN();
1443 /* andi. */
1444 void OPPROTO op_andi_T0 (void)
1446 T0 &= (uint32_t)PARAM1;
1447 RETURN();
1450 void OPPROTO op_andi_T1 (void)
1452 T1 &= (uint32_t)PARAM1;
1453 RETURN();
1456 #if defined(TARGET_PPC64)
1457 void OPPROTO op_andi_T0_64 (void)
1459 T0 &= ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
1460 RETURN();
1463 void OPPROTO op_andi_T1_64 (void)
1465 T1 &= ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
1466 RETURN();
1468 #endif
1470 /* count leading zero */
1471 void OPPROTO op_cntlzw (void)
1473 do_cntlzw();
1474 RETURN();
1477 #if defined(TARGET_PPC64)
1478 void OPPROTO op_cntlzd (void)
1480 do_cntlzd();
1481 RETURN();
1483 #endif
1485 /* eqv */
1486 void OPPROTO op_eqv (void)
1488 T0 = ~(T0 ^ T1);
1489 RETURN();
1492 /* extend sign byte */
1493 void OPPROTO op_extsb (void)
1495 #if defined (TARGET_PPC64)
1496 T0 = (int64_t)((int8_t)T0);
1497 #else
1498 T0 = (int32_t)((int8_t)T0);
1499 #endif
1500 RETURN();
1503 /* extend sign half word */
1504 void OPPROTO op_extsh (void)
1506 #if defined (TARGET_PPC64)
1507 T0 = (int64_t)((int16_t)T0);
1508 #else
1509 T0 = (int32_t)((int16_t)T0);
1510 #endif
1511 RETURN();
1514 #if defined (TARGET_PPC64)
1515 void OPPROTO op_extsw (void)
1517 T0 = (int64_t)((int32_t)T0);
1518 RETURN();
1520 #endif
1522 /* nand */
1523 void OPPROTO op_nand (void)
1525 T0 = ~(T0 & T1);
1526 RETURN();
1529 /* nor */
1530 void OPPROTO op_nor (void)
1532 T0 = ~(T0 | T1);
1533 RETURN();
1536 /* or */
1537 void OPPROTO op_or (void)
1539 T0 |= T1;
1540 RETURN();
1543 /* orc */
1544 void OPPROTO op_orc (void)
1546 T0 |= ~T1;
1547 RETURN();
1550 /* ori */
1551 void OPPROTO op_ori (void)
1553 T0 |= (uint32_t)PARAM1;
1554 RETURN();
1557 /* xor */
1558 void OPPROTO op_xor (void)
1560 T0 ^= T1;
1561 RETURN();
1564 /* xori */
1565 void OPPROTO op_xori (void)
1567 T0 ^= (uint32_t)PARAM1;
1568 RETURN();
1571 /*** Integer rotate ***/
1572 void OPPROTO op_rotl32_T0_T1 (void)
1574 T0 = rotl32(T0, T1 & 0x1F);
1575 RETURN();
1578 void OPPROTO op_rotli32_T0 (void)
1580 T0 = rotl32(T0, PARAM1);
1581 RETURN();
1584 #if defined(TARGET_PPC64)
1585 void OPPROTO op_rotl64_T0_T1 (void)
1587 T0 = rotl64(T0, T1 & 0x3F);
1588 RETURN();
1591 void OPPROTO op_rotli64_T0 (void)
1593 T0 = rotl64(T0, PARAM1);
1594 RETURN();
1596 #endif
1598 /*** Integer shift ***/
1599 /* shift left word */
1600 void OPPROTO op_slw (void)
1602 if (T1 & 0x20) {
1603 T0 = 0;
1604 } else {
1605 T0 = (uint32_t)(T0 << T1);
1607 RETURN();
1610 #if defined(TARGET_PPC64)
1611 void OPPROTO op_sld (void)
1613 if (T1 & 0x40) {
1614 T0 = 0;
1615 } else {
1616 T0 = T0 << T1;
1618 RETURN();
1620 #endif
1622 /* shift right algebraic word */
1623 void OPPROTO op_sraw (void)
1625 do_sraw();
1626 RETURN();
1629 #if defined(TARGET_PPC64)
1630 void OPPROTO op_srad (void)
1632 do_srad();
1633 RETURN();
1635 #endif
1637 /* shift right algebraic word immediate */
1638 void OPPROTO op_srawi (void)
1640 uint32_t mask = (uint32_t)PARAM2;
1642 T0 = (int32_t)T0 >> PARAM1;
1643 if ((int32_t)T1 < 0 && (T1 & mask) != 0) {
1644 xer_ca = 1;
1645 } else {
1646 xer_ca = 0;
1648 RETURN();
1651 #if defined(TARGET_PPC64)
1652 void OPPROTO op_sradi (void)
1654 uint64_t mask = ((uint64_t)PARAM2 << 32) | (uint64_t)PARAM3;
1656 T0 = (int64_t)T0 >> PARAM1;
1657 if ((int64_t)T1 < 0 && ((uint64_t)T1 & mask) != 0) {
1658 xer_ca = 1;
1659 } else {
1660 xer_ca = 0;
1662 RETURN();
1664 #endif
1666 /* shift right word */
1667 void OPPROTO op_srw (void)
1669 if (T1 & 0x20) {
1670 T0 = 0;
1671 } else {
1672 T0 = (uint32_t)T0 >> T1;
1674 RETURN();
1677 #if defined(TARGET_PPC64)
1678 void OPPROTO op_srd (void)
1680 if (T1 & 0x40) {
1681 T0 = 0;
1682 } else {
1683 T0 = (uint64_t)T0 >> T1;
1685 RETURN();
1687 #endif
1689 void OPPROTO op_sl_T0_T1 (void)
1691 T0 = T0 << T1;
1692 RETURN();
1695 void OPPROTO op_sli_T0 (void)
1697 T0 = T0 << PARAM1;
1698 RETURN();
1701 void OPPROTO op_sli_T1 (void)
1703 T1 = T1 << PARAM1;
1704 RETURN();
1707 void OPPROTO op_srl_T0_T1 (void)
1709 T0 = (uint32_t)T0 >> T1;
1710 RETURN();
1713 #if defined(TARGET_PPC64)
1714 void OPPROTO op_srl_T0_T1_64 (void)
1716 T0 = (uint32_t)T0 >> T1;
1717 RETURN();
1719 #endif
1721 void OPPROTO op_srli_T0 (void)
1723 T0 = (uint32_t)T0 >> PARAM1;
1724 RETURN();
1727 #if defined(TARGET_PPC64)
1728 void OPPROTO op_srli_T0_64 (void)
1730 T0 = (uint64_t)T0 >> PARAM1;
1731 RETURN();
1733 #endif
1735 void OPPROTO op_srli_T1 (void)
1737 T1 = (uint32_t)T1 >> PARAM1;
1738 RETURN();
1741 #if defined(TARGET_PPC64)
1742 void OPPROTO op_srli_T1_64 (void)
1744 T1 = (uint64_t)T1 >> PARAM1;
1745 RETURN();
1747 #endif
1749 /*** Floating-Point arithmetic ***/
1750 /* fadd - fadd. */
1751 void OPPROTO op_fadd (void)
1753 #if USE_PRECISE_EMULATION
1754 do_fadd();
1755 #else
1756 FT0 = float64_add(FT0, FT1, &env->fp_status);
1757 #endif
1758 RETURN();
1761 /* fsub - fsub. */
1762 void OPPROTO op_fsub (void)
1764 #if USE_PRECISE_EMULATION
1765 do_fsub();
1766 #else
1767 FT0 = float64_sub(FT0, FT1, &env->fp_status);
1768 #endif
1769 RETURN();
1772 /* fmul - fmul. */
1773 void OPPROTO op_fmul (void)
1775 #if USE_PRECISE_EMULATION
1776 do_fmul();
1777 #else
1778 FT0 = float64_mul(FT0, FT1, &env->fp_status);
1779 #endif
1780 RETURN();
1783 /* fdiv - fdiv. */
1784 void OPPROTO op_fdiv (void)
1786 #if USE_PRECISE_EMULATION
1787 do_fdiv();
1788 #else
1789 FT0 = float64_div(FT0, FT1, &env->fp_status);
1790 #endif
1791 RETURN();
1794 /* fsqrt - fsqrt. */
1795 void OPPROTO op_fsqrt (void)
1797 do_fsqrt();
1798 RETURN();
1801 /* fre - fre. */
1802 void OPPROTO op_fre (void)
1804 do_fre();
1805 RETURN();
1808 /* fres - fres. */
1809 void OPPROTO op_fres (void)
1811 do_fres();
1812 RETURN();
1815 /* frsqrte - frsqrte. */
1816 void OPPROTO op_frsqrte (void)
1818 do_frsqrte();
1819 RETURN();
1822 /* fsel - fsel. */
1823 void OPPROTO op_fsel (void)
1825 do_fsel();
1826 RETURN();
1829 /*** Floating-Point multiply-and-add ***/
1830 /* fmadd - fmadd. */
1831 void OPPROTO op_fmadd (void)
1833 #if USE_PRECISE_EMULATION
1834 do_fmadd();
1835 #else
1836 FT0 = float64_mul(FT0, FT1, &env->fp_status);
1837 FT0 = float64_add(FT0, FT2, &env->fp_status);
1838 #endif
1839 RETURN();
1842 /* fmsub - fmsub. */
1843 void OPPROTO op_fmsub (void)
1845 #if USE_PRECISE_EMULATION
1846 do_fmsub();
1847 #else
1848 FT0 = float64_mul(FT0, FT1, &env->fp_status);
1849 FT0 = float64_sub(FT0, FT2, &env->fp_status);
1850 #endif
1851 RETURN();
1854 /* fnmadd - fnmadd. - fnmadds - fnmadds. */
1855 void OPPROTO op_fnmadd (void)
1857 do_fnmadd();
1858 RETURN();
1861 /* fnmsub - fnmsub. */
1862 void OPPROTO op_fnmsub (void)
1864 do_fnmsub();
1865 RETURN();
1868 /*** Floating-Point round & convert ***/
1869 /* frsp - frsp. */
1870 void OPPROTO op_frsp (void)
1872 #if USE_PRECISE_EMULATION
1873 do_frsp();
1874 #else
1875 FT0 = float64_to_float32(FT0, &env->fp_status);
1876 #endif
1877 RETURN();
1880 /* fctiw - fctiw. */
1881 void OPPROTO op_fctiw (void)
1883 do_fctiw();
1884 RETURN();
1887 /* fctiwz - fctiwz. */
1888 void OPPROTO op_fctiwz (void)
1890 do_fctiwz();
1891 RETURN();
1894 #if defined(TARGET_PPC64)
1895 /* fcfid - fcfid. */
1896 void OPPROTO op_fcfid (void)
1898 do_fcfid();
1899 RETURN();
1902 /* fctid - fctid. */
1903 void OPPROTO op_fctid (void)
1905 do_fctid();
1906 RETURN();
1909 /* fctidz - fctidz. */
1910 void OPPROTO op_fctidz (void)
1912 do_fctidz();
1913 RETURN();
1915 #endif
1917 void OPPROTO op_frin (void)
1919 do_frin();
1920 RETURN();
1923 void OPPROTO op_friz (void)
1925 do_friz();
1926 RETURN();
1929 void OPPROTO op_frip (void)
1931 do_frip();
1932 RETURN();
1935 void OPPROTO op_frim (void)
1937 do_frim();
1938 RETURN();
1941 /*** Floating-Point compare ***/
1942 /* fcmpu */
1943 void OPPROTO op_fcmpu (void)
1945 do_fcmpu();
1946 RETURN();
1949 /* fcmpo */
1950 void OPPROTO op_fcmpo (void)
1952 do_fcmpo();
1953 RETURN();
1956 /*** Floating-point move ***/
1957 /* fabs */
1958 void OPPROTO op_fabs (void)
1960 FT0 = float64_abs(FT0);
1961 RETURN();
1964 /* fnabs */
1965 void OPPROTO op_fnabs (void)
1967 FT0 = float64_abs(FT0);
1968 FT0 = float64_chs(FT0);
1969 RETURN();
1972 /* fneg */
1973 void OPPROTO op_fneg (void)
1975 FT0 = float64_chs(FT0);
1976 RETURN();
1979 /* Load and store */
1980 #define MEMSUFFIX _raw
1981 #include "op_helper.h"
1982 #include "op_mem.h"
1983 #if !defined(CONFIG_USER_ONLY)
1984 #define MEMSUFFIX _user
1985 #include "op_helper.h"
1986 #include "op_mem.h"
1987 #define MEMSUFFIX _kernel
1988 #include "op_helper.h"
1989 #include "op_mem.h"
1990 #define MEMSUFFIX _hypv
1991 #include "op_helper.h"
1992 #include "op_mem.h"
1993 #endif
1995 /* Special op to check and maybe clear reservation */
1996 void OPPROTO op_check_reservation (void)
1998 if ((uint32_t)env->reserve == (uint32_t)(T0 & ~0x00000003))
1999 env->reserve = (target_ulong)-1ULL;
2000 RETURN();
2003 #if defined(TARGET_PPC64)
2004 void OPPROTO op_check_reservation_64 (void)
2006 if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003))
2007 env->reserve = (target_ulong)-1ULL;
2008 RETURN();
2010 #endif
2012 void OPPROTO op_wait (void)
2014 env->halted = 1;
2015 RETURN();
2018 /* Return from interrupt */
2019 #if !defined(CONFIG_USER_ONLY)
2020 void OPPROTO op_rfi (void)
2022 do_rfi();
2023 RETURN();
2026 #if defined(TARGET_PPC64)
2027 void OPPROTO op_rfid (void)
2029 do_rfid();
2030 RETURN();
2033 void OPPROTO op_hrfid (void)
2035 do_hrfid();
2036 RETURN();
2038 #endif
2040 /* Exception vectors */
2041 void OPPROTO op_store_excp_prefix (void)
2043 T0 &= env->ivpr_mask;
2044 env->excp_prefix = T0;
2045 RETURN();
2048 void OPPROTO op_store_excp_vector (void)
2050 T0 &= env->ivor_mask;
2051 env->excp_vectors[PARAM1] = T0;
2052 RETURN();
2054 #endif
2056 /* Trap word */
2057 void OPPROTO op_tw (void)
2059 do_tw(PARAM1);
2060 RETURN();
2063 #if defined(TARGET_PPC64)
2064 void OPPROTO op_td (void)
2066 do_td(PARAM1);
2067 RETURN();
2069 #endif
2071 #if !defined(CONFIG_USER_ONLY)
2072 /* tlbia */
2073 void OPPROTO op_tlbia (void)
2075 ppc_tlb_invalidate_all(env);
2076 RETURN();
2079 /* tlbie */
2080 void OPPROTO op_tlbie (void)
2082 ppc_tlb_invalidate_one(env, (uint32_t)T0);
2083 RETURN();
2086 #if defined(TARGET_PPC64)
2087 void OPPROTO op_tlbie_64 (void)
2089 ppc_tlb_invalidate_one(env, T0);
2090 RETURN();
2092 #endif
2094 #if defined(TARGET_PPC64)
2095 void OPPROTO op_slbia (void)
2097 ppc_slb_invalidate_all(env);
2098 RETURN();
2101 void OPPROTO op_slbie (void)
2103 ppc_slb_invalidate_one(env, (uint32_t)T0);
2104 RETURN();
2107 void OPPROTO op_slbie_64 (void)
2109 ppc_slb_invalidate_one(env, T0);
2110 RETURN();
2112 #endif
2113 #endif
2115 #if !defined(CONFIG_USER_ONLY)
2116 /* PowerPC 602/603/755 software TLB load instructions */
2117 void OPPROTO op_6xx_tlbld (void)
2119 do_load_6xx_tlb(0);
2120 RETURN();
2123 void OPPROTO op_6xx_tlbli (void)
2125 do_load_6xx_tlb(1);
2126 RETURN();
2129 /* PowerPC 74xx software TLB load instructions */
2130 void OPPROTO op_74xx_tlbld (void)
2132 do_load_74xx_tlb(0);
2133 RETURN();
2136 void OPPROTO op_74xx_tlbli (void)
2138 do_load_74xx_tlb(1);
2139 RETURN();
2141 #endif
2143 /* 601 specific */
2144 void OPPROTO op_load_601_rtcl (void)
2146 T0 = cpu_ppc601_load_rtcl(env);
2147 RETURN();
2150 void OPPROTO op_load_601_rtcu (void)
2152 T0 = cpu_ppc601_load_rtcu(env);
2153 RETURN();
2156 #if !defined(CONFIG_USER_ONLY)
2157 void OPPROTO op_store_601_rtcl (void)
2159 cpu_ppc601_store_rtcl(env, T0);
2160 RETURN();
2163 void OPPROTO op_store_601_rtcu (void)
2165 cpu_ppc601_store_rtcu(env, T0);
2166 RETURN();
2169 void OPPROTO op_store_hid0_601 (void)
2171 do_store_hid0_601();
2172 RETURN();
2175 void OPPROTO op_load_601_bat (void)
2177 T0 = env->IBAT[PARAM1][PARAM2];
2178 RETURN();
2181 void OPPROTO op_store_601_batl (void)
2183 do_store_ibatl_601(env, PARAM1, T0);
2184 RETURN();
2187 void OPPROTO op_store_601_batu (void)
2189 do_store_ibatu_601(env, PARAM1, T0);
2190 RETURN();
2192 #endif /* !defined(CONFIG_USER_ONLY) */
2194 /* PowerPC 601 specific instructions (POWER bridge) */
2195 /* XXX: those micro-ops need tests ! */
2196 void OPPROTO op_POWER_abs (void)
2198 if ((int32_t)T0 == INT32_MIN)
2199 T0 = INT32_MAX;
2200 else if ((int32_t)T0 < 0)
2201 T0 = -T0;
2202 RETURN();
2205 void OPPROTO op_POWER_abso (void)
2207 do_POWER_abso();
2208 RETURN();
2211 void OPPROTO op_POWER_clcs (void)
2213 do_POWER_clcs();
2214 RETURN();
2217 void OPPROTO op_POWER_div (void)
2219 do_POWER_div();
2220 RETURN();
2223 void OPPROTO op_POWER_divo (void)
2225 do_POWER_divo();
2226 RETURN();
2229 void OPPROTO op_POWER_divs (void)
2231 do_POWER_divs();
2232 RETURN();
2235 void OPPROTO op_POWER_divso (void)
2237 do_POWER_divso();
2238 RETURN();
2241 void OPPROTO op_POWER_doz (void)
2243 if ((int32_t)T1 > (int32_t)T0)
2244 T0 = T1 - T0;
2245 else
2246 T0 = 0;
2247 RETURN();
2250 void OPPROTO op_POWER_dozo (void)
2252 do_POWER_dozo();
2253 RETURN();
2256 void OPPROTO op_load_xer_cmp (void)
2258 T2 = xer_cmp;
2259 RETURN();
2262 void OPPROTO op_POWER_maskg (void)
2264 do_POWER_maskg();
2265 RETURN();
2268 void OPPROTO op_POWER_maskir (void)
2270 T0 = (T0 & ~T2) | (T1 & T2);
2271 RETURN();
2274 void OPPROTO op_POWER_mul (void)
2276 uint64_t tmp;
2278 tmp = (uint64_t)T0 * (uint64_t)T1;
2279 env->spr[SPR_MQ] = tmp >> 32;
2280 T0 = tmp;
2281 RETURN();
2284 void OPPROTO op_POWER_mulo (void)
2286 do_POWER_mulo();
2287 RETURN();
2290 void OPPROTO op_POWER_nabs (void)
2292 if (T0 > 0)
2293 T0 = -T0;
2294 RETURN();
2297 void OPPROTO op_POWER_nabso (void)
2299 /* nabs never overflows */
2300 if (T0 > 0)
2301 T0 = -T0;
2302 xer_ov = 0;
2303 RETURN();
2306 /* XXX: factorise POWER rotates... */
2307 void OPPROTO op_POWER_rlmi (void)
2309 T0 = rotl32(T0, T2) & PARAM1;
2310 T0 |= T1 & (uint32_t)PARAM2;
2311 RETURN();
2314 void OPPROTO op_POWER_rrib (void)
2316 T2 &= 0x1FUL;
2317 T0 = rotl32(T0 & INT32_MIN, T2);
2318 T0 |= T1 & ~rotl32(INT32_MIN, T2);
2319 RETURN();
2322 void OPPROTO op_POWER_sle (void)
2324 T1 &= 0x1FUL;
2325 env->spr[SPR_MQ] = rotl32(T0, T1);
2326 T0 = T0 << T1;
2327 RETURN();
2330 void OPPROTO op_POWER_sleq (void)
2332 uint32_t tmp = env->spr[SPR_MQ];
2334 T1 &= 0x1FUL;
2335 env->spr[SPR_MQ] = rotl32(T0, T1);
2336 T0 = T0 << T1;
2337 T0 |= tmp >> (32 - T1);
2338 RETURN();
2341 void OPPROTO op_POWER_sllq (void)
2343 uint32_t msk = UINT32_MAX;
2345 msk = msk << (T1 & 0x1FUL);
2346 if (T1 & 0x20UL)
2347 msk = ~msk;
2348 T1 &= 0x1FUL;
2349 T0 = (T0 << T1) & msk;
2350 T0 |= env->spr[SPR_MQ] & ~msk;
2351 RETURN();
2354 void OPPROTO op_POWER_slq (void)
2356 uint32_t msk = UINT32_MAX, tmp;
2358 msk = msk << (T1 & 0x1FUL);
2359 if (T1 & 0x20UL)
2360 msk = ~msk;
2361 T1 &= 0x1FUL;
2362 tmp = rotl32(T0, T1);
2363 T0 = tmp & msk;
2364 env->spr[SPR_MQ] = tmp;
2365 RETURN();
2368 void OPPROTO op_POWER_sraq (void)
2370 env->spr[SPR_MQ] = rotl32(T0, 32 - (T1 & 0x1FUL));
2371 if (T1 & 0x20UL)
2372 T0 = UINT32_MAX;
2373 else
2374 T0 = (int32_t)T0 >> T1;
2375 RETURN();
2378 void OPPROTO op_POWER_sre (void)
2380 T1 &= 0x1FUL;
2381 env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
2382 T0 = (int32_t)T0 >> T1;
2383 RETURN();
2386 void OPPROTO op_POWER_srea (void)
2388 T1 &= 0x1FUL;
2389 env->spr[SPR_MQ] = T0 >> T1;
2390 T0 = (int32_t)T0 >> T1;
2391 RETURN();
2394 void OPPROTO op_POWER_sreq (void)
2396 uint32_t tmp;
2397 int32_t msk;
2399 T1 &= 0x1FUL;
2400 msk = INT32_MIN >> T1;
2401 tmp = env->spr[SPR_MQ];
2402 env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
2403 T0 = T0 >> T1;
2404 T0 |= tmp & msk;
2405 RETURN();
2408 void OPPROTO op_POWER_srlq (void)
2410 uint32_t tmp;
2411 int32_t msk;
2413 msk = INT32_MIN >> (T1 & 0x1FUL);
2414 if (T1 & 0x20UL)
2415 msk = ~msk;
2416 T1 &= 0x1FUL;
2417 tmp = env->spr[SPR_MQ];
2418 env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
2419 T0 = T0 >> T1;
2420 T0 &= msk;
2421 T0 |= tmp & ~msk;
2422 RETURN();
2425 void OPPROTO op_POWER_srq (void)
2427 T1 &= 0x1FUL;
2428 env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
2429 T0 = T0 >> T1;
2430 RETURN();
2433 /* POWER instructions not implemented in PowerPC 601 */
2434 #if !defined(CONFIG_USER_ONLY)
2435 void OPPROTO op_POWER_mfsri (void)
2437 T1 = T0 >> 28;
2438 T0 = env->sr[T1];
2439 RETURN();
2442 void OPPROTO op_POWER_rac (void)
2444 do_POWER_rac();
2445 RETURN();
2448 void OPPROTO op_POWER_rfsvc (void)
2450 do_POWER_rfsvc();
2451 RETURN();
2453 #endif
2455 /* PowerPC 602 specific instruction */
2456 #if !defined(CONFIG_USER_ONLY)
2457 void OPPROTO op_602_mfrom (void)
2459 do_op_602_mfrom();
2460 RETURN();
2462 #endif
2464 /* PowerPC 4xx specific micro-ops */
2465 void OPPROTO op_405_add_T0_T2 (void)
2467 T0 = (int32_t)T0 + (int32_t)T2;
2468 RETURN();
2471 void OPPROTO op_405_mulchw (void)
2473 T0 = ((int16_t)T0) * ((int16_t)(T1 >> 16));
2474 RETURN();
2477 void OPPROTO op_405_mulchwu (void)
2479 T0 = ((uint16_t)T0) * ((uint16_t)(T1 >> 16));
2480 RETURN();
2483 void OPPROTO op_405_mulhhw (void)
2485 T0 = ((int16_t)(T0 >> 16)) * ((int16_t)(T1 >> 16));
2486 RETURN();
2489 void OPPROTO op_405_mulhhwu (void)
2491 T0 = ((uint16_t)(T0 >> 16)) * ((uint16_t)(T1 >> 16));
2492 RETURN();
2495 void OPPROTO op_405_mullhw (void)
2497 T0 = ((int16_t)T0) * ((int16_t)T1);
2498 RETURN();
2501 void OPPROTO op_405_mullhwu (void)
2503 T0 = ((uint16_t)T0) * ((uint16_t)T1);
2504 RETURN();
2507 void OPPROTO op_405_check_sat (void)
2509 do_405_check_sat();
2510 RETURN();
2513 void OPPROTO op_405_check_ovu (void)
2515 if (likely(T0 >= T2)) {
2516 xer_ov = 0;
2517 } else {
2518 xer_ov = 1;
2519 xer_so = 1;
2521 RETURN();
2524 void OPPROTO op_405_check_satu (void)
2526 if (unlikely(T0 < T2)) {
2527 /* Saturate result */
2528 T0 = UINT32_MAX;
2530 RETURN();
2533 void OPPROTO op_load_dcr (void)
2535 do_load_dcr();
2536 RETURN();
2539 void OPPROTO op_store_dcr (void)
2541 do_store_dcr();
2542 RETURN();
2545 #if !defined(CONFIG_USER_ONLY)
2546 /* Return from critical interrupt :
2547 * same as rfi, except nip & MSR are loaded from SRR2/3 instead of SRR0/1
2549 void OPPROTO op_40x_rfci (void)
2551 do_40x_rfci();
2552 RETURN();
2555 void OPPROTO op_rfci (void)
2557 do_rfci();
2558 RETURN();
2561 void OPPROTO op_rfdi (void)
2563 do_rfdi();
2564 RETURN();
2567 void OPPROTO op_rfmci (void)
2569 do_rfmci();
2570 RETURN();
2573 void OPPROTO op_wrte (void)
2575 /* We don't call do_store_msr here as we won't trigger
2576 * any special case nor change hflags
2578 T0 &= 1 << MSR_EE;
2579 env->msr &= ~(1 << MSR_EE);
2580 env->msr |= T0;
2581 RETURN();
2584 void OPPROTO op_440_tlbre (void)
2586 do_440_tlbre(PARAM1);
2587 RETURN();
2590 void OPPROTO op_440_tlbsx (void)
2592 T0 = ppcemb_tlb_search(env, T0, env->spr[SPR_440_MMUCR] & 0xFF);
2593 RETURN();
2596 void OPPROTO op_4xx_tlbsx_check (void)
2598 int tmp;
2600 tmp = xer_so;
2601 if ((int)T0 != -1)
2602 tmp |= 0x02;
2603 env->crf[0] = tmp;
2604 RETURN();
2607 void OPPROTO op_440_tlbwe (void)
2609 do_440_tlbwe(PARAM1);
2610 RETURN();
2613 void OPPROTO op_4xx_tlbre_lo (void)
2615 do_4xx_tlbre_lo();
2616 RETURN();
2619 void OPPROTO op_4xx_tlbre_hi (void)
2621 do_4xx_tlbre_hi();
2622 RETURN();
2625 void OPPROTO op_4xx_tlbsx (void)
2627 T0 = ppcemb_tlb_search(env, T0, env->spr[SPR_40x_PID]);
2628 RETURN();
2631 void OPPROTO op_4xx_tlbwe_lo (void)
2633 do_4xx_tlbwe_lo();
2634 RETURN();
2637 void OPPROTO op_4xx_tlbwe_hi (void)
2639 do_4xx_tlbwe_hi();
2640 RETURN();
2642 #endif
2644 /* SPR micro-ops */
2645 /* 440 specific */
2646 void OPPROTO op_440_dlmzb (void)
2648 do_440_dlmzb();
2649 RETURN();
2652 void OPPROTO op_440_dlmzb_update_Rc (void)
2654 if (T0 == 8)
2655 T0 = 0x2;
2656 else if (T0 < 4)
2657 T0 = 0x4;
2658 else
2659 T0 = 0x8;
2660 RETURN();
2663 #if !defined(CONFIG_USER_ONLY)
2664 void OPPROTO op_store_pir (void)
2666 env->spr[SPR_PIR] = T0 & 0x0000000FUL;
2667 RETURN();
2670 void OPPROTO op_load_403_pb (void)
2672 do_load_403_pb(PARAM1);
2673 RETURN();
2676 void OPPROTO op_store_403_pb (void)
2678 do_store_403_pb(PARAM1);
2679 RETURN();
2682 void OPPROTO op_load_40x_pit (void)
2684 T0 = load_40x_pit(env);
2685 RETURN();
2688 void OPPROTO op_store_40x_pit (void)
2690 store_40x_pit(env, T0);
2691 RETURN();
2694 void OPPROTO op_store_40x_dbcr0 (void)
2696 store_40x_dbcr0(env, T0);
2697 RETURN();
2700 void OPPROTO op_store_40x_sler (void)
2702 store_40x_sler(env, T0);
2703 RETURN();
2706 void OPPROTO op_store_booke_tcr (void)
2708 store_booke_tcr(env, T0);
2709 RETURN();
2712 void OPPROTO op_store_booke_tsr (void)
2714 store_booke_tsr(env, T0);
2715 RETURN();
2717 #endif /* !defined(CONFIG_USER_ONLY) */
2719 /* SPE extension */
2720 void OPPROTO op_splatw_T1_64 (void)
2722 T1_64 = (T1_64 << 32) | (T1_64 & 0x00000000FFFFFFFFULL);
2723 RETURN();
2726 void OPPROTO op_splatwi_T0_64 (void)
2728 uint64_t tmp = PARAM1;
2730 T0_64 = (tmp << 32) | tmp;
2731 RETURN();
2734 void OPPROTO op_splatwi_T1_64 (void)
2736 uint64_t tmp = PARAM1;
2738 T1_64 = (tmp << 32) | tmp;
2739 RETURN();
2742 void OPPROTO op_extsh_T1_64 (void)
2744 T1_64 = (int32_t)((int16_t)T1_64);
2745 RETURN();
2748 void OPPROTO op_sli16_T1_64 (void)
2750 T1_64 = T1_64 << 16;
2751 RETURN();
2754 void OPPROTO op_sli32_T1_64 (void)
2756 T1_64 = T1_64 << 32;
2757 RETURN();
2760 void OPPROTO op_srli32_T1_64 (void)
2762 T1_64 = T1_64 >> 32;
2763 RETURN();
2766 void OPPROTO op_evsel (void)
2768 do_evsel();
2769 RETURN();
2772 void OPPROTO op_evaddw (void)
2774 do_evaddw();
2775 RETURN();
2778 void OPPROTO op_evsubfw (void)
2780 do_evsubfw();
2781 RETURN();
2784 void OPPROTO op_evneg (void)
2786 do_evneg();
2787 RETURN();
2790 void OPPROTO op_evabs (void)
2792 do_evabs();
2793 RETURN();
2796 void OPPROTO op_evextsh (void)
2798 T0_64 = ((uint64_t)((int32_t)(int16_t)(T0_64 >> 32)) << 32) |
2799 (uint64_t)((int32_t)(int16_t)T0_64);
2800 RETURN();
2803 void OPPROTO op_evextsb (void)
2805 T0_64 = ((uint64_t)((int32_t)(int8_t)(T0_64 >> 32)) << 32) |
2806 (uint64_t)((int32_t)(int8_t)T0_64);
2807 RETURN();
2810 void OPPROTO op_evcntlzw (void)
2812 do_evcntlzw();
2813 RETURN();
2816 void OPPROTO op_evrndw (void)
2818 do_evrndw();
2819 RETURN();
2822 void OPPROTO op_brinc (void)
2824 do_brinc();
2825 RETURN();
2828 void OPPROTO op_evcntlsw (void)
2830 do_evcntlsw();
2831 RETURN();
2834 void OPPROTO op_evand (void)
2836 T0_64 &= T1_64;
2837 RETURN();
2840 void OPPROTO op_evandc (void)
2842 T0_64 &= ~T1_64;
2843 RETURN();
2846 void OPPROTO op_evor (void)
2848 T0_64 |= T1_64;
2849 RETURN();
2852 void OPPROTO op_evxor (void)
2854 T0_64 ^= T1_64;
2855 RETURN();
2858 void OPPROTO op_eveqv (void)
2860 T0_64 = ~(T0_64 ^ T1_64);
2861 RETURN();
2864 void OPPROTO op_evnor (void)
2866 T0_64 = ~(T0_64 | T1_64);
2867 RETURN();
2870 void OPPROTO op_evorc (void)
2872 T0_64 |= ~T1_64;
2873 RETURN();
2876 void OPPROTO op_evnand (void)
2878 T0_64 = ~(T0_64 & T1_64);
2879 RETURN();
2882 void OPPROTO op_evsrws (void)
2884 do_evsrws();
2885 RETURN();
2888 void OPPROTO op_evsrwu (void)
2890 do_evsrwu();
2891 RETURN();
2894 void OPPROTO op_evslw (void)
2896 do_evslw();
2897 RETURN();
2900 void OPPROTO op_evrlw (void)
2902 do_evrlw();
2903 RETURN();
2906 void OPPROTO op_evmergelo (void)
2908 T0_64 = (T0_64 << 32) | (T1_64 & 0x00000000FFFFFFFFULL);
2909 RETURN();
2912 void OPPROTO op_evmergehi (void)
2914 T0_64 = (T0_64 & 0xFFFFFFFF00000000ULL) | (T1_64 >> 32);
2915 RETURN();
2918 void OPPROTO op_evmergelohi (void)
2920 T0_64 = (T0_64 << 32) | (T1_64 >> 32);
2921 RETURN();
2924 void OPPROTO op_evmergehilo (void)
2926 T0_64 = (T0_64 & 0xFFFFFFFF00000000ULL) | (T1_64 & 0x00000000FFFFFFFFULL);
2927 RETURN();
2930 void OPPROTO op_evcmpgts (void)
2932 do_evcmpgts();
2933 RETURN();
2936 void OPPROTO op_evcmpgtu (void)
2938 do_evcmpgtu();
2939 RETURN();
2942 void OPPROTO op_evcmplts (void)
2944 do_evcmplts();
2945 RETURN();
2948 void OPPROTO op_evcmpltu (void)
2950 do_evcmpltu();
2951 RETURN();
2954 void OPPROTO op_evcmpeq (void)
2956 do_evcmpeq();
2957 RETURN();
2960 void OPPROTO op_evfssub (void)
2962 do_evfssub();
2963 RETURN();
2966 void OPPROTO op_evfsadd (void)
2968 do_evfsadd();
2969 RETURN();
2972 void OPPROTO op_evfsnabs (void)
2974 do_evfsnabs();
2975 RETURN();
2978 void OPPROTO op_evfsabs (void)
2980 do_evfsabs();
2981 RETURN();
2984 void OPPROTO op_evfsneg (void)
2986 do_evfsneg();
2987 RETURN();
2990 void OPPROTO op_evfsdiv (void)
2992 do_evfsdiv();
2993 RETURN();
2996 void OPPROTO op_evfsmul (void)
2998 do_evfsmul();
2999 RETURN();
3002 void OPPROTO op_evfscmplt (void)
3004 do_evfscmplt();
3005 RETURN();
3008 void OPPROTO op_evfscmpgt (void)
3010 do_evfscmpgt();
3011 RETURN();
3014 void OPPROTO op_evfscmpeq (void)
3016 do_evfscmpeq();
3017 RETURN();
3020 void OPPROTO op_evfscfsi (void)
3022 do_evfscfsi();
3023 RETURN();
3026 void OPPROTO op_evfscfui (void)
3028 do_evfscfui();
3029 RETURN();
3032 void OPPROTO op_evfscfsf (void)
3034 do_evfscfsf();
3035 RETURN();
3038 void OPPROTO op_evfscfuf (void)
3040 do_evfscfuf();
3041 RETURN();
3044 void OPPROTO op_evfsctsi (void)
3046 do_evfsctsi();
3047 RETURN();
3050 void OPPROTO op_evfsctui (void)
3052 do_evfsctui();
3053 RETURN();
3056 void OPPROTO op_evfsctsf (void)
3058 do_evfsctsf();
3059 RETURN();
3062 void OPPROTO op_evfsctuf (void)
3064 do_evfsctuf();
3065 RETURN();
3068 void OPPROTO op_evfsctuiz (void)
3070 do_evfsctuiz();
3071 RETURN();
3074 void OPPROTO op_evfsctsiz (void)
3076 do_evfsctsiz();
3077 RETURN();
3080 void OPPROTO op_evfststlt (void)
3082 do_evfststlt();
3083 RETURN();
3086 void OPPROTO op_evfststgt (void)
3088 do_evfststgt();
3089 RETURN();
3092 void OPPROTO op_evfststeq (void)
3094 do_evfststeq();
3095 RETURN();
3098 void OPPROTO op_efssub (void)
3100 T0_64 = _do_efssub(T0_64, T1_64);
3101 RETURN();
3104 void OPPROTO op_efsadd (void)
3106 T0_64 = _do_efsadd(T0_64, T1_64);
3107 RETURN();
3110 void OPPROTO op_efsnabs (void)
3112 T0_64 = _do_efsnabs(T0_64);
3113 RETURN();
3116 void OPPROTO op_efsabs (void)
3118 T0_64 = _do_efsabs(T0_64);
3119 RETURN();
3122 void OPPROTO op_efsneg (void)
3124 T0_64 = _do_efsneg(T0_64);
3125 RETURN();
3128 void OPPROTO op_efsdiv (void)
3130 T0_64 = _do_efsdiv(T0_64, T1_64);
3131 RETURN();
3134 void OPPROTO op_efsmul (void)
3136 T0_64 = _do_efsmul(T0_64, T1_64);
3137 RETURN();
3140 void OPPROTO op_efscmplt (void)
3142 do_efscmplt();
3143 RETURN();
3146 void OPPROTO op_efscmpgt (void)
3148 do_efscmpgt();
3149 RETURN();
3152 void OPPROTO op_efscfd (void)
3154 do_efscfd();
3155 RETURN();
3158 void OPPROTO op_efscmpeq (void)
3160 do_efscmpeq();
3161 RETURN();
3164 void OPPROTO op_efscfsi (void)
3166 do_efscfsi();
3167 RETURN();
3170 void OPPROTO op_efscfui (void)
3172 do_efscfui();
3173 RETURN();
3176 void OPPROTO op_efscfsf (void)
3178 do_efscfsf();
3179 RETURN();
3182 void OPPROTO op_efscfuf (void)
3184 do_efscfuf();
3185 RETURN();
3188 void OPPROTO op_efsctsi (void)
3190 do_efsctsi();
3191 RETURN();
3194 void OPPROTO op_efsctui (void)
3196 do_efsctui();
3197 RETURN();
3200 void OPPROTO op_efsctsf (void)
3202 do_efsctsf();
3203 RETURN();
3206 void OPPROTO op_efsctuf (void)
3208 do_efsctuf();
3209 RETURN();
3212 void OPPROTO op_efsctsiz (void)
3214 do_efsctsiz();
3215 RETURN();
3218 void OPPROTO op_efsctuiz (void)
3220 do_efsctuiz();
3221 RETURN();
3224 void OPPROTO op_efststlt (void)
3226 T0 = _do_efststlt(T0_64, T1_64);
3227 RETURN();
3230 void OPPROTO op_efststgt (void)
3232 T0 = _do_efststgt(T0_64, T1_64);
3233 RETURN();
3236 void OPPROTO op_efststeq (void)
3238 T0 = _do_efststeq(T0_64, T1_64);
3239 RETURN();
3242 void OPPROTO op_efdsub (void)
3244 union {
3245 uint64_t u;
3246 float64 f;
3247 } u1, u2;
3248 u1.u = T0_64;
3249 u2.u = T1_64;
3250 u1.f = float64_sub(u1.f, u2.f, &env->spe_status);
3251 T0_64 = u1.u;
3252 RETURN();
3255 void OPPROTO op_efdadd (void)
3257 union {
3258 uint64_t u;
3259 float64 f;
3260 } u1, u2;
3261 u1.u = T0_64;
3262 u2.u = T1_64;
3263 u1.f = float64_add(u1.f, u2.f, &env->spe_status);
3264 T0_64 = u1.u;
3265 RETURN();
3268 void OPPROTO op_efdcfsid (void)
3270 do_efdcfsi();
3271 RETURN();
3274 void OPPROTO op_efdcfuid (void)
3276 do_efdcfui();
3277 RETURN();
3280 void OPPROTO op_efdnabs (void)
3282 T0_64 |= 0x8000000000000000ULL;
3283 RETURN();
3286 void OPPROTO op_efdabs (void)
3288 T0_64 &= ~0x8000000000000000ULL;
3289 RETURN();
3292 void OPPROTO op_efdneg (void)
3294 T0_64 ^= 0x8000000000000000ULL;
3295 RETURN();
3298 void OPPROTO op_efddiv (void)
3300 union {
3301 uint64_t u;
3302 float64 f;
3303 } u1, u2;
3304 u1.u = T0_64;
3305 u2.u = T1_64;
3306 u1.f = float64_div(u1.f, u2.f, &env->spe_status);
3307 T0_64 = u1.u;
3308 RETURN();
3311 void OPPROTO op_efdmul (void)
3313 union {
3314 uint64_t u;
3315 float64 f;
3316 } u1, u2;
3317 u1.u = T0_64;
3318 u2.u = T1_64;
3319 u1.f = float64_mul(u1.f, u2.f, &env->spe_status);
3320 T0_64 = u1.u;
3321 RETURN();
3324 void OPPROTO op_efdctsidz (void)
3326 do_efdctsiz();
3327 RETURN();
3330 void OPPROTO op_efdctuidz (void)
3332 do_efdctuiz();
3333 RETURN();
3336 void OPPROTO op_efdcmplt (void)
3338 do_efdcmplt();
3339 RETURN();
3342 void OPPROTO op_efdcmpgt (void)
3344 do_efdcmpgt();
3345 RETURN();
3348 void OPPROTO op_efdcfs (void)
3350 do_efdcfs();
3351 RETURN();
3354 void OPPROTO op_efdcmpeq (void)
3356 do_efdcmpeq();
3357 RETURN();
3360 void OPPROTO op_efdcfsi (void)
3362 do_efdcfsi();
3363 RETURN();
3366 void OPPROTO op_efdcfui (void)
3368 do_efdcfui();
3369 RETURN();
3372 void OPPROTO op_efdcfsf (void)
3374 do_efdcfsf();
3375 RETURN();
3378 void OPPROTO op_efdcfuf (void)
3380 do_efdcfuf();
3381 RETURN();
3384 void OPPROTO op_efdctsi (void)
3386 do_efdctsi();
3387 RETURN();
3390 void OPPROTO op_efdctui (void)
3392 do_efdctui();
3393 RETURN();
3396 void OPPROTO op_efdctsf (void)
3398 do_efdctsf();
3399 RETURN();
3402 void OPPROTO op_efdctuf (void)
3404 do_efdctuf();
3405 RETURN();
3408 void OPPROTO op_efdctuiz (void)
3410 do_efdctuiz();
3411 RETURN();
3414 void OPPROTO op_efdctsiz (void)
3416 do_efdctsiz();
3417 RETURN();
3420 void OPPROTO op_efdtstlt (void)
3422 T0 = _do_efdtstlt(T0_64, T1_64);
3423 RETURN();
3426 void OPPROTO op_efdtstgt (void)
3428 T0 = _do_efdtstgt(T0_64, T1_64);
3429 RETURN();
3432 void OPPROTO op_efdtsteq (void)
3434 T0 = _do_efdtsteq(T0_64, T1_64);
3435 RETURN();