diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2011-04-20 13:04:23 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2011-04-25 11:18:33 +0200 |
commit | be1c17c7fdc16d9cb88f4092f23a494b942b68d7 (patch) | |
tree | 8efd5c6494eb0efd390b9a63a0fa43c9bff6864d /target-i386/op_helper.c | |
parent | 4cc5383f807a7d70942de51326a8dddad7331fa5 (diff) |
target-i386: fix helper_fscale() wrt softfloat
Use the scalbn softfloat function to implement helper_fscale(). This
fixes corner cases (e.g. NaN) and makes a few more GNU libc math tests
to pass.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-i386/op_helper.c')
-rw-r--r-- | target-i386/op_helper.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index fba536f0fb..dce28fa054 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -4174,7 +4174,12 @@ void helper_frndint(void) void helper_fscale(void) { - ST0 = ldexp (ST0, (int)(ST1)); + if (floatx_is_any_nan(ST1)) { + ST0 = ST1; + } else { + int n = floatx_to_int32_round_to_zero(ST1, &env->fp_status); + ST0 = floatx_scalbn(ST0, n, &env->fp_status); + } } void helper_fsin(void) |