summaryrefslogtreecommitdiff
path: root/target-mips/op_helper.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-27 19:01:46 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-27 19:01:46 +0000
commite3b60f1d9e1f73e75095e885af66473400bef8aa (patch)
tree29d5a5ddca0a2402563b136082d7df961098ddca /target-mips/op_helper.c
parent403f14ef1e6f481d9b833e53846c421cf76607e3 (diff)
downloadqemu-e3b60f1d9e1f73e75095e885af66473400bef8aa.tar.gz
Fix computation for ceil, floor and round instructions.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3028 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-mips/op_helper.c')
-rw-r--r--target-mips/op_helper.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 94782252eb..2b100a2891 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -783,6 +783,7 @@ 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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -791,7 +792,8 @@ FLOAT_OP(roundl, d)
FLOAT_OP(roundl, s)
{
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
- DT2 = float32_round_to_int(FST0, &env->fp_status);
+ WT2 = float32_round_to_int(FST0, &env->fp_status);
+ DT2 = float32_to_int64(WT2, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -800,7 +802,10 @@ FLOAT_OP(roundl, s)
FLOAT_OP(roundw, d)
{
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
- WT2 = float64_round_to_int(FDT0, &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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -810,6 +815,7 @@ 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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -849,6 +855,7 @@ 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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -857,7 +864,8 @@ FLOAT_OP(ceill, d)
FLOAT_OP(ceill, s)
{
set_float_rounding_mode(float_round_up, &env->fp_status);
- DT2 = float32_round_to_int(FST0, &env->fp_status);
+ WT2 = float32_round_to_int(FST0, &env->fp_status);
+ DT2 = float32_to_int64(WT2, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -866,7 +874,10 @@ FLOAT_OP(ceill, s)
FLOAT_OP(ceilw, d)
{
set_float_rounding_mode(float_round_up, &env->fp_status);
- WT2 = float64_round_to_int(FDT0, &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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -876,6 +887,7 @@ 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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -886,6 +898,7 @@ 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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -894,7 +907,8 @@ FLOAT_OP(floorl, d)
FLOAT_OP(floorl, s)
{
set_float_rounding_mode(float_round_down, &env->fp_status);
- DT2 = float32_round_to_int(FST0, &env->fp_status);
+ WT2 = float32_round_to_int(FST0, &env->fp_status);
+ DT2 = float32_to_int64(WT2, &env->fp_status);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -903,7 +917,10 @@ FLOAT_OP(floorl, s)
FLOAT_OP(floorw, d)
{
set_float_rounding_mode(float_round_down, &env->fp_status);
- WT2 = float64_round_to_int(FDT0, &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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))
@@ -913,6 +930,7 @@ 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);
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fcr31) & (FP_OVERFLOW | FP_INVALID))