Commit e1571908a28b1707f63392541be30990160af31c
1 parent
bdffd4a9
target-ppc: convert crf related instructions to TCG
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5505 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
291 additions
and
383 deletions
target-ppc/cpu.h
@@ -829,7 +829,13 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) | @@ -829,7 +829,13 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) | ||
829 | #include "cpu-all.h" | 829 | #include "cpu-all.h" |
830 | 830 | ||
831 | /*****************************************************************************/ | 831 | /*****************************************************************************/ |
832 | -/* Registers definitions */ | 832 | +/* CRF definitions */ |
833 | +#define CRF_LT 3 | ||
834 | +#define CRF_GT 2 | ||
835 | +#define CRF_EQ 1 | ||
836 | +#define CRF_SO 0 | ||
837 | + | ||
838 | +/* XER definitions */ | ||
833 | #define XER_SO 31 | 839 | #define XER_SO 31 |
834 | #define XER_OV 30 | 840 | #define XER_OV 30 |
835 | #define XER_CA 29 | 841 | #define XER_CA 29 |
target-ppc/helper.h
@@ -2,3 +2,8 @@ | @@ -2,3 +2,8 @@ | ||
2 | #define DEF_HELPER(ret, name, params) ret name params; | 2 | #define DEF_HELPER(ret, name, params) ret name params; |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | +DEF_HELPER(uint32_t, helper_fcmpo, (void)) | ||
6 | +DEF_HELPER(uint32_t, helper_fcmpu, (void)) | ||
7 | + | ||
8 | +DEF_HELPER(uint32_t, helper_load_cr, (void)) | ||
9 | +DEF_HELPER(void, helper_store_cr, (target_ulong, uint32_t)) |
target-ppc/op.c
@@ -26,14 +26,6 @@ | @@ -26,14 +26,6 @@ | ||
26 | #include "helper_regs.h" | 26 | #include "helper_regs.h" |
27 | #include "op_helper.h" | 27 | #include "op_helper.h" |
28 | 28 | ||
29 | -/* PowerPC state maintenance operations */ | ||
30 | -/* set_Rc0 */ | ||
31 | -void OPPROTO op_set_Rc0 (void) | ||
32 | -{ | ||
33 | - env->crf[0] = T0 | xer_so; | ||
34 | - RETURN(); | ||
35 | -} | ||
36 | - | ||
37 | /* Generate exceptions */ | 29 | /* Generate exceptions */ |
38 | void OPPROTO op_raise_exception_err (void) | 30 | void OPPROTO op_raise_exception_err (void) |
39 | { | 31 | { |
@@ -46,18 +38,6 @@ void OPPROTO op_debug (void) | @@ -46,18 +38,6 @@ void OPPROTO op_debug (void) | ||
46 | } | 38 | } |
47 | 39 | ||
48 | /* Load/store special registers */ | 40 | /* Load/store special registers */ |
49 | -void OPPROTO op_load_cr (void) | ||
50 | -{ | ||
51 | - do_load_cr(); | ||
52 | - RETURN(); | ||
53 | -} | ||
54 | - | ||
55 | -void OPPROTO op_store_cr (void) | ||
56 | -{ | ||
57 | - do_store_cr(PARAM1); | ||
58 | - RETURN(); | ||
59 | -} | ||
60 | - | ||
61 | #if defined(TARGET_PPC64) | 41 | #if defined(TARGET_PPC64) |
62 | void OPPROTO op_store_pri (void) | 42 | void OPPROTO op_store_pri (void) |
63 | { | 43 | { |
@@ -337,18 +317,6 @@ void OPPROTO op_load_fpscr_FT0 (void) | @@ -337,18 +317,6 @@ void OPPROTO op_load_fpscr_FT0 (void) | ||
337 | RETURN(); | 317 | RETURN(); |
338 | } | 318 | } |
339 | 319 | ||
340 | -void OPPROTO op_load_fpscr_T0 (void) | ||
341 | -{ | ||
342 | - T0 = (env->fpscr >> PARAM1) & 0xF; | ||
343 | - RETURN(); | ||
344 | -} | ||
345 | - | ||
346 | -void OPPROTO op_load_fpcc (void) | ||
347 | -{ | ||
348 | - T0 = fpscr_fpcc; | ||
349 | - RETURN(); | ||
350 | -} | ||
351 | - | ||
352 | void OPPROTO op_fpscr_resetbit (void) | 320 | void OPPROTO op_fpscr_resetbit (void) |
353 | { | 321 | { |
354 | env->fpscr &= PARAM1; | 322 | env->fpscr &= PARAM1; |
@@ -953,132 +921,6 @@ void OPPROTO op_subfzeo_64 (void) | @@ -953,132 +921,6 @@ void OPPROTO op_subfzeo_64 (void) | ||
953 | } | 921 | } |
954 | #endif | 922 | #endif |
955 | 923 | ||
956 | -/*** Integer comparison ***/ | ||
957 | -/* compare */ | ||
958 | -void OPPROTO op_cmp (void) | ||
959 | -{ | ||
960 | - if ((int32_t)T0 < (int32_t)T1) { | ||
961 | - T0 = 0x08; | ||
962 | - } else if ((int32_t)T0 > (int32_t)T1) { | ||
963 | - T0 = 0x04; | ||
964 | - } else { | ||
965 | - T0 = 0x02; | ||
966 | - } | ||
967 | - T0 |= xer_so; | ||
968 | - RETURN(); | ||
969 | -} | ||
970 | - | ||
971 | -#if defined(TARGET_PPC64) | ||
972 | -void OPPROTO op_cmp_64 (void) | ||
973 | -{ | ||
974 | - if ((int64_t)T0 < (int64_t)T1) { | ||
975 | - T0 = 0x08; | ||
976 | - } else if ((int64_t)T0 > (int64_t)T1) { | ||
977 | - T0 = 0x04; | ||
978 | - } else { | ||
979 | - T0 = 0x02; | ||
980 | - } | ||
981 | - T0 |= xer_so; | ||
982 | - RETURN(); | ||
983 | -} | ||
984 | -#endif | ||
985 | - | ||
986 | -/* compare immediate */ | ||
987 | -void OPPROTO op_cmpi (void) | ||
988 | -{ | ||
989 | - if ((int32_t)T0 < (int32_t)PARAM1) { | ||
990 | - T0 = 0x08; | ||
991 | - } else if ((int32_t)T0 > (int32_t)PARAM1) { | ||
992 | - T0 = 0x04; | ||
993 | - } else { | ||
994 | - T0 = 0x02; | ||
995 | - } | ||
996 | - T0 |= xer_so; | ||
997 | - RETURN(); | ||
998 | -} | ||
999 | - | ||
1000 | -#if defined(TARGET_PPC64) | ||
1001 | -void OPPROTO op_cmpi_64 (void) | ||
1002 | -{ | ||
1003 | - if ((int64_t)T0 < (int64_t)((int32_t)PARAM1)) { | ||
1004 | - T0 = 0x08; | ||
1005 | - } else if ((int64_t)T0 > (int64_t)((int32_t)PARAM1)) { | ||
1006 | - T0 = 0x04; | ||
1007 | - } else { | ||
1008 | - T0 = 0x02; | ||
1009 | - } | ||
1010 | - T0 |= xer_so; | ||
1011 | - RETURN(); | ||
1012 | -} | ||
1013 | -#endif | ||
1014 | - | ||
1015 | -/* compare logical */ | ||
1016 | -void OPPROTO op_cmpl (void) | ||
1017 | -{ | ||
1018 | - if ((uint32_t)T0 < (uint32_t)T1) { | ||
1019 | - T0 = 0x08; | ||
1020 | - } else if ((uint32_t)T0 > (uint32_t)T1) { | ||
1021 | - T0 = 0x04; | ||
1022 | - } else { | ||
1023 | - T0 = 0x02; | ||
1024 | - } | ||
1025 | - T0 |= xer_so; | ||
1026 | - RETURN(); | ||
1027 | -} | ||
1028 | - | ||
1029 | -#if defined(TARGET_PPC64) | ||
1030 | -void OPPROTO op_cmpl_64 (void) | ||
1031 | -{ | ||
1032 | - if ((uint64_t)T0 < (uint64_t)T1) { | ||
1033 | - T0 = 0x08; | ||
1034 | - } else if ((uint64_t)T0 > (uint64_t)T1) { | ||
1035 | - T0 = 0x04; | ||
1036 | - } else { | ||
1037 | - T0 = 0x02; | ||
1038 | - } | ||
1039 | - T0 |= xer_so; | ||
1040 | - RETURN(); | ||
1041 | -} | ||
1042 | -#endif | ||
1043 | - | ||
1044 | -/* compare logical immediate */ | ||
1045 | -void OPPROTO op_cmpli (void) | ||
1046 | -{ | ||
1047 | - if ((uint32_t)T0 < (uint32_t)PARAM1) { | ||
1048 | - T0 = 0x08; | ||
1049 | - } else if ((uint32_t)T0 > (uint32_t)PARAM1) { | ||
1050 | - T0 = 0x04; | ||
1051 | - } else { | ||
1052 | - T0 = 0x02; | ||
1053 | - } | ||
1054 | - T0 |= xer_so; | ||
1055 | - RETURN(); | ||
1056 | -} | ||
1057 | - | ||
1058 | -#if defined(TARGET_PPC64) | ||
1059 | -void OPPROTO op_cmpli_64 (void) | ||
1060 | -{ | ||
1061 | - if ((uint64_t)T0 < (uint64_t)PARAM1) { | ||
1062 | - T0 = 0x08; | ||
1063 | - } else if ((uint64_t)T0 > (uint64_t)PARAM1) { | ||
1064 | - T0 = 0x04; | ||
1065 | - } else { | ||
1066 | - T0 = 0x02; | ||
1067 | - } | ||
1068 | - T0 |= xer_so; | ||
1069 | - RETURN(); | ||
1070 | -} | ||
1071 | -#endif | ||
1072 | - | ||
1073 | -void OPPROTO op_isel (void) | ||
1074 | -{ | ||
1075 | - if (T0) | ||
1076 | - T0 = T1; | ||
1077 | - else | ||
1078 | - T0 = T2; | ||
1079 | - RETURN(); | ||
1080 | -} | ||
1081 | - | ||
1082 | void OPPROTO op_popcntb (void) | 924 | void OPPROTO op_popcntb (void) |
1083 | { | 925 | { |
1084 | do_popcntb(); | 926 | do_popcntb(); |
@@ -1339,12 +1181,6 @@ void OPPROTO op_sli_T0 (void) | @@ -1339,12 +1181,6 @@ void OPPROTO op_sli_T0 (void) | ||
1339 | RETURN(); | 1181 | RETURN(); |
1340 | } | 1182 | } |
1341 | 1183 | ||
1342 | -void OPPROTO op_sli_T1 (void) | ||
1343 | -{ | ||
1344 | - T1 = T1 << PARAM1; | ||
1345 | - RETURN(); | ||
1346 | -} | ||
1347 | - | ||
1348 | void OPPROTO op_srl_T0_T1 (void) | 1184 | void OPPROTO op_srl_T0_T1 (void) |
1349 | { | 1185 | { |
1350 | T0 = (uint32_t)T0 >> T1; | 1186 | T0 = (uint32_t)T0 >> T1; |
@@ -1579,21 +1415,6 @@ void OPPROTO op_frim (void) | @@ -1579,21 +1415,6 @@ void OPPROTO op_frim (void) | ||
1579 | RETURN(); | 1415 | RETURN(); |
1580 | } | 1416 | } |
1581 | 1417 | ||
1582 | -/*** Floating-Point compare ***/ | ||
1583 | -/* fcmpu */ | ||
1584 | -void OPPROTO op_fcmpu (void) | ||
1585 | -{ | ||
1586 | - do_fcmpu(); | ||
1587 | - RETURN(); | ||
1588 | -} | ||
1589 | - | ||
1590 | -/* fcmpo */ | ||
1591 | -void OPPROTO op_fcmpo (void) | ||
1592 | -{ | ||
1593 | - do_fcmpo(); | ||
1594 | - RETURN(); | ||
1595 | -} | ||
1596 | - | ||
1597 | /*** Floating-point move ***/ | 1418 | /*** Floating-point move ***/ |
1598 | /* fabs */ | 1419 | /* fabs */ |
1599 | void OPPROTO op_fabs (void) | 1420 | void OPPROTO op_fabs (void) |
target-ppc/op_helper.c
@@ -62,25 +62,25 @@ void do_raise_exception (uint32_t exception) | @@ -62,25 +62,25 @@ void do_raise_exception (uint32_t exception) | ||
62 | 62 | ||
63 | /*****************************************************************************/ | 63 | /*****************************************************************************/ |
64 | /* Registers load and stores */ | 64 | /* Registers load and stores */ |
65 | -void do_load_cr (void) | 65 | +uint32_t helper_load_cr (void) |
66 | { | 66 | { |
67 | - T0 = (env->crf[0] << 28) | | ||
68 | - (env->crf[1] << 24) | | ||
69 | - (env->crf[2] << 20) | | ||
70 | - (env->crf[3] << 16) | | ||
71 | - (env->crf[4] << 12) | | ||
72 | - (env->crf[5] << 8) | | ||
73 | - (env->crf[6] << 4) | | ||
74 | - (env->crf[7] << 0); | 67 | + return (env->crf[0] << 28) | |
68 | + (env->crf[1] << 24) | | ||
69 | + (env->crf[2] << 20) | | ||
70 | + (env->crf[3] << 16) | | ||
71 | + (env->crf[4] << 12) | | ||
72 | + (env->crf[5] << 8) | | ||
73 | + (env->crf[6] << 4) | | ||
74 | + (env->crf[7] << 0); | ||
75 | } | 75 | } |
76 | 76 | ||
77 | -void do_store_cr (uint32_t mask) | 77 | +void helper_store_cr (target_ulong val, uint32_t mask) |
78 | { | 78 | { |
79 | int i, sh; | 79 | int i, sh; |
80 | 80 | ||
81 | for (i = 0, sh = 7; i < 8; i++, sh--) { | 81 | for (i = 0, sh = 7; i < 8; i++, sh--) { |
82 | if (mask & (1 << sh)) | 82 | if (mask & (1 << sh)) |
83 | - env->crf[i] = (T0 >> (sh * 4)) & 0xFUL; | 83 | + env->crf[i] = (val >> (sh * 4)) & 0xFUL; |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
@@ -1364,27 +1364,32 @@ void do_fsel (void) | @@ -1364,27 +1364,32 @@ void do_fsel (void) | ||
1364 | FT0 = FT2; | 1364 | FT0 = FT2; |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | -void do_fcmpu (void) | 1367 | +uint32_t helper_fcmpu (void) |
1368 | { | 1368 | { |
1369 | + uint32_t ret = 0; | ||
1370 | + | ||
1369 | if (unlikely(float64_is_signaling_nan(FT0) || | 1371 | if (unlikely(float64_is_signaling_nan(FT0) || |
1370 | float64_is_signaling_nan(FT1))) { | 1372 | float64_is_signaling_nan(FT1))) { |
1371 | /* sNaN comparison */ | 1373 | /* sNaN comparison */ |
1372 | fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); | 1374 | fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); |
1373 | } else { | 1375 | } else { |
1374 | if (float64_lt(FT0, FT1, &env->fp_status)) { | 1376 | if (float64_lt(FT0, FT1, &env->fp_status)) { |
1375 | - T0 = 0x08UL; | 1377 | + ret = 0x08UL; |
1376 | } else if (!float64_le(FT0, FT1, &env->fp_status)) { | 1378 | } else if (!float64_le(FT0, FT1, &env->fp_status)) { |
1377 | - T0 = 0x04UL; | 1379 | + ret = 0x04UL; |
1378 | } else { | 1380 | } else { |
1379 | - T0 = 0x02UL; | 1381 | + ret = 0x02UL; |
1380 | } | 1382 | } |
1381 | } | 1383 | } |
1382 | env->fpscr &= ~(0x0F << FPSCR_FPRF); | 1384 | env->fpscr &= ~(0x0F << FPSCR_FPRF); |
1383 | - env->fpscr |= T0 << FPSCR_FPRF; | 1385 | + env->fpscr |= ret << FPSCR_FPRF; |
1386 | + return ret; | ||
1384 | } | 1387 | } |
1385 | 1388 | ||
1386 | -void do_fcmpo (void) | 1389 | +uint32_t helper_fcmpo (void) |
1387 | { | 1390 | { |
1391 | + uint32_t ret = 0; | ||
1392 | + | ||
1388 | if (unlikely(float64_is_nan(FT0) || | 1393 | if (unlikely(float64_is_nan(FT0) || |
1389 | float64_is_nan(FT1))) { | 1394 | float64_is_nan(FT1))) { |
1390 | if (float64_is_signaling_nan(FT0) || | 1395 | if (float64_is_signaling_nan(FT0) || |
@@ -1398,15 +1403,16 @@ void do_fcmpo (void) | @@ -1398,15 +1403,16 @@ void do_fcmpo (void) | ||
1398 | } | 1403 | } |
1399 | } else { | 1404 | } else { |
1400 | if (float64_lt(FT0, FT1, &env->fp_status)) { | 1405 | if (float64_lt(FT0, FT1, &env->fp_status)) { |
1401 | - T0 = 0x08UL; | 1406 | + ret = 0x08UL; |
1402 | } else if (!float64_le(FT0, FT1, &env->fp_status)) { | 1407 | } else if (!float64_le(FT0, FT1, &env->fp_status)) { |
1403 | - T0 = 0x04UL; | 1408 | + ret = 0x04UL; |
1404 | } else { | 1409 | } else { |
1405 | - T0 = 0x02UL; | 1410 | + ret = 0x02UL; |
1406 | } | 1411 | } |
1407 | } | 1412 | } |
1408 | env->fpscr &= ~(0x0F << FPSCR_FPRF); | 1413 | env->fpscr &= ~(0x0F << FPSCR_FPRF); |
1409 | - env->fpscr |= T0 << FPSCR_FPRF; | 1414 | + env->fpscr |= ret << FPSCR_FPRF; |
1415 | + return ret; | ||
1410 | } | 1416 | } |
1411 | 1417 | ||
1412 | #if !defined (CONFIG_USER_ONLY) | 1418 | #if !defined (CONFIG_USER_ONLY) |
target-ppc/translate.c
@@ -63,6 +63,7 @@ static TCGv cpu_nip; | @@ -63,6 +63,7 @@ static TCGv cpu_nip; | ||
63 | static TCGv cpu_ctr; | 63 | static TCGv cpu_ctr; |
64 | static TCGv cpu_lr; | 64 | static TCGv cpu_lr; |
65 | static TCGv cpu_xer; | 65 | static TCGv cpu_xer; |
66 | +static TCGv cpu_fpscr; | ||
66 | 67 | ||
67 | /* dyngen register indexes */ | 68 | /* dyngen register indexes */ |
68 | static TCGv cpu_T[3]; | 69 | static TCGv cpu_T[3]; |
@@ -179,6 +180,9 @@ void ppc_translate_init(void) | @@ -179,6 +180,9 @@ void ppc_translate_init(void) | ||
179 | cpu_xer = tcg_global_mem_new(TCG_TYPE_I32, TCG_AREG0, | 180 | cpu_xer = tcg_global_mem_new(TCG_TYPE_I32, TCG_AREG0, |
180 | offsetof(CPUState, xer), "xer"); | 181 | offsetof(CPUState, xer), "xer"); |
181 | 182 | ||
183 | + cpu_fpscr = tcg_global_mem_new(TCG_TYPE_I32, TCG_AREG0, | ||
184 | + offsetof(CPUState, fpscr), "fpscr"); | ||
185 | + | ||
182 | /* register helpers */ | 186 | /* register helpers */ |
183 | #undef DEF_HELPER | 187 | #undef DEF_HELPER |
184 | #define DEF_HELPER(ret, name, params) tcg_register_helper(name, #name); | 188 | #define DEF_HELPER(ret, name, params) tcg_register_helper(name, #name); |
@@ -230,17 +234,6 @@ struct opc_handler_t { | @@ -230,17 +234,6 @@ struct opc_handler_t { | ||
230 | #endif | 234 | #endif |
231 | }; | 235 | }; |
232 | 236 | ||
233 | -static always_inline void gen_set_Rc0 (DisasContext *ctx) | ||
234 | -{ | ||
235 | -#if defined(TARGET_PPC64) | ||
236 | - if (ctx->sf_mode) | ||
237 | - gen_op_cmpi_64(0); | ||
238 | - else | ||
239 | -#endif | ||
240 | - gen_op_cmpi(0); | ||
241 | - gen_op_set_Rc0(); | ||
242 | -} | ||
243 | - | ||
244 | static always_inline void gen_reset_fpstatus (void) | 237 | static always_inline void gen_reset_fpstatus (void) |
245 | { | 238 | { |
246 | #ifdef CONFIG_SOFTFLOAT | 239 | #ifdef CONFIG_SOFTFLOAT |
@@ -708,6 +701,155 @@ static opc_handler_t invalid_handler = { | @@ -708,6 +701,155 @@ static opc_handler_t invalid_handler = { | ||
708 | .handler = gen_invalid, | 701 | .handler = gen_invalid, |
709 | }; | 702 | }; |
710 | 703 | ||
704 | +/*** Integer comparison ***/ | ||
705 | + | ||
706 | +static always_inline void gen_op_cmp(TCGv t0, TCGv t1, int s, int crf) | ||
707 | +{ | ||
708 | + int l1, l2, l3; | ||
709 | + | ||
710 | + tcg_gen_shri_i32(cpu_crf[crf], cpu_xer, XER_SO); | ||
711 | + tcg_gen_andi_i32(cpu_crf[crf], cpu_crf[crf], 1); | ||
712 | + | ||
713 | + l1 = gen_new_label(); | ||
714 | + l2 = gen_new_label(); | ||
715 | + l3 = gen_new_label(); | ||
716 | + if (s) { | ||
717 | + tcg_gen_brcond_tl(TCG_COND_LT, t0, t1, l1); | ||
718 | + tcg_gen_brcond_tl(TCG_COND_GT, t0, t1, l2); | ||
719 | + } else { | ||
720 | + tcg_gen_brcond_tl(TCG_COND_LTU, t0, t1, l1); | ||
721 | + tcg_gen_brcond_tl(TCG_COND_GTU, t0, t1, l2); | ||
722 | + } | ||
723 | + tcg_gen_ori_i32(cpu_crf[crf], cpu_crf[crf], 1 << CRF_EQ); | ||
724 | + tcg_gen_br(l3); | ||
725 | + gen_set_label(l1); | ||
726 | + tcg_gen_ori_i32(cpu_crf[crf], cpu_crf[crf], 1 << CRF_LT); | ||
727 | + tcg_gen_br(l3); | ||
728 | + gen_set_label(l2); | ||
729 | + tcg_gen_ori_i32(cpu_crf[crf], cpu_crf[crf], 1 << CRF_GT); | ||
730 | + gen_set_label(l3); | ||
731 | +} | ||
732 | + | ||
733 | +static always_inline void gen_op_cmpi(TCGv t0, target_ulong t1, int s, int crf) | ||
734 | +{ | ||
735 | + TCGv temp = tcg_const_local_tl(t1); | ||
736 | + gen_op_cmp(t0, temp, s, crf); | ||
737 | + tcg_temp_free(temp); | ||
738 | +} | ||
739 | + | ||
740 | +#if defined(TARGET_PPC64) | ||
741 | +static always_inline void gen_op_cmp32(TCGv t0, TCGv t1, int s, int crf) | ||
742 | +{ | ||
743 | + TCGv t0_32, t1_32; | ||
744 | + t0_32 = tcg_temp_local_new(TCG_TYPE_TL); | ||
745 | + t1_32 = tcg_temp_local_new(TCG_TYPE_TL); | ||
746 | + if (s) { | ||
747 | + tcg_gen_ext32s_tl(t0_32, t0); | ||
748 | + tcg_gen_ext32s_tl(t1_32, t1); | ||
749 | + } else { | ||
750 | + tcg_gen_ext32u_tl(t0_32, t0); | ||
751 | + tcg_gen_ext32u_tl(t1_32, t1); | ||
752 | + } | ||
753 | + gen_op_cmp(t0_32, t1_32, s, crf); | ||
754 | + tcg_temp_free(t1_32); | ||
755 | + tcg_temp_free(t0_32); | ||
756 | +} | ||
757 | + | ||
758 | +static always_inline void gen_op_cmpi32(TCGv t0, target_ulong t1, int s, int crf) | ||
759 | +{ | ||
760 | + TCGv temp = tcg_const_local_tl(t1); | ||
761 | + gen_op_cmp32(t0, temp, s, crf); | ||
762 | + tcg_temp_free(temp); | ||
763 | +} | ||
764 | +#endif | ||
765 | + | ||
766 | +static always_inline void gen_set_Rc0 (DisasContext *ctx, TCGv reg) | ||
767 | +{ | ||
768 | +#if defined(TARGET_PPC64) | ||
769 | + if (!(ctx->sf_mode)) | ||
770 | + gen_op_cmpi32(reg, 0, 1, 0); | ||
771 | + else | ||
772 | +#endif | ||
773 | + gen_op_cmpi(reg, 0, 1, 0); | ||
774 | +} | ||
775 | + | ||
776 | +/* cmp */ | ||
777 | +GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x00400000, PPC_INTEGER) | ||
778 | +{ | ||
779 | +#if defined(TARGET_PPC64) | ||
780 | + if (!(ctx->sf_mode && (ctx->opcode & 0x00200000))) | ||
781 | + gen_op_cmp32(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], | ||
782 | + 1, crfD(ctx->opcode)); | ||
783 | + else | ||
784 | +#endif | ||
785 | + gen_op_cmp(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], | ||
786 | + 1, crfD(ctx->opcode)); | ||
787 | +} | ||
788 | + | ||
789 | +/* cmpi */ | ||
790 | +GEN_HANDLER(cmpi, 0x0B, 0xFF, 0xFF, 0x00400000, PPC_INTEGER) | ||
791 | +{ | ||
792 | +#if defined(TARGET_PPC64) | ||
793 | + if (!(ctx->sf_mode && (ctx->opcode & 0x00200000))) | ||
794 | + gen_op_cmpi32(cpu_gpr[rA(ctx->opcode)], SIMM(ctx->opcode), | ||
795 | + 1, crfD(ctx->opcode)); | ||
796 | + else | ||
797 | +#endif | ||
798 | + gen_op_cmpi(cpu_gpr[rA(ctx->opcode)], SIMM(ctx->opcode), | ||
799 | + 1, crfD(ctx->opcode)); | ||
800 | +} | ||
801 | + | ||
802 | +/* cmpl */ | ||
803 | +GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400000, PPC_INTEGER) | ||
804 | +{ | ||
805 | +#if defined(TARGET_PPC64) | ||
806 | + if (!(ctx->sf_mode && (ctx->opcode & 0x00200000))) | ||
807 | + gen_op_cmp32(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], | ||
808 | + 0, crfD(ctx->opcode)); | ||
809 | + else | ||
810 | +#endif | ||
811 | + gen_op_cmp(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], | ||
812 | + 0, crfD(ctx->opcode)); | ||
813 | +} | ||
814 | + | ||
815 | +/* cmpli */ | ||
816 | +GEN_HANDLER(cmpli, 0x0A, 0xFF, 0xFF, 0x00400000, PPC_INTEGER) | ||
817 | +{ | ||
818 | +#if defined(TARGET_PPC64) | ||
819 | + if (!(ctx->sf_mode && (ctx->opcode & 0x00200000))) | ||
820 | + gen_op_cmpi32(cpu_gpr[rA(ctx->opcode)], UIMM(ctx->opcode), | ||
821 | + 0, crfD(ctx->opcode)); | ||
822 | + else | ||
823 | +#endif | ||
824 | + gen_op_cmpi(cpu_gpr[rA(ctx->opcode)], UIMM(ctx->opcode), | ||
825 | + 0, crfD(ctx->opcode)); | ||
826 | +} | ||
827 | + | ||
828 | +/* isel (PowerPC 2.03 specification) */ | ||
829 | +GEN_HANDLER(isel, 0x1F, 0x0F, 0xFF, 0x00000001, PPC_ISEL) | ||
830 | +{ | ||
831 | + int l1, l2; | ||
832 | + uint32_t bi = rC(ctx->opcode); | ||
833 | + uint32_t mask; | ||
834 | + TCGv temp; | ||
835 | + | ||
836 | + l1 = gen_new_label(); | ||
837 | + l2 = gen_new_label(); | ||
838 | + | ||
839 | + mask = 1 << (3 - (bi & 0x03)); | ||
840 | + temp = tcg_temp_new(TCG_TYPE_I32); | ||
841 | + tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); | ||
842 | + tcg_gen_brcondi_i32(TCG_COND_EQ, temp, 0, l1); | ||
843 | + if (rA(ctx->opcode) == 0) | ||
844 | + tcg_gen_movi_tl(cpu_gpr[rD(ctx->opcode)], 0); | ||
845 | + else | ||
846 | + tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); | ||
847 | + tcg_gen_br(l2); | ||
848 | + gen_set_label(l1); | ||
849 | + tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); | ||
850 | + gen_set_label(l2); | ||
851 | +} | ||
852 | + | ||
711 | /*** Integer arithmetic ***/ | 853 | /*** Integer arithmetic ***/ |
712 | #define __GEN_INT_ARITH2(name, opc1, opc2, opc3, inval, type) \ | 854 | #define __GEN_INT_ARITH2(name, opc1, opc2, opc3, inval, type) \ |
713 | GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | 855 | GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ |
@@ -717,7 +859,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | @@ -717,7 +859,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | ||
717 | gen_op_##name(); \ | 859 | gen_op_##name(); \ |
718 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ | 860 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ |
719 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 861 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
720 | - gen_set_Rc0(ctx); \ | 862 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
721 | } | 863 | } |
722 | 864 | ||
723 | #define __GEN_INT_ARITH2_O(name, opc1, opc2, opc3, inval, type) \ | 865 | #define __GEN_INT_ARITH2_O(name, opc1, opc2, opc3, inval, type) \ |
@@ -728,7 +870,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | @@ -728,7 +870,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | ||
728 | gen_op_##name(); \ | 870 | gen_op_##name(); \ |
729 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ | 871 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ |
730 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 872 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
731 | - gen_set_Rc0(ctx); \ | 873 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
732 | } | 874 | } |
733 | 875 | ||
734 | #define __GEN_INT_ARITH1(name, opc1, opc2, opc3, type) \ | 876 | #define __GEN_INT_ARITH1(name, opc1, opc2, opc3, type) \ |
@@ -738,7 +880,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | @@ -738,7 +880,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | ||
738 | gen_op_##name(); \ | 880 | gen_op_##name(); \ |
739 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ | 881 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ |
740 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 882 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
741 | - gen_set_Rc0(ctx); \ | 883 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
742 | } | 884 | } |
743 | #define __GEN_INT_ARITH1_O(name, opc1, opc2, opc3, type) \ | 885 | #define __GEN_INT_ARITH1_O(name, opc1, opc2, opc3, type) \ |
744 | GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | 886 | GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ |
@@ -747,7 +889,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | @@ -747,7 +889,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | ||
747 | gen_op_##name(); \ | 889 | gen_op_##name(); \ |
748 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ | 890 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ |
749 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 891 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
750 | - gen_set_Rc0(ctx); \ | 892 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
751 | } | 893 | } |
752 | 894 | ||
753 | /* Two operands arithmetic functions */ | 895 | /* Two operands arithmetic functions */ |
@@ -776,7 +918,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | @@ -776,7 +918,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | ||
776 | gen_op_##name(); \ | 918 | gen_op_##name(); \ |
777 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ | 919 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ |
778 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 920 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
779 | - gen_set_Rc0(ctx); \ | 921 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
780 | } | 922 | } |
781 | 923 | ||
782 | #define __GEN_INT_ARITH2_O_64(name, opc1, opc2, opc3, inval, type) \ | 924 | #define __GEN_INT_ARITH2_O_64(name, opc1, opc2, opc3, inval, type) \ |
@@ -790,7 +932,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | @@ -790,7 +932,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \ | ||
790 | gen_op_##name(); \ | 932 | gen_op_##name(); \ |
791 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ | 933 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ |
792 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 934 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
793 | - gen_set_Rc0(ctx); \ | 935 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
794 | } | 936 | } |
795 | 937 | ||
796 | #define __GEN_INT_ARITH1_64(name, opc1, opc2, opc3, type) \ | 938 | #define __GEN_INT_ARITH1_64(name, opc1, opc2, opc3, type) \ |
@@ -803,7 +945,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | @@ -803,7 +945,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | ||
803 | gen_op_##name(); \ | 945 | gen_op_##name(); \ |
804 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ | 946 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ |
805 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 947 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
806 | - gen_set_Rc0(ctx); \ | 948 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
807 | } | 949 | } |
808 | #define __GEN_INT_ARITH1_O_64(name, opc1, opc2, opc3, type) \ | 950 | #define __GEN_INT_ARITH1_O_64(name, opc1, opc2, opc3, type) \ |
809 | GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | 951 | GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ |
@@ -815,7 +957,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | @@ -815,7 +957,7 @@ GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \ | ||
815 | gen_op_##name(); \ | 957 | gen_op_##name(); \ |
816 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ | 958 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \ |
817 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 959 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
818 | - gen_set_Rc0(ctx); \ | 960 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
819 | } | 961 | } |
820 | 962 | ||
821 | /* Two operands arithmetic functions */ | 963 | /* Two operands arithmetic functions */ |
@@ -1084,7 +1226,7 @@ GEN_HANDLER2(addic_, "addic.", 0x0D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | @@ -1084,7 +1226,7 @@ GEN_HANDLER2(addic_, "addic.", 0x0D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | ||
1084 | tcg_gen_andi_i32(cpu_xer, cpu_xer, ~(1 << XER_CA)); | 1226 | tcg_gen_andi_i32(cpu_xer, cpu_xer, ~(1 << XER_CA)); |
1085 | } | 1227 | } |
1086 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 1228 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
1087 | - gen_set_Rc0(ctx); | 1229 | + gen_set_Rc0(ctx, cpu_T[0]); |
1088 | } | 1230 | } |
1089 | /* addis */ | 1231 | /* addis */ |
1090 | GEN_HANDLER(addis, 0x0F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | 1232 | GEN_HANDLER(addis, 0x0F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) |
@@ -1134,78 +1276,6 @@ GEN_INT_ARITH2 (divd, 0x1F, 0x09, 0x0F, PPC_64B); | @@ -1134,78 +1276,6 @@ GEN_INT_ARITH2 (divd, 0x1F, 0x09, 0x0F, PPC_64B); | ||
1134 | GEN_INT_ARITH2 (divdu, 0x1F, 0x09, 0x0E, PPC_64B); | 1276 | GEN_INT_ARITH2 (divdu, 0x1F, 0x09, 0x0E, PPC_64B); |
1135 | #endif | 1277 | #endif |
1136 | 1278 | ||
1137 | -/*** Integer comparison ***/ | ||
1138 | -#if defined(TARGET_PPC64) | ||
1139 | -#define GEN_CMP(name, opc, type) \ | ||
1140 | -GEN_HANDLER(name, 0x1F, 0x00, opc, 0x00400000, type) \ | ||
1141 | -{ \ | ||
1142 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \ | ||
1143 | - tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \ | ||
1144 | - if (ctx->sf_mode && (ctx->opcode & 0x00200000)) \ | ||
1145 | - gen_op_##name##_64(); \ | ||
1146 | - else \ | ||
1147 | - gen_op_##name(); \ | ||
1148 | - tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); \ | ||
1149 | -} | ||
1150 | -#else | ||
1151 | -#define GEN_CMP(name, opc, type) \ | ||
1152 | -GEN_HANDLER(name, 0x1F, 0x00, opc, 0x00400000, type) \ | ||
1153 | -{ \ | ||
1154 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \ | ||
1155 | - tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \ | ||
1156 | - gen_op_##name(); \ | ||
1157 | - tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); \ | ||
1158 | -} | ||
1159 | -#endif | ||
1160 | - | ||
1161 | -/* cmp */ | ||
1162 | -GEN_CMP(cmp, 0x00, PPC_INTEGER); | ||
1163 | -/* cmpi */ | ||
1164 | -GEN_HANDLER(cmpi, 0x0B, 0xFF, 0xFF, 0x00400000, PPC_INTEGER) | ||
1165 | -{ | ||
1166 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); | ||
1167 | -#if defined(TARGET_PPC64) | ||
1168 | - if (ctx->sf_mode && (ctx->opcode & 0x00200000)) | ||
1169 | - gen_op_cmpi_64(SIMM(ctx->opcode)); | ||
1170 | - else | ||
1171 | -#endif | ||
1172 | - gen_op_cmpi(SIMM(ctx->opcode)); | ||
1173 | - tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); | ||
1174 | -} | ||
1175 | -/* cmpl */ | ||
1176 | -GEN_CMP(cmpl, 0x01, PPC_INTEGER); | ||
1177 | -/* cmpli */ | ||
1178 | -GEN_HANDLER(cmpli, 0x0A, 0xFF, 0xFF, 0x00400000, PPC_INTEGER) | ||
1179 | -{ | ||
1180 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); | ||
1181 | -#if defined(TARGET_PPC64) | ||
1182 | - if (ctx->sf_mode && (ctx->opcode & 0x00200000)) | ||
1183 | - gen_op_cmpli_64(UIMM(ctx->opcode)); | ||
1184 | - else | ||
1185 | -#endif | ||
1186 | - gen_op_cmpli(UIMM(ctx->opcode)); | ||
1187 | - tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); | ||
1188 | -} | ||
1189 | - | ||
1190 | -/* isel (PowerPC 2.03 specification) */ | ||
1191 | -GEN_HANDLER(isel, 0x1F, 0x0F, 0xFF, 0x00000001, PPC_ISEL) | ||
1192 | -{ | ||
1193 | - uint32_t bi = rC(ctx->opcode); | ||
1194 | - uint32_t mask; | ||
1195 | - | ||
1196 | - if (rA(ctx->opcode) == 0) { | ||
1197 | - tcg_gen_movi_tl(cpu_T[0], 0); | ||
1198 | - } else { | ||
1199 | - tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rA(ctx->opcode)]); | ||
1200 | - } | ||
1201 | - tcg_gen_mov_tl(cpu_T[2], cpu_gpr[rB(ctx->opcode)]); | ||
1202 | - mask = 1 << (3 - (bi & 0x03)); | ||
1203 | - tcg_gen_mov_i32(cpu_T[0], cpu_crf[bi >> 2]); | ||
1204 | - gen_op_test_true(mask); | ||
1205 | - gen_op_isel(); | ||
1206 | - tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | ||
1207 | -} | ||
1208 | - | ||
1209 | /*** Integer logical ***/ | 1279 | /*** Integer logical ***/ |
1210 | #define __GEN_LOGICAL2(name, opc2, opc3, type) \ | 1280 | #define __GEN_LOGICAL2(name, opc2, opc3, type) \ |
1211 | GEN_HANDLER(name, 0x1F, opc2, opc3, 0x00000000, type) \ | 1281 | GEN_HANDLER(name, 0x1F, opc2, opc3, 0x00000000, type) \ |
@@ -1215,7 +1285,7 @@ GEN_HANDLER(name, 0x1F, opc2, opc3, 0x00000000, type) \ | @@ -1215,7 +1285,7 @@ GEN_HANDLER(name, 0x1F, opc2, opc3, 0x00000000, type) \ | ||
1215 | gen_op_##name(); \ | 1285 | gen_op_##name(); \ |
1216 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \ | 1286 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \ |
1217 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 1287 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
1218 | - gen_set_Rc0(ctx); \ | 1288 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
1219 | } | 1289 | } |
1220 | #define GEN_LOGICAL2(name, opc, type) \ | 1290 | #define GEN_LOGICAL2(name, opc, type) \ |
1221 | __GEN_LOGICAL2(name, 0x1C, opc, type) | 1291 | __GEN_LOGICAL2(name, 0x1C, opc, type) |
@@ -1227,7 +1297,7 @@ GEN_HANDLER(name, 0x1F, 0x1A, opc, 0x00000000, type) \ | @@ -1227,7 +1297,7 @@ GEN_HANDLER(name, 0x1F, 0x1A, opc, 0x00000000, type) \ | ||
1227 | gen_op_##name(); \ | 1297 | gen_op_##name(); \ |
1228 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \ | 1298 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \ |
1229 | if (unlikely(Rc(ctx->opcode) != 0)) \ | 1299 | if (unlikely(Rc(ctx->opcode) != 0)) \ |
1230 | - gen_set_Rc0(ctx); \ | 1300 | + gen_set_Rc0(ctx, cpu_T[0]); \ |
1231 | } | 1301 | } |
1232 | 1302 | ||
1233 | /* and & and. */ | 1303 | /* and & and. */ |
@@ -1240,7 +1310,7 @@ GEN_HANDLER2(andi_, "andi.", 0x1C, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | @@ -1240,7 +1310,7 @@ GEN_HANDLER2(andi_, "andi.", 0x1C, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | ||
1240 | tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); | 1310 | tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); |
1241 | tcg_gen_andi_tl(cpu_T[0], cpu_T[0], UIMM(ctx->opcode)); | 1311 | tcg_gen_andi_tl(cpu_T[0], cpu_T[0], UIMM(ctx->opcode)); |
1242 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1312 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1243 | - gen_set_Rc0(ctx); | 1313 | + gen_set_Rc0(ctx, cpu_T[0]); |
1244 | } | 1314 | } |
1245 | /* andis. */ | 1315 | /* andis. */ |
1246 | GEN_HANDLER2(andis_, "andis.", 0x1D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | 1316 | GEN_HANDLER2(andis_, "andis.", 0x1D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) |
@@ -1248,7 +1318,7 @@ GEN_HANDLER2(andis_, "andis.", 0x1D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | @@ -1248,7 +1318,7 @@ GEN_HANDLER2(andis_, "andis.", 0x1D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | ||
1248 | tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); | 1318 | tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); |
1249 | tcg_gen_andi_tl(cpu_T[0], cpu_T[0], UIMM(ctx->opcode) << 16); | 1319 | tcg_gen_andi_tl(cpu_T[0], cpu_T[0], UIMM(ctx->opcode) << 16); |
1250 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1320 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1251 | - gen_set_Rc0(ctx); | 1321 | + gen_set_Rc0(ctx, cpu_T[0]); |
1252 | } | 1322 | } |
1253 | 1323 | ||
1254 | /* cntlzw */ | 1324 | /* cntlzw */ |
@@ -1281,10 +1351,10 @@ GEN_HANDLER(or, 0x1F, 0x1C, 0x0D, 0x00000000, PPC_INTEGER) | @@ -1281,10 +1351,10 @@ GEN_HANDLER(or, 0x1F, 0x1C, 0x0D, 0x00000000, PPC_INTEGER) | ||
1281 | } | 1351 | } |
1282 | tcg_gen_mov_tl(cpu_gpr[ra], cpu_T[0]); | 1352 | tcg_gen_mov_tl(cpu_gpr[ra], cpu_T[0]); |
1283 | if (unlikely(Rc(ctx->opcode) != 0)) | 1353 | if (unlikely(Rc(ctx->opcode) != 0)) |
1284 | - gen_set_Rc0(ctx); | 1354 | + gen_set_Rc0(ctx, cpu_T[0]); |
1285 | } else if (unlikely(Rc(ctx->opcode) != 0)) { | 1355 | } else if (unlikely(Rc(ctx->opcode) != 0)) { |
1286 | tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rs]); | 1356 | tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rs]); |
1287 | - gen_set_Rc0(ctx); | 1357 | + gen_set_Rc0(ctx, cpu_T[0]); |
1288 | #if defined(TARGET_PPC64) | 1358 | #if defined(TARGET_PPC64) |
1289 | } else { | 1359 | } else { |
1290 | switch (rs) { | 1360 | switch (rs) { |
@@ -1349,7 +1419,7 @@ GEN_HANDLER(xor, 0x1F, 0x1C, 0x09, 0x00000000, PPC_INTEGER) | @@ -1349,7 +1419,7 @@ GEN_HANDLER(xor, 0x1F, 0x1C, 0x09, 0x00000000, PPC_INTEGER) | ||
1349 | } | 1419 | } |
1350 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1420 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1351 | if (unlikely(Rc(ctx->opcode) != 0)) | 1421 | if (unlikely(Rc(ctx->opcode) != 0)) |
1352 | - gen_set_Rc0(ctx); | 1422 | + gen_set_Rc0(ctx, cpu_T[0]); |
1353 | } | 1423 | } |
1354 | /* ori */ | 1424 | /* ori */ |
1355 | GEN_HANDLER(ori, 0x18, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | 1425 | GEN_HANDLER(ori, 0x18, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) |
@@ -1467,7 +1537,7 @@ GEN_HANDLER(rlwimi, 0x14, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | @@ -1467,7 +1537,7 @@ GEN_HANDLER(rlwimi, 0x14, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | ||
1467 | do_store: | 1537 | do_store: |
1468 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1538 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1469 | if (unlikely(Rc(ctx->opcode) != 0)) | 1539 | if (unlikely(Rc(ctx->opcode) != 0)) |
1470 | - gen_set_Rc0(ctx); | 1540 | + gen_set_Rc0(ctx, cpu_T[0]); |
1471 | } | 1541 | } |
1472 | /* rlwinm & rlwinm. */ | 1542 | /* rlwinm & rlwinm. */ |
1473 | GEN_HANDLER(rlwinm, 0x15, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | 1543 | GEN_HANDLER(rlwinm, 0x15, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) |
@@ -1505,7 +1575,7 @@ GEN_HANDLER(rlwinm, 0x15, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | @@ -1505,7 +1575,7 @@ GEN_HANDLER(rlwinm, 0x15, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | ||
1505 | do_store: | 1575 | do_store: |
1506 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1576 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1507 | if (unlikely(Rc(ctx->opcode) != 0)) | 1577 | if (unlikely(Rc(ctx->opcode) != 0)) |
1508 | - gen_set_Rc0(ctx); | 1578 | + gen_set_Rc0(ctx, cpu_T[0]); |
1509 | } | 1579 | } |
1510 | /* rlwnm & rlwnm. */ | 1580 | /* rlwnm & rlwnm. */ |
1511 | GEN_HANDLER(rlwnm, 0x17, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | 1581 | GEN_HANDLER(rlwnm, 0x17, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) |
@@ -1526,7 +1596,7 @@ GEN_HANDLER(rlwnm, 0x17, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | @@ -1526,7 +1596,7 @@ GEN_HANDLER(rlwnm, 0x17, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) | ||
1526 | } | 1596 | } |
1527 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1597 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1528 | if (unlikely(Rc(ctx->opcode) != 0)) | 1598 | if (unlikely(Rc(ctx->opcode) != 0)) |
1529 | - gen_set_Rc0(ctx); | 1599 | + gen_set_Rc0(ctx, cpu_T[0]); |
1530 | } | 1600 | } |
1531 | 1601 | ||
1532 | #if defined(TARGET_PPC64) | 1602 | #if defined(TARGET_PPC64) |
@@ -1588,7 +1658,7 @@ static always_inline void gen_rldinm (DisasContext *ctx, uint32_t mb, | @@ -1588,7 +1658,7 @@ static always_inline void gen_rldinm (DisasContext *ctx, uint32_t mb, | ||
1588 | do_store: | 1658 | do_store: |
1589 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1659 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1590 | if (unlikely(Rc(ctx->opcode) != 0)) | 1660 | if (unlikely(Rc(ctx->opcode) != 0)) |
1591 | - gen_set_Rc0(ctx); | 1661 | + gen_set_Rc0(ctx, cpu_T[0]); |
1592 | } | 1662 | } |
1593 | /* rldicl - rldicl. */ | 1663 | /* rldicl - rldicl. */ |
1594 | static always_inline void gen_rldicl (DisasContext *ctx, int mbn, int shn) | 1664 | static always_inline void gen_rldicl (DisasContext *ctx, int mbn, int shn) |
@@ -1632,7 +1702,7 @@ static always_inline void gen_rldnm (DisasContext *ctx, uint32_t mb, | @@ -1632,7 +1702,7 @@ static always_inline void gen_rldnm (DisasContext *ctx, uint32_t mb, | ||
1632 | } | 1702 | } |
1633 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1703 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1634 | if (unlikely(Rc(ctx->opcode) != 0)) | 1704 | if (unlikely(Rc(ctx->opcode) != 0)) |
1635 | - gen_set_Rc0(ctx); | 1705 | + gen_set_Rc0(ctx, cpu_T[0]); |
1636 | } | 1706 | } |
1637 | 1707 | ||
1638 | /* rldcl - rldcl. */ | 1708 | /* rldcl - rldcl. */ |
@@ -1682,7 +1752,7 @@ static always_inline void gen_rldimi (DisasContext *ctx, int mbn, int shn) | @@ -1682,7 +1752,7 @@ static always_inline void gen_rldimi (DisasContext *ctx, int mbn, int shn) | ||
1682 | do_store: | 1752 | do_store: |
1683 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1753 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1684 | if (unlikely(Rc(ctx->opcode) != 0)) | 1754 | if (unlikely(Rc(ctx->opcode) != 0)) |
1685 | - gen_set_Rc0(ctx); | 1755 | + gen_set_Rc0(ctx, cpu_T[0]); |
1686 | } | 1756 | } |
1687 | GEN_PPC64_R4(rldimi, 0x1E, 0x06); | 1757 | GEN_PPC64_R4(rldimi, 0x1E, 0x06); |
1688 | #endif | 1758 | #endif |
@@ -1709,7 +1779,7 @@ GEN_HANDLER(srawi, 0x1F, 0x18, 0x19, 0x00000000, PPC_INTEGER) | @@ -1709,7 +1779,7 @@ GEN_HANDLER(srawi, 0x1F, 0x18, 0x19, 0x00000000, PPC_INTEGER) | ||
1709 | } | 1779 | } |
1710 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1780 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1711 | if (unlikely(Rc(ctx->opcode) != 0)) | 1781 | if (unlikely(Rc(ctx->opcode) != 0)) |
1712 | - gen_set_Rc0(ctx); | 1782 | + gen_set_Rc0(ctx, cpu_T[0]); |
1713 | } | 1783 | } |
1714 | /* srw & srw. */ | 1784 | /* srw & srw. */ |
1715 | __GEN_LOGICAL2(srw, 0x18, 0x10, PPC_INTEGER); | 1785 | __GEN_LOGICAL2(srw, 0x18, 0x10, PPC_INTEGER); |
@@ -1736,7 +1806,7 @@ static always_inline void gen_sradi (DisasContext *ctx, int n) | @@ -1736,7 +1806,7 @@ static always_inline void gen_sradi (DisasContext *ctx, int n) | ||
1736 | } | 1806 | } |
1737 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 1807 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
1738 | if (unlikely(Rc(ctx->opcode) != 0)) | 1808 | if (unlikely(Rc(ctx->opcode) != 0)) |
1739 | - gen_set_Rc0(ctx); | 1809 | + gen_set_Rc0(ctx, cpu_T[0]); |
1740 | } | 1810 | } |
1741 | GEN_HANDLER2(sradi0, "sradi", 0x1F, 0x1A, 0x19, 0x00000000, PPC_64B) | 1811 | GEN_HANDLER2(sradi0, "sradi", 0x1F, 0x1A, 0x19, 0x00000000, PPC_64B) |
1742 | { | 1812 | { |
@@ -1947,8 +2017,7 @@ GEN_HANDLER(fcmpo, 0x3F, 0x00, 0x01, 0x00600001, PPC_FLOAT) | @@ -1947,8 +2017,7 @@ GEN_HANDLER(fcmpo, 0x3F, 0x00, 0x01, 0x00600001, PPC_FLOAT) | ||
1947 | tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]); | 2017 | tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]); |
1948 | tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]); | 2018 | tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]); |
1949 | gen_reset_fpstatus(); | 2019 | gen_reset_fpstatus(); |
1950 | - gen_op_fcmpo(); | ||
1951 | - tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); | 2020 | + tcg_gen_helper_1_0(helper_fcmpo, cpu_crf[crfD(ctx->opcode)]); |
1952 | gen_op_float_check_status(); | 2021 | gen_op_float_check_status(); |
1953 | } | 2022 | } |
1954 | 2023 | ||
@@ -1962,8 +2031,7 @@ GEN_HANDLER(fcmpu, 0x3F, 0x00, 0x00, 0x00600001, PPC_FLOAT) | @@ -1962,8 +2031,7 @@ GEN_HANDLER(fcmpu, 0x3F, 0x00, 0x00, 0x00600001, PPC_FLOAT) | ||
1962 | tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]); | 2031 | tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]); |
1963 | tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]); | 2032 | tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]); |
1964 | gen_reset_fpstatus(); | 2033 | gen_reset_fpstatus(); |
1965 | - gen_op_fcmpu(); | ||
1966 | - tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); | 2034 | + tcg_gen_helper_1_0(helper_fcmpu, cpu_crf[crfD(ctx->opcode)]); |
1967 | gen_op_float_check_status(); | 2035 | gen_op_float_check_status(); |
1968 | } | 2036 | } |
1969 | 2037 | ||
@@ -2004,8 +2072,8 @@ GEN_HANDLER(mcrfs, 0x3F, 0x00, 0x02, 0x0063F801, PPC_FLOAT) | @@ -2004,8 +2072,8 @@ GEN_HANDLER(mcrfs, 0x3F, 0x00, 0x02, 0x0063F801, PPC_FLOAT) | ||
2004 | } | 2072 | } |
2005 | gen_optimize_fprf(); | 2073 | gen_optimize_fprf(); |
2006 | bfa = 4 * (7 - crfS(ctx->opcode)); | 2074 | bfa = 4 * (7 - crfS(ctx->opcode)); |
2007 | - gen_op_load_fpscr_T0(bfa); | ||
2008 | - tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); | 2075 | + tcg_gen_shri_i32(cpu_crf[crfD(ctx->opcode)], cpu_fpscr, bfa); |
2076 | + tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)], 0xf); | ||
2009 | gen_op_fpscr_resetbit(~(0xF << bfa)); | 2077 | gen_op_fpscr_resetbit(~(0xF << bfa)); |
2010 | } | 2078 | } |
2011 | 2079 | ||
@@ -2038,8 +2106,7 @@ GEN_HANDLER(mtfsb0, 0x3F, 0x06, 0x02, 0x001FF800, PPC_FLOAT) | @@ -2038,8 +2106,7 @@ GEN_HANDLER(mtfsb0, 0x3F, 0x06, 0x02, 0x001FF800, PPC_FLOAT) | ||
2038 | if (likely(crb != 30 && crb != 29)) | 2106 | if (likely(crb != 30 && crb != 29)) |
2039 | gen_op_fpscr_resetbit(~(1 << crb)); | 2107 | gen_op_fpscr_resetbit(~(1 << crb)); |
2040 | if (unlikely(Rc(ctx->opcode) != 0)) { | 2108 | if (unlikely(Rc(ctx->opcode) != 0)) { |
2041 | - gen_op_load_fpcc(); | ||
2042 | - gen_op_set_Rc0(); | 2109 | + tcg_gen_shri_i32(cpu_crf[1], cpu_fpscr, FPSCR_OX); |
2043 | } | 2110 | } |
2044 | } | 2111 | } |
2045 | 2112 | ||
@@ -2059,8 +2126,7 @@ GEN_HANDLER(mtfsb1, 0x3F, 0x06, 0x01, 0x001FF800, PPC_FLOAT) | @@ -2059,8 +2126,7 @@ GEN_HANDLER(mtfsb1, 0x3F, 0x06, 0x01, 0x001FF800, PPC_FLOAT) | ||
2059 | if (likely(crb != FPSCR_FEX && crb != FPSCR_VX && crb != FPSCR_NI)) | 2126 | if (likely(crb != FPSCR_FEX && crb != FPSCR_VX && crb != FPSCR_NI)) |
2060 | gen_op_fpscr_setbit(crb); | 2127 | gen_op_fpscr_setbit(crb); |
2061 | if (unlikely(Rc(ctx->opcode) != 0)) { | 2128 | if (unlikely(Rc(ctx->opcode) != 0)) { |
2062 | - gen_op_load_fpcc(); | ||
2063 | - gen_op_set_Rc0(); | 2129 | + tcg_gen_shri_i32(cpu_crf[1], cpu_fpscr, FPSCR_OX); |
2064 | } | 2130 | } |
2065 | /* We can raise a differed exception */ | 2131 | /* We can raise a differed exception */ |
2066 | gen_op_float_check_status(); | 2132 | gen_op_float_check_status(); |
@@ -2078,8 +2144,7 @@ GEN_HANDLER(mtfsf, 0x3F, 0x07, 0x16, 0x02010000, PPC_FLOAT) | @@ -2078,8 +2144,7 @@ GEN_HANDLER(mtfsf, 0x3F, 0x07, 0x16, 0x02010000, PPC_FLOAT) | ||
2078 | gen_reset_fpstatus(); | 2144 | gen_reset_fpstatus(); |
2079 | gen_op_store_fpscr(FM(ctx->opcode)); | 2145 | gen_op_store_fpscr(FM(ctx->opcode)); |
2080 | if (unlikely(Rc(ctx->opcode) != 0)) { | 2146 | if (unlikely(Rc(ctx->opcode) != 0)) { |
2081 | - gen_op_load_fpcc(); | ||
2082 | - gen_op_set_Rc0(); | 2147 | + tcg_gen_shri_i32(cpu_crf[1], cpu_fpscr, FPSCR_OX); |
2083 | } | 2148 | } |
2084 | /* We can raise a differed exception */ | 2149 | /* We can raise a differed exception */ |
2085 | gen_op_float_check_status(); | 2150 | gen_op_float_check_status(); |
@@ -2101,8 +2166,7 @@ GEN_HANDLER(mtfsfi, 0x3F, 0x06, 0x04, 0x006f0800, PPC_FLOAT) | @@ -2101,8 +2166,7 @@ GEN_HANDLER(mtfsfi, 0x3F, 0x06, 0x04, 0x006f0800, PPC_FLOAT) | ||
2101 | gen_reset_fpstatus(); | 2166 | gen_reset_fpstatus(); |
2102 | gen_op_store_fpscr(1 << sh); | 2167 | gen_op_store_fpscr(1 << sh); |
2103 | if (unlikely(Rc(ctx->opcode) != 0)) { | 2168 | if (unlikely(Rc(ctx->opcode) != 0)) { |
2104 | - gen_op_load_fpcc(); | ||
2105 | - gen_op_set_Rc0(); | 2169 | + tcg_gen_shri_i32(cpu_crf[1], cpu_fpscr, FPSCR_OX); |
2106 | } | 2170 | } |
2107 | /* We can raise a differed exception */ | 2171 | /* We can raise a differed exception */ |
2108 | gen_op_float_check_status(); | 2172 | gen_op_float_check_status(); |
@@ -3356,47 +3420,53 @@ GEN_HANDLER(bclr, 0x13, 0x10, 0x00, 0x00000000, PPC_FLOW) | @@ -3356,47 +3420,53 @@ GEN_HANDLER(bclr, 0x13, 0x10, 0x00, 0x00000000, PPC_FLOW) | ||
3356 | } | 3420 | } |
3357 | 3421 | ||
3358 | /*** Condition register logical ***/ | 3422 | /*** Condition register logical ***/ |
3359 | -#define GEN_CRLOGIC(op, opc) \ | ||
3360 | -GEN_HANDLER(cr##op, 0x13, 0x01, opc, 0x00000001, PPC_INTEGER) \ | 3423 | +#define GEN_CRLOGIC(name, tcg_op, opc) \ |
3424 | +GEN_HANDLER(name, 0x13, 0x01, opc, 0x00000001, PPC_INTEGER) \ | ||
3361 | { \ | 3425 | { \ |
3362 | uint8_t bitmask; \ | 3426 | uint8_t bitmask; \ |
3363 | int sh; \ | 3427 | int sh; \ |
3364 | - tcg_gen_mov_i32(cpu_T[0], cpu_crf[crbA(ctx->opcode) >> 2]); \ | 3428 | + TCGv temp1, temp2; \ |
3365 | sh = (crbD(ctx->opcode) & 0x03) - (crbA(ctx->opcode) & 0x03); \ | 3429 | sh = (crbD(ctx->opcode) & 0x03) - (crbA(ctx->opcode) & 0x03); \ |
3430 | + temp1 = tcg_temp_new(TCG_TYPE_I32); \ | ||
3366 | if (sh > 0) \ | 3431 | if (sh > 0) \ |
3367 | - gen_op_srli_T0(sh); \ | 3432 | + tcg_gen_shri_i32(temp1, cpu_crf[crbA(ctx->opcode) >> 2], sh); \ |
3368 | else if (sh < 0) \ | 3433 | else if (sh < 0) \ |
3369 | - gen_op_sli_T0(-sh); \ | ||
3370 | - tcg_gen_mov_i32(cpu_T[1], cpu_crf[crbB(ctx->opcode) >> 2]); \ | 3434 | + tcg_gen_shli_i32(temp1, cpu_crf[crbA(ctx->opcode) >> 2], -sh); \ |
3435 | + else \ | ||
3436 | + tcg_gen_mov_i32(temp1, cpu_crf[crbB(ctx->opcode) >> 2]); \ | ||
3437 | + temp2 = tcg_temp_new(TCG_TYPE_I32); \ | ||
3371 | sh = (crbD(ctx->opcode) & 0x03) - (crbB(ctx->opcode) & 0x03); \ | 3438 | sh = (crbD(ctx->opcode) & 0x03) - (crbB(ctx->opcode) & 0x03); \ |
3372 | if (sh > 0) \ | 3439 | if (sh > 0) \ |
3373 | - gen_op_srli_T1(sh); \ | 3440 | + tcg_gen_shri_i32(temp2, cpu_crf[crbB(ctx->opcode) >> 2], sh); \ |
3374 | else if (sh < 0) \ | 3441 | else if (sh < 0) \ |
3375 | - gen_op_sli_T1(-sh); \ | ||
3376 | - gen_op_##op(); \ | 3442 | + tcg_gen_shli_i32(temp2, cpu_crf[crbB(ctx->opcode) >> 2], -sh); \ |
3443 | + else \ | ||
3444 | + tcg_gen_mov_i32(temp2, cpu_crf[crbB(ctx->opcode) >> 2]); \ | ||
3445 | + tcg_op(temp1, temp1, temp2); \ | ||
3377 | bitmask = 1 << (3 - (crbD(ctx->opcode) & 0x03)); \ | 3446 | bitmask = 1 << (3 - (crbD(ctx->opcode) & 0x03)); \ |
3378 | - tcg_gen_andi_tl(cpu_T[0], cpu_T[0], bitmask); \ | ||
3379 | - tcg_gen_andi_i32(cpu_T[1], cpu_crf[crbD(ctx->opcode) >> 2], ~bitmask); \ | ||
3380 | - gen_op_or(); \ | ||
3381 | - tcg_gen_andi_i32(cpu_crf[crbD(ctx->opcode) >> 2], cpu_T[0], 0xf); \ | 3447 | + tcg_gen_andi_i32(temp1, temp1, bitmask); \ |
3448 | + tcg_gen_andi_i32(temp2, cpu_crf[crbD(ctx->opcode) >> 2], ~bitmask); \ | ||
3449 | + tcg_gen_or_i32(cpu_crf[crbD(ctx->opcode) >> 2], temp1, temp2); \ | ||
3450 | + tcg_temp_free(temp1); \ | ||
3451 | + tcg_temp_free(temp2); \ | ||
3382 | } | 3452 | } |
3383 | 3453 | ||
3384 | /* crand */ | 3454 | /* crand */ |
3385 | -GEN_CRLOGIC(and, 0x08); | 3455 | +GEN_CRLOGIC(crand, tcg_gen_and_i32, 0x08); |
3386 | /* crandc */ | 3456 | /* crandc */ |
3387 | -GEN_CRLOGIC(andc, 0x04); | 3457 | +GEN_CRLOGIC(crandc, tcg_gen_andc_i32, 0x04); |
3388 | /* creqv */ | 3458 | /* creqv */ |
3389 | -GEN_CRLOGIC(eqv, 0x09); | 3459 | +GEN_CRLOGIC(creqv, tcg_gen_eqv_i32, 0x09); |
3390 | /* crnand */ | 3460 | /* crnand */ |
3391 | -GEN_CRLOGIC(nand, 0x07); | 3461 | +GEN_CRLOGIC(crnand, tcg_gen_nand_i32, 0x07); |
3392 | /* crnor */ | 3462 | /* crnor */ |
3393 | -GEN_CRLOGIC(nor, 0x01); | 3463 | +GEN_CRLOGIC(crnor, tcg_gen_nor_i32, 0x01); |
3394 | /* cror */ | 3464 | /* cror */ |
3395 | -GEN_CRLOGIC(or, 0x0E); | 3465 | +GEN_CRLOGIC(cror, tcg_gen_or_i32, 0x0E); |
3396 | /* crorc */ | 3466 | /* crorc */ |
3397 | -GEN_CRLOGIC(orc, 0x0D); | 3467 | +GEN_CRLOGIC(crorc, tcg_gen_orc_i32, 0x0D); |
3398 | /* crxor */ | 3468 | /* crxor */ |
3399 | -GEN_CRLOGIC(xor, 0x06); | 3469 | +GEN_CRLOGIC(crxor, tcg_gen_xor_i32, 0x06); |
3400 | /* mcrf */ | 3470 | /* mcrf */ |
3401 | GEN_HANDLER(mcrf, 0x13, 0x00, 0xFF, 0x00000001, PPC_INTEGER) | 3471 | GEN_HANDLER(mcrf, 0x13, 0x00, 0xFF, 0x00000001, PPC_INTEGER) |
3402 | { | 3472 | { |
@@ -3527,12 +3597,11 @@ GEN_HANDLER(mfcr, 0x1F, 0x13, 0x00, 0x00000801, PPC_MISC) | @@ -3527,12 +3597,11 @@ GEN_HANDLER(mfcr, 0x1F, 0x13, 0x00, 0x00000801, PPC_MISC) | ||
3527 | crm = CRM(ctx->opcode); | 3597 | crm = CRM(ctx->opcode); |
3528 | if (likely((crm ^ (crm - 1)) == 0)) { | 3598 | if (likely((crm ^ (crm - 1)) == 0)) { |
3529 | crn = ffs(crm); | 3599 | crn = ffs(crm); |
3530 | - tcg_gen_mov_i32(cpu_T[0], cpu_crf[7 - crn]); | 3600 | + tcg_gen_extu_i32_tl(cpu_gpr[rD(ctx->opcode)], cpu_crf[7 - crn]); |
3531 | } | 3601 | } |
3532 | } else { | 3602 | } else { |
3533 | - gen_op_load_cr(); | 3603 | + tcg_gen_helper_1_0(helper_load_cr, cpu_gpr[rD(ctx->opcode)]); |
3534 | } | 3604 | } |
3535 | - tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | ||
3536 | } | 3605 | } |
3537 | 3606 | ||
3538 | /* mfmsr */ | 3607 | /* mfmsr */ |
@@ -3624,14 +3693,15 @@ GEN_HANDLER(mtcrf, 0x1F, 0x10, 0x04, 0x00000801, PPC_MISC) | @@ -3624,14 +3693,15 @@ GEN_HANDLER(mtcrf, 0x1F, 0x10, 0x04, 0x00000801, PPC_MISC) | ||
3624 | { | 3693 | { |
3625 | uint32_t crm, crn; | 3694 | uint32_t crm, crn; |
3626 | 3695 | ||
3627 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); | ||
3628 | crm = CRM(ctx->opcode); | 3696 | crm = CRM(ctx->opcode); |
3629 | if (likely((ctx->opcode & 0x00100000) || (crm ^ (crm - 1)) == 0)) { | 3697 | if (likely((ctx->opcode & 0x00100000) || (crm ^ (crm - 1)) == 0)) { |
3630 | crn = ffs(crm); | 3698 | crn = ffs(crm); |
3631 | - gen_op_srli_T0(crn * 4); | ||
3632 | - tcg_gen_andi_i32(cpu_crf[7 - crn], cpu_T[0], 0xf); | 3699 | + tcg_gen_shri_i32(cpu_crf[7 - crn], cpu_gpr[rS(ctx->opcode)], crn * 4); |
3700 | + tcg_gen_andi_i32(cpu_crf[7 - crn], cpu_crf[7 - crn], 0xf); | ||
3633 | } else { | 3701 | } else { |
3634 | - gen_op_store_cr(crm); | 3702 | + TCGv temp = tcg_const_tl(crm); |
3703 | + tcg_gen_helper_0_2(helper_store_cr, cpu_gpr[rS(ctx->opcode)], temp); | ||
3704 | + tcg_temp_free(temp); | ||
3635 | } | 3705 | } |
3636 | } | 3706 | } |
3637 | 3707 | ||
@@ -4183,7 +4253,7 @@ GEN_HANDLER(abs, 0x1F, 0x08, 0x0B, 0x0000F800, PPC_POWER_BR) | @@ -4183,7 +4253,7 @@ GEN_HANDLER(abs, 0x1F, 0x08, 0x0B, 0x0000F800, PPC_POWER_BR) | ||
4183 | gen_op_POWER_abs(); | 4253 | gen_op_POWER_abs(); |
4184 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4254 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4185 | if (unlikely(Rc(ctx->opcode) != 0)) | 4255 | if (unlikely(Rc(ctx->opcode) != 0)) |
4186 | - gen_set_Rc0(ctx); | 4256 | + gen_set_Rc0(ctx, cpu_T[0]); |
4187 | } | 4257 | } |
4188 | 4258 | ||
4189 | /* abso - abso. */ | 4259 | /* abso - abso. */ |
@@ -4193,7 +4263,7 @@ GEN_HANDLER(abso, 0x1F, 0x08, 0x1B, 0x0000F800, PPC_POWER_BR) | @@ -4193,7 +4263,7 @@ GEN_HANDLER(abso, 0x1F, 0x08, 0x1B, 0x0000F800, PPC_POWER_BR) | ||
4193 | gen_op_POWER_abso(); | 4263 | gen_op_POWER_abso(); |
4194 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4264 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4195 | if (unlikely(Rc(ctx->opcode) != 0)) | 4265 | if (unlikely(Rc(ctx->opcode) != 0)) |
4196 | - gen_set_Rc0(ctx); | 4266 | + gen_set_Rc0(ctx, cpu_T[0]); |
4197 | } | 4267 | } |
4198 | 4268 | ||
4199 | /* clcs */ | 4269 | /* clcs */ |
@@ -4213,7 +4283,7 @@ GEN_HANDLER(div, 0x1F, 0x0B, 0x0A, 0x00000000, PPC_POWER_BR) | @@ -4213,7 +4283,7 @@ GEN_HANDLER(div, 0x1F, 0x0B, 0x0A, 0x00000000, PPC_POWER_BR) | ||
4213 | gen_op_POWER_div(); | 4283 | gen_op_POWER_div(); |
4214 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4284 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4215 | if (unlikely(Rc(ctx->opcode) != 0)) | 4285 | if (unlikely(Rc(ctx->opcode) != 0)) |
4216 | - gen_set_Rc0(ctx); | 4286 | + gen_set_Rc0(ctx, cpu_T[0]); |
4217 | } | 4287 | } |
4218 | 4288 | ||
4219 | /* divo - divo. */ | 4289 | /* divo - divo. */ |
@@ -4224,7 +4294,7 @@ GEN_HANDLER(divo, 0x1F, 0x0B, 0x1A, 0x00000000, PPC_POWER_BR) | @@ -4224,7 +4294,7 @@ GEN_HANDLER(divo, 0x1F, 0x0B, 0x1A, 0x00000000, PPC_POWER_BR) | ||
4224 | gen_op_POWER_divo(); | 4294 | gen_op_POWER_divo(); |
4225 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4295 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4226 | if (unlikely(Rc(ctx->opcode) != 0)) | 4296 | if (unlikely(Rc(ctx->opcode) != 0)) |
4227 | - gen_set_Rc0(ctx); | 4297 | + gen_set_Rc0(ctx, cpu_T[0]); |
4228 | } | 4298 | } |
4229 | 4299 | ||
4230 | /* divs - divs. */ | 4300 | /* divs - divs. */ |
@@ -4235,7 +4305,7 @@ GEN_HANDLER(divs, 0x1F, 0x0B, 0x0B, 0x00000000, PPC_POWER_BR) | @@ -4235,7 +4305,7 @@ GEN_HANDLER(divs, 0x1F, 0x0B, 0x0B, 0x00000000, PPC_POWER_BR) | ||
4235 | gen_op_POWER_divs(); | 4305 | gen_op_POWER_divs(); |
4236 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4306 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4237 | if (unlikely(Rc(ctx->opcode) != 0)) | 4307 | if (unlikely(Rc(ctx->opcode) != 0)) |
4238 | - gen_set_Rc0(ctx); | 4308 | + gen_set_Rc0(ctx, cpu_T[0]); |
4239 | } | 4309 | } |
4240 | 4310 | ||
4241 | /* divso - divso. */ | 4311 | /* divso - divso. */ |
@@ -4246,7 +4316,7 @@ GEN_HANDLER(divso, 0x1F, 0x0B, 0x1B, 0x00000000, PPC_POWER_BR) | @@ -4246,7 +4316,7 @@ GEN_HANDLER(divso, 0x1F, 0x0B, 0x1B, 0x00000000, PPC_POWER_BR) | ||
4246 | gen_op_POWER_divso(); | 4316 | gen_op_POWER_divso(); |
4247 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4317 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4248 | if (unlikely(Rc(ctx->opcode) != 0)) | 4318 | if (unlikely(Rc(ctx->opcode) != 0)) |
4249 | - gen_set_Rc0(ctx); | 4319 | + gen_set_Rc0(ctx, cpu_T[0]); |
4250 | } | 4320 | } |
4251 | 4321 | ||
4252 | /* doz - doz. */ | 4322 | /* doz - doz. */ |
@@ -4257,7 +4327,7 @@ GEN_HANDLER(doz, 0x1F, 0x08, 0x08, 0x00000000, PPC_POWER_BR) | @@ -4257,7 +4327,7 @@ GEN_HANDLER(doz, 0x1F, 0x08, 0x08, 0x00000000, PPC_POWER_BR) | ||
4257 | gen_op_POWER_doz(); | 4327 | gen_op_POWER_doz(); |
4258 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4328 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4259 | if (unlikely(Rc(ctx->opcode) != 0)) | 4329 | if (unlikely(Rc(ctx->opcode) != 0)) |
4260 | - gen_set_Rc0(ctx); | 4330 | + gen_set_Rc0(ctx, cpu_T[0]); |
4261 | } | 4331 | } |
4262 | 4332 | ||
4263 | /* dozo - dozo. */ | 4333 | /* dozo - dozo. */ |
@@ -4268,7 +4338,7 @@ GEN_HANDLER(dozo, 0x1F, 0x08, 0x18, 0x00000000, PPC_POWER_BR) | @@ -4268,7 +4338,7 @@ GEN_HANDLER(dozo, 0x1F, 0x08, 0x18, 0x00000000, PPC_POWER_BR) | ||
4268 | gen_op_POWER_dozo(); | 4338 | gen_op_POWER_dozo(); |
4269 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4339 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4270 | if (unlikely(Rc(ctx->opcode) != 0)) | 4340 | if (unlikely(Rc(ctx->opcode) != 0)) |
4271 | - gen_set_Rc0(ctx); | 4341 | + gen_set_Rc0(ctx, cpu_T[0]); |
4272 | } | 4342 | } |
4273 | 4343 | ||
4274 | /* dozi */ | 4344 | /* dozi */ |
@@ -4320,7 +4390,7 @@ GEN_HANDLER(lscbx, 0x1F, 0x15, 0x08, 0x00000000, PPC_POWER_BR) | @@ -4320,7 +4390,7 @@ GEN_HANDLER(lscbx, 0x1F, 0x15, 0x08, 0x00000000, PPC_POWER_BR) | ||
4320 | tcg_gen_andi_tl(cpu_xer, cpu_xer, ~0x7F); | 4390 | tcg_gen_andi_tl(cpu_xer, cpu_xer, ~0x7F); |
4321 | tcg_gen_or_tl(cpu_xer, cpu_xer, cpu_T[0]); | 4391 | tcg_gen_or_tl(cpu_xer, cpu_xer, cpu_T[0]); |
4322 | if (unlikely(Rc(ctx->opcode) != 0)) | 4392 | if (unlikely(Rc(ctx->opcode) != 0)) |
4323 | - gen_set_Rc0(ctx); | 4393 | + gen_set_Rc0(ctx, cpu_T[0]); |
4324 | } | 4394 | } |
4325 | 4395 | ||
4326 | /* maskg - maskg. */ | 4396 | /* maskg - maskg. */ |
@@ -4331,7 +4401,7 @@ GEN_HANDLER(maskg, 0x1F, 0x1D, 0x00, 0x00000000, PPC_POWER_BR) | @@ -4331,7 +4401,7 @@ GEN_HANDLER(maskg, 0x1F, 0x1D, 0x00, 0x00000000, PPC_POWER_BR) | ||
4331 | gen_op_POWER_maskg(); | 4401 | gen_op_POWER_maskg(); |
4332 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4402 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4333 | if (unlikely(Rc(ctx->opcode) != 0)) | 4403 | if (unlikely(Rc(ctx->opcode) != 0)) |
4334 | - gen_set_Rc0(ctx); | 4404 | + gen_set_Rc0(ctx, cpu_T[0]); |
4335 | } | 4405 | } |
4336 | 4406 | ||
4337 | /* maskir - maskir. */ | 4407 | /* maskir - maskir. */ |
@@ -4343,7 +4413,7 @@ GEN_HANDLER(maskir, 0x1F, 0x1D, 0x10, 0x00000000, PPC_POWER_BR) | @@ -4343,7 +4413,7 @@ GEN_HANDLER(maskir, 0x1F, 0x1D, 0x10, 0x00000000, PPC_POWER_BR) | ||
4343 | gen_op_POWER_maskir(); | 4413 | gen_op_POWER_maskir(); |
4344 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4414 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4345 | if (unlikely(Rc(ctx->opcode) != 0)) | 4415 | if (unlikely(Rc(ctx->opcode) != 0)) |
4346 | - gen_set_Rc0(ctx); | 4416 | + gen_set_Rc0(ctx, cpu_T[0]); |
4347 | } | 4417 | } |
4348 | 4418 | ||
4349 | /* mul - mul. */ | 4419 | /* mul - mul. */ |
@@ -4354,7 +4424,7 @@ GEN_HANDLER(mul, 0x1F, 0x0B, 0x03, 0x00000000, PPC_POWER_BR) | @@ -4354,7 +4424,7 @@ GEN_HANDLER(mul, 0x1F, 0x0B, 0x03, 0x00000000, PPC_POWER_BR) | ||
4354 | gen_op_POWER_mul(); | 4424 | gen_op_POWER_mul(); |
4355 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4425 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4356 | if (unlikely(Rc(ctx->opcode) != 0)) | 4426 | if (unlikely(Rc(ctx->opcode) != 0)) |
4357 | - gen_set_Rc0(ctx); | 4427 | + gen_set_Rc0(ctx, cpu_T[0]); |
4358 | } | 4428 | } |
4359 | 4429 | ||
4360 | /* mulo - mulo. */ | 4430 | /* mulo - mulo. */ |
@@ -4365,7 +4435,7 @@ GEN_HANDLER(mulo, 0x1F, 0x0B, 0x13, 0x00000000, PPC_POWER_BR) | @@ -4365,7 +4435,7 @@ GEN_HANDLER(mulo, 0x1F, 0x0B, 0x13, 0x00000000, PPC_POWER_BR) | ||
4365 | gen_op_POWER_mulo(); | 4435 | gen_op_POWER_mulo(); |
4366 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4436 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4367 | if (unlikely(Rc(ctx->opcode) != 0)) | 4437 | if (unlikely(Rc(ctx->opcode) != 0)) |
4368 | - gen_set_Rc0(ctx); | 4438 | + gen_set_Rc0(ctx, cpu_T[0]); |
4369 | } | 4439 | } |
4370 | 4440 | ||
4371 | /* nabs - nabs. */ | 4441 | /* nabs - nabs. */ |
@@ -4375,7 +4445,7 @@ GEN_HANDLER(nabs, 0x1F, 0x08, 0x0F, 0x00000000, PPC_POWER_BR) | @@ -4375,7 +4445,7 @@ GEN_HANDLER(nabs, 0x1F, 0x08, 0x0F, 0x00000000, PPC_POWER_BR) | ||
4375 | gen_op_POWER_nabs(); | 4445 | gen_op_POWER_nabs(); |
4376 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4446 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4377 | if (unlikely(Rc(ctx->opcode) != 0)) | 4447 | if (unlikely(Rc(ctx->opcode) != 0)) |
4378 | - gen_set_Rc0(ctx); | 4448 | + gen_set_Rc0(ctx, cpu_T[0]); |
4379 | } | 4449 | } |
4380 | 4450 | ||
4381 | /* nabso - nabso. */ | 4451 | /* nabso - nabso. */ |
@@ -4385,7 +4455,7 @@ GEN_HANDLER(nabso, 0x1F, 0x08, 0x1F, 0x00000000, PPC_POWER_BR) | @@ -4385,7 +4455,7 @@ GEN_HANDLER(nabso, 0x1F, 0x08, 0x1F, 0x00000000, PPC_POWER_BR) | ||
4385 | gen_op_POWER_nabso(); | 4455 | gen_op_POWER_nabso(); |
4386 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); | 4456 | tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); |
4387 | if (unlikely(Rc(ctx->opcode) != 0)) | 4457 | if (unlikely(Rc(ctx->opcode) != 0)) |
4388 | - gen_set_Rc0(ctx); | 4458 | + gen_set_Rc0(ctx, cpu_T[0]); |
4389 | } | 4459 | } |
4390 | 4460 | ||
4391 | /* rlmi - rlmi. */ | 4461 | /* rlmi - rlmi. */ |
@@ -4401,7 +4471,7 @@ GEN_HANDLER(rlmi, 0x16, 0xFF, 0xFF, 0x00000000, PPC_POWER_BR) | @@ -4401,7 +4471,7 @@ GEN_HANDLER(rlmi, 0x16, 0xFF, 0xFF, 0x00000000, PPC_POWER_BR) | ||
4401 | gen_op_POWER_rlmi(MASK(mb, me), ~MASK(mb, me)); | 4471 | gen_op_POWER_rlmi(MASK(mb, me), ~MASK(mb, me)); |
4402 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4472 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4403 | if (unlikely(Rc(ctx->opcode) != 0)) | 4473 | if (unlikely(Rc(ctx->opcode) != 0)) |
4404 | - gen_set_Rc0(ctx); | 4474 | + gen_set_Rc0(ctx, cpu_T[0]); |
4405 | } | 4475 | } |
4406 | 4476 | ||
4407 | /* rrib - rrib. */ | 4477 | /* rrib - rrib. */ |
@@ -4413,7 +4483,7 @@ GEN_HANDLER(rrib, 0x1F, 0x19, 0x10, 0x00000000, PPC_POWER_BR) | @@ -4413,7 +4483,7 @@ GEN_HANDLER(rrib, 0x1F, 0x19, 0x10, 0x00000000, PPC_POWER_BR) | ||
4413 | gen_op_POWER_rrib(); | 4483 | gen_op_POWER_rrib(); |
4414 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4484 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4415 | if (unlikely(Rc(ctx->opcode) != 0)) | 4485 | if (unlikely(Rc(ctx->opcode) != 0)) |
4416 | - gen_set_Rc0(ctx); | 4486 | + gen_set_Rc0(ctx, cpu_T[0]); |
4417 | } | 4487 | } |
4418 | 4488 | ||
4419 | /* sle - sle. */ | 4489 | /* sle - sle. */ |
@@ -4424,7 +4494,7 @@ GEN_HANDLER(sle, 0x1F, 0x19, 0x04, 0x00000000, PPC_POWER_BR) | @@ -4424,7 +4494,7 @@ GEN_HANDLER(sle, 0x1F, 0x19, 0x04, 0x00000000, PPC_POWER_BR) | ||
4424 | gen_op_POWER_sle(); | 4494 | gen_op_POWER_sle(); |
4425 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4495 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4426 | if (unlikely(Rc(ctx->opcode) != 0)) | 4496 | if (unlikely(Rc(ctx->opcode) != 0)) |
4427 | - gen_set_Rc0(ctx); | 4497 | + gen_set_Rc0(ctx, cpu_T[0]); |
4428 | } | 4498 | } |
4429 | 4499 | ||
4430 | /* sleq - sleq. */ | 4500 | /* sleq - sleq. */ |
@@ -4435,7 +4505,7 @@ GEN_HANDLER(sleq, 0x1F, 0x19, 0x06, 0x00000000, PPC_POWER_BR) | @@ -4435,7 +4505,7 @@ GEN_HANDLER(sleq, 0x1F, 0x19, 0x06, 0x00000000, PPC_POWER_BR) | ||
4435 | gen_op_POWER_sleq(); | 4505 | gen_op_POWER_sleq(); |
4436 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4506 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4437 | if (unlikely(Rc(ctx->opcode) != 0)) | 4507 | if (unlikely(Rc(ctx->opcode) != 0)) |
4438 | - gen_set_Rc0(ctx); | 4508 | + gen_set_Rc0(ctx, cpu_T[0]); |
4439 | } | 4509 | } |
4440 | 4510 | ||
4441 | /* sliq - sliq. */ | 4511 | /* sliq - sliq. */ |
@@ -4446,7 +4516,7 @@ GEN_HANDLER(sliq, 0x1F, 0x18, 0x05, 0x00000000, PPC_POWER_BR) | @@ -4446,7 +4516,7 @@ GEN_HANDLER(sliq, 0x1F, 0x18, 0x05, 0x00000000, PPC_POWER_BR) | ||
4446 | gen_op_POWER_sle(); | 4516 | gen_op_POWER_sle(); |
4447 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4517 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4448 | if (unlikely(Rc(ctx->opcode) != 0)) | 4518 | if (unlikely(Rc(ctx->opcode) != 0)) |
4449 | - gen_set_Rc0(ctx); | 4519 | + gen_set_Rc0(ctx, cpu_T[0]); |
4450 | } | 4520 | } |
4451 | 4521 | ||
4452 | /* slliq - slliq. */ | 4522 | /* slliq - slliq. */ |
@@ -4457,7 +4527,7 @@ GEN_HANDLER(slliq, 0x1F, 0x18, 0x07, 0x00000000, PPC_POWER_BR) | @@ -4457,7 +4527,7 @@ GEN_HANDLER(slliq, 0x1F, 0x18, 0x07, 0x00000000, PPC_POWER_BR) | ||
4457 | gen_op_POWER_sleq(); | 4527 | gen_op_POWER_sleq(); |
4458 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4528 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4459 | if (unlikely(Rc(ctx->opcode) != 0)) | 4529 | if (unlikely(Rc(ctx->opcode) != 0)) |
4460 | - gen_set_Rc0(ctx); | 4530 | + gen_set_Rc0(ctx, cpu_T[0]); |
4461 | } | 4531 | } |
4462 | 4532 | ||
4463 | /* sllq - sllq. */ | 4533 | /* sllq - sllq. */ |
@@ -4468,7 +4538,7 @@ GEN_HANDLER(sllq, 0x1F, 0x18, 0x06, 0x00000000, PPC_POWER_BR) | @@ -4468,7 +4538,7 @@ GEN_HANDLER(sllq, 0x1F, 0x18, 0x06, 0x00000000, PPC_POWER_BR) | ||
4468 | gen_op_POWER_sllq(); | 4538 | gen_op_POWER_sllq(); |
4469 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4539 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4470 | if (unlikely(Rc(ctx->opcode) != 0)) | 4540 | if (unlikely(Rc(ctx->opcode) != 0)) |
4471 | - gen_set_Rc0(ctx); | 4541 | + gen_set_Rc0(ctx, cpu_T[0]); |
4472 | } | 4542 | } |
4473 | 4543 | ||
4474 | /* slq - slq. */ | 4544 | /* slq - slq. */ |
@@ -4479,7 +4549,7 @@ GEN_HANDLER(slq, 0x1F, 0x18, 0x04, 0x00000000, PPC_POWER_BR) | @@ -4479,7 +4549,7 @@ GEN_HANDLER(slq, 0x1F, 0x18, 0x04, 0x00000000, PPC_POWER_BR) | ||
4479 | gen_op_POWER_slq(); | 4549 | gen_op_POWER_slq(); |
4480 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4550 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4481 | if (unlikely(Rc(ctx->opcode) != 0)) | 4551 | if (unlikely(Rc(ctx->opcode) != 0)) |
4482 | - gen_set_Rc0(ctx); | 4552 | + gen_set_Rc0(ctx, cpu_T[0]); |
4483 | } | 4553 | } |
4484 | 4554 | ||
4485 | /* sraiq - sraiq. */ | 4555 | /* sraiq - sraiq. */ |
@@ -4490,7 +4560,7 @@ GEN_HANDLER(sraiq, 0x1F, 0x18, 0x1D, 0x00000000, PPC_POWER_BR) | @@ -4490,7 +4560,7 @@ GEN_HANDLER(sraiq, 0x1F, 0x18, 0x1D, 0x00000000, PPC_POWER_BR) | ||
4490 | gen_op_POWER_sraq(); | 4560 | gen_op_POWER_sraq(); |
4491 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4561 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4492 | if (unlikely(Rc(ctx->opcode) != 0)) | 4562 | if (unlikely(Rc(ctx->opcode) != 0)) |
4493 | - gen_set_Rc0(ctx); | 4563 | + gen_set_Rc0(ctx, cpu_T[0]); |
4494 | } | 4564 | } |
4495 | 4565 | ||
4496 | /* sraq - sraq. */ | 4566 | /* sraq - sraq. */ |
@@ -4501,7 +4571,7 @@ GEN_HANDLER(sraq, 0x1F, 0x18, 0x1C, 0x00000000, PPC_POWER_BR) | @@ -4501,7 +4571,7 @@ GEN_HANDLER(sraq, 0x1F, 0x18, 0x1C, 0x00000000, PPC_POWER_BR) | ||
4501 | gen_op_POWER_sraq(); | 4571 | gen_op_POWER_sraq(); |
4502 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4572 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4503 | if (unlikely(Rc(ctx->opcode) != 0)) | 4573 | if (unlikely(Rc(ctx->opcode) != 0)) |
4504 | - gen_set_Rc0(ctx); | 4574 | + gen_set_Rc0(ctx, cpu_T[0]); |
4505 | } | 4575 | } |
4506 | 4576 | ||
4507 | /* sre - sre. */ | 4577 | /* sre - sre. */ |
@@ -4512,7 +4582,7 @@ GEN_HANDLER(sre, 0x1F, 0x19, 0x14, 0x00000000, PPC_POWER_BR) | @@ -4512,7 +4582,7 @@ GEN_HANDLER(sre, 0x1F, 0x19, 0x14, 0x00000000, PPC_POWER_BR) | ||
4512 | gen_op_POWER_sre(); | 4582 | gen_op_POWER_sre(); |
4513 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4583 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4514 | if (unlikely(Rc(ctx->opcode) != 0)) | 4584 | if (unlikely(Rc(ctx->opcode) != 0)) |
4515 | - gen_set_Rc0(ctx); | 4585 | + gen_set_Rc0(ctx, cpu_T[0]); |
4516 | } | 4586 | } |
4517 | 4587 | ||
4518 | /* srea - srea. */ | 4588 | /* srea - srea. */ |
@@ -4523,7 +4593,7 @@ GEN_HANDLER(srea, 0x1F, 0x19, 0x1C, 0x00000000, PPC_POWER_BR) | @@ -4523,7 +4593,7 @@ GEN_HANDLER(srea, 0x1F, 0x19, 0x1C, 0x00000000, PPC_POWER_BR) | ||
4523 | gen_op_POWER_srea(); | 4593 | gen_op_POWER_srea(); |
4524 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4594 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4525 | if (unlikely(Rc(ctx->opcode) != 0)) | 4595 | if (unlikely(Rc(ctx->opcode) != 0)) |
4526 | - gen_set_Rc0(ctx); | 4596 | + gen_set_Rc0(ctx, cpu_T[0]); |
4527 | } | 4597 | } |
4528 | 4598 | ||
4529 | /* sreq */ | 4599 | /* sreq */ |
@@ -4534,7 +4604,7 @@ GEN_HANDLER(sreq, 0x1F, 0x19, 0x16, 0x00000000, PPC_POWER_BR) | @@ -4534,7 +4604,7 @@ GEN_HANDLER(sreq, 0x1F, 0x19, 0x16, 0x00000000, PPC_POWER_BR) | ||
4534 | gen_op_POWER_sreq(); | 4604 | gen_op_POWER_sreq(); |
4535 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4605 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4536 | if (unlikely(Rc(ctx->opcode) != 0)) | 4606 | if (unlikely(Rc(ctx->opcode) != 0)) |
4537 | - gen_set_Rc0(ctx); | 4607 | + gen_set_Rc0(ctx, cpu_T[0]); |
4538 | } | 4608 | } |
4539 | 4609 | ||
4540 | /* sriq */ | 4610 | /* sriq */ |
@@ -4545,7 +4615,7 @@ GEN_HANDLER(sriq, 0x1F, 0x18, 0x15, 0x00000000, PPC_POWER_BR) | @@ -4545,7 +4615,7 @@ GEN_HANDLER(sriq, 0x1F, 0x18, 0x15, 0x00000000, PPC_POWER_BR) | ||
4545 | gen_op_POWER_srq(); | 4615 | gen_op_POWER_srq(); |
4546 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4616 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4547 | if (unlikely(Rc(ctx->opcode) != 0)) | 4617 | if (unlikely(Rc(ctx->opcode) != 0)) |
4548 | - gen_set_Rc0(ctx); | 4618 | + gen_set_Rc0(ctx, cpu_T[0]); |
4549 | } | 4619 | } |
4550 | 4620 | ||
4551 | /* srliq */ | 4621 | /* srliq */ |
@@ -4557,7 +4627,7 @@ GEN_HANDLER(srliq, 0x1F, 0x18, 0x17, 0x00000000, PPC_POWER_BR) | @@ -4557,7 +4627,7 @@ GEN_HANDLER(srliq, 0x1F, 0x18, 0x17, 0x00000000, PPC_POWER_BR) | ||
4557 | gen_op_POWER_srlq(); | 4627 | gen_op_POWER_srlq(); |
4558 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4628 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4559 | if (unlikely(Rc(ctx->opcode) != 0)) | 4629 | if (unlikely(Rc(ctx->opcode) != 0)) |
4560 | - gen_set_Rc0(ctx); | 4630 | + gen_set_Rc0(ctx, cpu_T[0]); |
4561 | } | 4631 | } |
4562 | 4632 | ||
4563 | /* srlq */ | 4633 | /* srlq */ |
@@ -4568,7 +4638,7 @@ GEN_HANDLER(srlq, 0x1F, 0x18, 0x16, 0x00000000, PPC_POWER_BR) | @@ -4568,7 +4638,7 @@ GEN_HANDLER(srlq, 0x1F, 0x18, 0x16, 0x00000000, PPC_POWER_BR) | ||
4568 | gen_op_POWER_srlq(); | 4638 | gen_op_POWER_srlq(); |
4569 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4639 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4570 | if (unlikely(Rc(ctx->opcode) != 0)) | 4640 | if (unlikely(Rc(ctx->opcode) != 0)) |
4571 | - gen_set_Rc0(ctx); | 4641 | + gen_set_Rc0(ctx, cpu_T[0]); |
4572 | } | 4642 | } |
4573 | 4643 | ||
4574 | /* srq */ | 4644 | /* srq */ |
@@ -4579,7 +4649,7 @@ GEN_HANDLER(srq, 0x1F, 0x18, 0x14, 0x00000000, PPC_POWER_BR) | @@ -4579,7 +4649,7 @@ GEN_HANDLER(srq, 0x1F, 0x18, 0x14, 0x00000000, PPC_POWER_BR) | ||
4579 | gen_op_POWER_srq(); | 4649 | gen_op_POWER_srq(); |
4580 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | 4650 | tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); |
4581 | if (unlikely(Rc(ctx->opcode) != 0)) | 4651 | if (unlikely(Rc(ctx->opcode) != 0)) |
4582 | - gen_set_Rc0(ctx); | 4652 | + gen_set_Rc0(ctx, cpu_T[0]); |
4583 | } | 4653 | } |
4584 | 4654 | ||
4585 | /* PowerPC 602 specific instructions */ | 4655 | /* PowerPC 602 specific instructions */ |
@@ -4992,7 +5062,7 @@ static always_inline void gen_405_mulladd_insn (DisasContext *ctx, | @@ -4992,7 +5062,7 @@ static always_inline void gen_405_mulladd_insn (DisasContext *ctx, | ||
4992 | tcg_gen_mov_tl(cpu_gpr[rt], cpu_T[0]); | 5062 | tcg_gen_mov_tl(cpu_gpr[rt], cpu_T[0]); |
4993 | if (unlikely(Rc) != 0) { | 5063 | if (unlikely(Rc) != 0) { |
4994 | /* Update Rc0 */ | 5064 | /* Update Rc0 */ |
4995 | - gen_set_Rc0(ctx); | 5065 | + gen_set_Rc0(ctx, cpu_T[0]); |
4996 | } | 5066 | } |
4997 | } | 5067 | } |
4998 | 5068 |