Commit e3b60f1d authored by ths's avatar ths
Browse files

Fix computation for ceil, floor and round instructions.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3028 c046a42c-6fe2-441c-8c8c-71466251a162
parent 403f14ef
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment