target/i386: fix fxam handling of invalid encodings
commit34b9cc076ff423023a779a04a9f7cd7c17372cbf
authorJoseph Myers <joseph@codesourcery.com>
Wed, 13 May 2020 23:50:19 +0000 (13 23:50 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Jun 2020 16:10:24 +0000 (10 12:10 -0400)
treeda8938f804746da92052eebfe180c67b473d885a
parent80b4008c805ebcfd4c0d302ac31c1689e34571e0
target/i386: fix fxam handling of invalid encodings

The fxam implementation does not check for invalid encodings, instead
treating them like NaN or normal numbers depending on the exponent.
Fix it to check that the high bit of the significand is set before
treating an encoding as NaN or normal, thus resulting in correct
handling (all of C0, C2 and C3 cleared) for invalid encodings.

Signed-off-by: Joseph Myers <joseph@codesourcery.com>
Message-Id: <alpine.DEB.2.21.2005132349311.11687@digraph.polyomino.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/fpu_helper.c
tests/tcg/i386/test-i386-fxam.c [new file with mode: 0644]