aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2020-05-07 00:44:14 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-10 12:10:17 -0400
commit0d48b436327955c69e2eb53f88aba9aa1e0dbaa0 (patch)
tree213a5ebda7167b9e886062d49a02a7d593d72bb3 /target
parentc415f2c58296d86e9abb7e4a133111acf7031da3 (diff)
downloadqemu-0d48b436327955c69e2eb53f88aba9aa1e0dbaa0.zip
qemu-0d48b436327955c69e2eb53f88aba9aa1e0dbaa0.tar.gz
qemu-0d48b436327955c69e2eb53f88aba9aa1e0dbaa0.tar.bz2
target/i386: fix fscale handling of signaling NaN
The implementation of the fscale instruction returns a NaN exponent unchanged. Fix it to return a quiet NaN when the provided exponent is a signaling NaN. Signed-off-by: Joseph Myers <joseph@codesourcery.com> Message-Id: <alpine.DEB.2.21.2005070043330.18350@digraph.polyomino.org.uk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target')
-rw-r--r--target/i386/fpu_helper.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/target/i386/fpu_helper.c b/target/i386/fpu_helper.c
index 568bd3b..0671de6 100644
--- a/target/i386/fpu_helper.c
+++ b/target/i386/fpu_helper.c
@@ -970,6 +970,10 @@ void helper_fscale(CPUX86State *env)
{
if (floatx80_is_any_nan(ST1)) {
ST0 = ST1;
+ if (floatx80_is_signaling_nan(ST0, &env->fp_status)) {
+ float_raise(float_flag_invalid, &env->fp_status);
+ ST0 = floatx80_silence_nan(ST0, &env->fp_status);
+ }
} else {
int n = floatx80_to_int32_round_to_zero(ST1, &env->fp_status);
ST0 = floatx80_scalbn(ST0, n, &env->fp_status);