summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-30 16:23:35 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-30 16:23:35 +0000
commitcf02a65c77772245bc7611f90a7393a038241e35 (patch)
tree218c9281827cd7404b06a60f9b334af03ad49541
parente49a3c8f85f7b7c14ba534c19b5a965be8c386a9 (diff)
downloadhqemu-cf02a65c77772245bc7611f90a7393a038241e35.zip
hqemu-cf02a65c77772245bc7611f90a7393a038241e35.tar.gz
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
-rw-r--r--target-ppc/helper.h2
-rw-r--r--target-ppc/op.c9
-rw-r--r--target-ppc/op_helper.c16
-rw-r--r--target-ppc/translate.c4
4 files changed, 11 insertions, 20 deletions
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 67ba014..d1aaf56 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -144,6 +144,8 @@ DEF_HELPER_1(load_6xx_tlbd, void, tl)
DEF_HELPER_1(load_6xx_tlbi, void, tl)
DEF_HELPER_1(load_74xx_tlbd, void, tl)
DEF_HELPER_1(load_74xx_tlbi, void, tl)
+
+DEF_HELPER_1(602_mfrom, tl, tl)
#endif
#include "def-helper.h"
diff --git a/target-ppc/op.c b/target-ppc/op.c
index 3fc89f4..ee67546 100644
--- a/target-ppc/op.c
+++ b/target-ppc/op.c
@@ -684,15 +684,6 @@ void OPPROTO op_POWER_rfsvc (void)
}
#endif
-/* PowerPC 602 specific instruction */
-#if !defined(CONFIG_USER_ONLY)
-void OPPROTO op_602_mfrom (void)
-{
- do_op_602_mfrom();
- RETURN();
-}
-#endif
-
/* PowerPC 4xx specific micro-ops */
void OPPROTO op_load_dcr (void)
{
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 1ea5a98..2a5e18e 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -1645,19 +1645,19 @@ void do_store_hid0_601 (void)
/* mfrom is the most crazy instruction ever seen, imho ! */
/* Real implementation uses a ROM table. Do the same */
#define USE_MFROM_ROM_TABLE
-void do_op_602_mfrom (void)
+target_ulong helper_602_mfrom (target_ulong arg)
{
- if (likely(T0 < 602)) {
+ if (likely(arg < 602)) {
#if defined(USE_MFROM_ROM_TABLE)
#include "mfrom_table.c"
- T0 = mfrom_ROM_table[T0];
+ return mfrom_ROM_table[T0];
#else
double d;
/* Extremly decomposed:
- * -T0 / 256
- * T0 = 256 * log10(10 + 1.0) + 0.5
+ * -arg / 256
+ * return 256 * log10(10 + 1.0) + 0.5
*/
- d = T0;
+ d = arg;
d = float64_div(d, 256, &env->fp_status);
d = float64_chs(d);
d = exp10(d); // XXX: use float emulation function
@@ -1665,10 +1665,10 @@ void do_op_602_mfrom (void)
d = log10(d); // XXX: use float emulation function
d = float64_mul(d, 256, &env->fp_status);
d = float64_add(d, 0.5, &env->fp_status);
- T0 = float64_round_to_int(d, &env->fp_status);
+ return float64_round_to_int(d, &env->fp_status);
#endif
} else {
- T0 = 0;
+ return 0;
}
}
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 083bf28..63e17de 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -4948,9 +4948,7 @@ GEN_HANDLER(mfrom, 0x1F, 0x09, 0x08, 0x03E0F801, PPC_602_SPEC)
GEN_EXCP_PRIVOPC(ctx);
return;
}
- tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
- gen_op_602_mfrom();
- tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
+ gen_helper_602_mfrom(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
#endif
}
OpenPOWER on IntegriCloud