target/i386: fix fbstp handling of negative zero
commit18c53e1e73197a24f9f4b66b1276eb9868db5bf0
authorJoseph Myers <joseph@codesourcery.com>
Wed, 13 May 2020 23:51:09 +0000 (13 23:51 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Jun 2020 16:10:25 +0000 (10 12:10 -0400)
treebee7345ba6b19eafcb2e87e38cffc02ee8107445
parent34b9cc076ff423023a779a04a9f7cd7c17372cbf
target/i386: fix fbstp handling of negative zero

The fbstp implementation stores +0 when the rounded result should be
-0 because it compares an integer value with 0 to determine the sign.
Fix this by checking the sign bit of the operand instead.

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