diff options
author | Joseph Myers <joseph@codesourcery.com> | 2020-05-07 00:44:57 +0000 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-06-10 12:10:17 -0400 |
commit | b40eec96b26028b68c3594fbf34b6d6f029df26a (patch) | |
tree | 9d102ee76ffb044cc3fe3612d37e634c85cc3c05 /target/i386 | |
parent | 0d48b436327955c69e2eb53f88aba9aa1e0dbaa0 (diff) | |
download | qemu-b40eec96b26028b68c3594fbf34b6d6f029df26a.zip qemu-b40eec96b26028b68c3594fbf34b6d6f029df26a.tar.gz qemu-b40eec96b26028b68c3594fbf34b6d6f029df26a.tar.bz2 |
target/i386: fix fscale handling of invalid exponent encodings
The fscale implementation does not check for invalid encodings in the
exponent operand, thus treating them like INT_MIN (the value returned
for invalid encodings by floatx80_to_int32_round_to_zero). Fix it to
treat them similarly to signaling NaN exponents, thus generating a
quiet NaN result.
Signed-off-by: Joseph Myers <joseph@codesourcery.com>
Message-Id: <alpine.DEB.2.21.2005070044190.18350@digraph.polyomino.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386')
-rw-r--r-- | target/i386/fpu_helper.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/target/i386/fpu_helper.c b/target/i386/fpu_helper.c index 0671de6..10ff903 100644 --- a/target/i386/fpu_helper.c +++ b/target/i386/fpu_helper.c @@ -968,7 +968,10 @@ void helper_frndint(CPUX86State *env) void helper_fscale(CPUX86State *env) { - if (floatx80_is_any_nan(ST1)) { + if (floatx80_invalid_encoding(ST1)) { + float_raise(float_flag_invalid, &env->fp_status); + ST0 = floatx80_default_nan(&env->fp_status); + } else 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); |