Commit cf02a65c77772245bc7611f90a7393a038241e35

Authored by aurel32
1 parent e49a3c8f

target-ppc: convert mfrom instruction to TCG

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5823 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.h
@@ -144,6 +144,8 @@ DEF_HELPER_1(load_6xx_tlbd, void, tl) @@ -144,6 +144,8 @@ DEF_HELPER_1(load_6xx_tlbd, void, tl)
144 DEF_HELPER_1(load_6xx_tlbi, void, tl) 144 DEF_HELPER_1(load_6xx_tlbi, void, tl)
145 DEF_HELPER_1(load_74xx_tlbd, void, tl) 145 DEF_HELPER_1(load_74xx_tlbd, void, tl)
146 DEF_HELPER_1(load_74xx_tlbi, void, tl) 146 DEF_HELPER_1(load_74xx_tlbi, void, tl)
  147 +
  148 +DEF_HELPER_1(602_mfrom, tl, tl)
147 #endif 149 #endif
148 150
149 #include "def-helper.h" 151 #include "def-helper.h"
target-ppc/op.c
@@ -684,15 +684,6 @@ void OPPROTO op_POWER_rfsvc (void) @@ -684,15 +684,6 @@ void OPPROTO op_POWER_rfsvc (void)
684 } 684 }
685 #endif 685 #endif
686 686
687 -/* PowerPC 602 specific instruction */  
688 -#if !defined(CONFIG_USER_ONLY)  
689 -void OPPROTO op_602_mfrom (void)  
690 -{  
691 - do_op_602_mfrom();  
692 - RETURN();  
693 -}  
694 -#endif  
695 -  
696 /* PowerPC 4xx specific micro-ops */ 687 /* PowerPC 4xx specific micro-ops */
697 void OPPROTO op_load_dcr (void) 688 void OPPROTO op_load_dcr (void)
698 { 689 {
target-ppc/op_helper.c
@@ -1645,19 +1645,19 @@ void do_store_hid0_601 (void) @@ -1645,19 +1645,19 @@ void do_store_hid0_601 (void)
1645 /* mfrom is the most crazy instruction ever seen, imho ! */ 1645 /* mfrom is the most crazy instruction ever seen, imho ! */
1646 /* Real implementation uses a ROM table. Do the same */ 1646 /* Real implementation uses a ROM table. Do the same */
1647 #define USE_MFROM_ROM_TABLE 1647 #define USE_MFROM_ROM_TABLE
1648 -void do_op_602_mfrom (void) 1648 +target_ulong helper_602_mfrom (target_ulong arg)
1649 { 1649 {
1650 - if (likely(T0 < 602)) { 1650 + if (likely(arg < 602)) {
1651 #if defined(USE_MFROM_ROM_TABLE) 1651 #if defined(USE_MFROM_ROM_TABLE)
1652 #include "mfrom_table.c" 1652 #include "mfrom_table.c"
1653 - T0 = mfrom_ROM_table[T0]; 1653 + return mfrom_ROM_table[T0];
1654 #else 1654 #else
1655 double d; 1655 double d;
1656 /* Extremly decomposed: 1656 /* Extremly decomposed:
1657 - * -T0 / 256  
1658 - * T0 = 256 * log10(10 + 1.0) + 0.5 1657 + * -arg / 256
  1658 + * return 256 * log10(10 + 1.0) + 0.5
1659 */ 1659 */
1660 - d = T0; 1660 + d = arg;
1661 d = float64_div(d, 256, &env->fp_status); 1661 d = float64_div(d, 256, &env->fp_status);
1662 d = float64_chs(d); 1662 d = float64_chs(d);
1663 d = exp10(d); // XXX: use float emulation function 1663 d = exp10(d); // XXX: use float emulation function
@@ -1665,10 +1665,10 @@ void do_op_602_mfrom (void) @@ -1665,10 +1665,10 @@ void do_op_602_mfrom (void)
1665 d = log10(d); // XXX: use float emulation function 1665 d = log10(d); // XXX: use float emulation function
1666 d = float64_mul(d, 256, &env->fp_status); 1666 d = float64_mul(d, 256, &env->fp_status);
1667 d = float64_add(d, 0.5, &env->fp_status); 1667 d = float64_add(d, 0.5, &env->fp_status);
1668 - T0 = float64_round_to_int(d, &env->fp_status); 1668 + return float64_round_to_int(d, &env->fp_status);
1669 #endif 1669 #endif
1670 } else { 1670 } else {
1671 - T0 = 0; 1671 + return 0;
1672 } 1672 }
1673 } 1673 }
1674 1674
target-ppc/translate.c
@@ -4948,9 +4948,7 @@ GEN_HANDLER(mfrom, 0x1F, 0x09, 0x08, 0x03E0F801, PPC_602_SPEC) @@ -4948,9 +4948,7 @@ GEN_HANDLER(mfrom, 0x1F, 0x09, 0x08, 0x03E0F801, PPC_602_SPEC)
4948 GEN_EXCP_PRIVOPC(ctx); 4948 GEN_EXCP_PRIVOPC(ctx);
4949 return; 4949 return;
4950 } 4950 }
4951 - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);  
4952 - gen_op_602_mfrom();  
4953 - tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); 4951 + gen_helper_602_mfrom(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
4954 #endif 4952 #endif
4955 } 4953 }
4956 4954