]> git.proxmox.com Git - mirror_qemu.git/commit
target/i386: Return 'indefinite integer value' for invalid SSE fp->int conversions
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 5 Aug 2019 18:03:32 +0000 (19:03 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 20 Aug 2019 15:26:20 +0000 (17:26 +0200)
commit1e8a98b53867f61da9ca09f411288e2085d323c4
tree2c764041860c7013088876d8142e10813ad9cb18
parent1f670a95b370651bcf3721aa0941d57e185478cf
target/i386: Return 'indefinite integer value' for invalid SSE fp->int conversions

The x86 architecture requires that all conversions from floating
point to integer which raise the 'invalid' exception (infinities of
both signs, NaN, and all values which don't fit in the destination
integer) return what the x86 spec calls the "indefinite integer
value", which is 0x8000_0000 for 32-bits or 0x8000_0000_0000_0000 for
64-bits.  The softfloat functions return the more usual behaviour of
positive overflows returning the maximum value that fits in the
destination integer format and negative overflows returning the
minimum value that fits.

Wrap the softfloat functions in x86-specific versions which
detect the 'invalid' condition and return the indefinite integer.

Note that we don't use these wrappers for the 3DNow! pf2id and pf2iw
instructions, which do return the minimum value that fits in
an int32 if the input float is a large negative number.

Fixes: https://bugs.launchpad.net/qemu/+bug/1815423
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190805180332.10185-1-peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/ops_sse.h