aboutsummaryrefslogtreecommitdiff
path: root/target-sh4/op_helper.c
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-09-01 22:11:56 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-09-01 22:11:56 +0000
commitcc4ba6a9826d94bb46f13856927f7883fd6b9d51 (patch)
treea09107efdd29eed05e38f060f93857497765cb96 /target-sh4/op_helper.c
parent105a1f04b5c9250c41e61ebb00cd2d254eb766ab (diff)
downloadqemu-cc4ba6a9826d94bb46f13856927f7883fd6b9d51.zip
qemu-cc4ba6a9826d94bb46f13856927f7883fd6b9d51.tar.gz
qemu-cc4ba6a9826d94bb46f13856927f7883fd6b9d51.tar.bz2
SH4: convert floating-point ops to TCG
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5124 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-sh4/op_helper.c')
-rw-r--r--target-sh4/op_helper.c148
1 files changed, 148 insertions, 0 deletions
diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c
index d3bde5c..5d9c414 100644
--- a/target-sh4/op_helper.c
+++ b/target-sh4/op_helper.c
@@ -366,6 +366,16 @@ uint32_t helper_subv(uint32_t arg0, uint32_t arg1)
return arg1;
}
+static inline void set_t(void)
+{
+ env->sr |= SR_T;
+}
+
+static inline void clr_t(void)
+{
+ env->sr &= ~SR_T;
+}
+
void helper_ld_fpscr(uint32_t val)
{
env->fpscr = val & 0x003fffff;
@@ -374,3 +384,141 @@ void helper_ld_fpscr(uint32_t val)
else
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
}
+
+uint32_t helper_fabs_FT(uint32_t t0)
+{
+ float32 ret = float32_abs(*(float32*)&t0);
+ return *(uint32_t*)(&ret);
+}
+
+uint64_t helper_fabs_DT(uint64_t t0)
+{
+ float64 ret = float64_abs(*(float64*)&t0);
+ return *(uint64_t*)(&ret);
+}
+
+uint32_t helper_fadd_FT(uint32_t t0, uint32_t t1)
+{
+ float32 ret = float32_add(*(float32*)&t0, *(float32*)&t1, &env->fp_status);
+ return *(uint32_t*)(&ret);
+}
+
+uint64_t helper_fadd_DT(uint64_t t0, uint64_t t1)
+{
+ float64 ret = float64_add(*(float64*)&t0, *(float64*)&t1, &env->fp_status);
+ return *(uint64_t*)(&ret);
+}
+
+void helper_fcmp_eq_FT(uint32_t t0, uint32_t t1)
+{
+ if (float32_compare(*(float32*)&t0, *(float32*)&t1, &env->fp_status) == 0)
+ set_t();
+ else
+ clr_t();
+}
+
+void helper_fcmp_eq_DT(uint64_t t0, uint64_t t1)
+{
+ if (float64_compare(*(float64*)&t0, *(float64*)&t1, &env->fp_status) == 0)
+ set_t();
+ else
+ clr_t();
+}
+
+void helper_fcmp_gt_FT(uint32_t t0, uint32_t t1)
+{
+ if (float32_compare(*(float32*)&t0, *(float32*)&t1, &env->fp_status) == 1)
+ set_t();
+ else
+ clr_t();
+}
+
+void helper_fcmp_gt_DT(uint64_t t0, uint64_t t1)
+{
+ if (float64_compare(*(float64*)&t0, *(float64*)&t1, &env->fp_status) == 1)
+ set_t();
+ else
+ clr_t();
+}
+
+uint64_t helper_fcnvsd_FT_DT(uint32_t t0)
+{
+ float64 ret = float32_to_float64(*(float32*)&t0, &env->fp_status);
+ return *(uint64_t*)(&ret);
+}
+
+uint32_t helper_fcnvds_DT_FT(uint64_t t0)
+{
+ float32 ret = float64_to_float32(*(float64*)&t0, &env->fp_status);
+ return *(uint32_t*)(&ret);
+}
+
+uint32_t helper_fdiv_FT(uint32_t t0, uint32_t t1)
+{
+ float32 ret = float32_div(*(float32*)&t0, *(float32*)&t1, &env->fp_status);
+ return *(uint32_t*)(&ret);
+}
+
+uint64_t helper_fdiv_DT(uint64_t t0, uint64_t t1)
+{
+ float64 ret = float64_div(*(float64*)&t0, *(float64*)&t1, &env->fp_status);
+ return *(uint64_t*)(&ret);
+}
+
+uint32_t helper_float_FT(uint32_t t0)
+{
+ float32 ret = int32_to_float32(t0, &env->fp_status);
+ return *(uint32_t*)(&ret);
+}
+
+uint64_t helper_float_DT(uint32_t t0)
+{
+ float64 ret = int32_to_float64(t0, &env->fp_status);
+ return *(uint64_t*)(&ret);
+}
+
+uint32_t helper_fmul_FT(uint32_t t0, uint32_t t1)
+{
+ float32 ret = float32_mul(*(float32*)&t0, *(float32*)&t1, &env->fp_status);
+ return *(uint32_t*)(&ret);
+}
+
+uint64_t helper_fmul_DT(uint64_t t0, uint64_t t1)
+{
+ float64 ret = float64_mul(*(float64*)&t0, *(float64*)&t1, &env->fp_status);
+ return *(uint64_t*)(&ret);
+}
+
+uint32_t helper_fsqrt_FT(uint32_t t0)
+{
+ float32 ret = float32_sqrt(*(float32*)&t0, &env->fp_status);
+ return *(uint32_t*)(&ret);
+}
+
+uint64_t helper_fsqrt_DT(uint64_t t0)
+{
+ float64 ret = float64_sqrt(*(float64*)&t0, &env->fp_status);
+ return *(uint64_t*)(&ret);
+}
+
+uint32_t helper_fsub_FT(uint32_t t0, uint32_t t1)
+{
+ float32 ret = float32_sub(*(float32*)&t0, *(float32*)&t1, &env->fp_status);
+ return *(uint32_t*)(&ret);
+}
+
+uint64_t helper_fsub_DT(uint64_t t0, uint64_t t1)
+{
+ float64 ret = float64_sub(*(float64*)&t0, *(float64*)&t1, &env->fp_status);
+ return *(uint64_t*)(&ret);
+}
+
+uint32_t helper_ftrc_FT(uint32_t t0)
+{
+ return float32_to_int32_round_to_zero(*(float32*)&t0, &env->fp_status);
+}
+
+uint32_t helper_ftrc_DT(uint64_t t0)
+{
+ return float64_to_int32_round_to_zero(*(float64*)&t0, &env->fp_status);
+}