aboutsummaryrefslogtreecommitdiff
path: root/target-mips
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-28 14:07:05 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-28 14:07:05 +0000
commit5e4ef64cfd8cfcd8eb76c70a0d837f06ca8c5467 (patch)
tree89cca924b663e570c3c7c033f20e69ed34eb8e5b /target-mips
parentea6e4fe2dd3594d04c03ddb0befc1c4a82ab4e83 (diff)
Simplify round/ceil/floor implementation, spotted by Fabrice Bellard.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3031 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-mips')
-rw-r--r--target-mips/op_helper.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 2b100a2891..477b80d516 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -782,8 +782,7 @@ FLOAT_OP(cvtw, d)
FLOAT_OP(roundl, d)
{
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
- DT2 = float64_round_to_int(FDT0, &env->fp_status);
- DT2 = float64_to_int64(DT2, &env->fp_status);
+ DT2 = float64_to_int64(FDT0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -792,8 +791,7 @@ FLOAT_OP(roundl, d)
FLOAT_OP(roundl, s)
{
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
- WT2 = float32_round_to_int(FST0, &env->fp_status);
- DT2 = float32_to_int64(WT2, &env->fp_status);
+ DT2 = float32_to_int64(FST0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -802,10 +800,7 @@ FLOAT_OP(roundl, s)
FLOAT_OP(roundw, d)
{
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
- DT2 = float64_round_to_int(FDT0, &env->fp_status);
-// ???
- env->fp_status.float_exception_flags &= ~float_flag_inexact;
- WT2 = float64_to_int32(DT2, &env->fp_status);
+ WT2 = float64_to_int32(FDT0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -814,8 +809,7 @@ FLOAT_OP(roundw, d)
FLOAT_OP(roundw, s)
{
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
- WT2 = float32_round_to_int(FST0, &env->fp_status);
- WT2 = float32_to_int32(WT2, &env->fp_status);
+ WT2 = float32_to_int32(FST0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -854,8 +848,7 @@ FLOAT_OP(truncw, s)
FLOAT_OP(ceill, d)
{
set_float_rounding_mode(float_round_up, &env->fp_status);
- DT2 = float64_round_to_int(FDT0, &env->fp_status);
- DT2 = float64_to_int64(DT2, &env->fp_status);
+ DT2 = float64_to_int64(FDT0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -864,8 +857,7 @@ FLOAT_OP(ceill, d)
FLOAT_OP(ceill, s)
{
set_float_rounding_mode(float_round_up, &env->fp_status);
- WT2 = float32_round_to_int(FST0, &env->fp_status);
- DT2 = float32_to_int64(WT2, &env->fp_status);
+ DT2 = float32_to_int64(FST0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -874,10 +866,7 @@ FLOAT_OP(ceill, s)
FLOAT_OP(ceilw, d)
{
set_float_rounding_mode(float_round_up, &env->fp_status);
- DT2 = float64_round_to_int(FDT0, &env->fp_status);
-// ???
- env->fp_status.float_exception_flags &= ~float_flag_inexact;
- WT2 = float64_to_int32(DT2, &env->fp_status);
+ WT2 = float64_to_int32(FDT0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -886,8 +875,7 @@ FLOAT_OP(ceilw, d)
FLOAT_OP(ceilw, s)
{
set_float_rounding_mode(float_round_up, &env->fp_status);
- WT2 = float32_round_to_int(FST0, &env->fp_status);
- WT2 = float32_to_int32(WT2, &env->fp_status);
+ WT2 = float32_to_int32(FST0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -897,8 +885,7 @@ FLOAT_OP(ceilw, s)
FLOAT_OP(floorl, d)
{
set_float_rounding_mode(float_round_down, &env->fp_status);
- DT2 = float64_round_to_int(FDT0, &env->fp_status);
- DT2 = float64_to_int64(DT2, &env->fp_status);
+ DT2 = float64_to_int64(FDT0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -907,8 +894,7 @@ FLOAT_OP(floorl, d)
FLOAT_OP(floorl, s)
{
set_float_rounding_mode(float_round_down, &env->fp_status);
- WT2 = float32_round_to_int(FST0, &env->fp_status);
- DT2 = float32_to_int64(WT2, &env->fp_status);
+ DT2 = float32_to_int64(FST0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -917,10 +903,7 @@ FLOAT_OP(floorl, s)
FLOAT_OP(floorw, d)
{
set_float_rounding_mode(float_round_down, &env->fp_status);
- DT2 = float64_round_to_int(FDT0, &env->fp_status);
-// ???
- env->fp_status.float_exception_flags &= ~float_flag_inexact;
- WT2 = float64_to_int32(DT2, &env->fp_status);
+ WT2 = float64_to_int32(FDT0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -929,8 +912,7 @@ FLOAT_OP(floorw, d)
FLOAT_OP(floorw, s)
{
set_float_rounding_mode(float_round_down, &env->fp_status);
- WT2 = float32_round_to_int(FST0, &env->fp_status);
- WT2 = float32_to_int32(WT2, &env->fp_status);
+ WT2 = float32_to_int32(FST0, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))