qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

fpu/softfloat: Don't set Invalid for float-to-int(MAXINT)

In float-to-integer conversion, if the floating point input
converts exactly to the largest or smallest integer that
fits in to the result type, this is not an overflow.
In this situation we were producing the correct result value,
but were incorrectly setting the Invalid flag.
For example for Arm A64, "FCVTAS w0, d0" on an input of
0x41dfffffffc00000 should produce 0x7fffffff and set no flags.

Fix the boundary case to take the right half of the if()
statements.

This fixes a regression from 2.11 introduced by the softfloat
refactoring.

Cc: qemu-stable@nongnu.org
Fixes: ab52f973a50
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180510140141.12120-1-peter.maydell@linaro.org
(cherry picked from commit 333583757c5e910b040bef793974773635ce1918)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

authored by

Peter Maydell and committed by
Michael Roth
e653eee8 fbaeb106

+2 -2
+2 -2
fpu/softfloat.c
··· 1368 1368 r = UINT64_MAX; 1369 1369 } 1370 1370 if (p.sign) { 1371 - if (r < -(uint64_t) min) { 1371 + if (r <= -(uint64_t) min) { 1372 1372 return -r; 1373 1373 } else { 1374 1374 s->float_exception_flags = orig_flags | float_flag_invalid; 1375 1375 return min; 1376 1376 } 1377 1377 } else { 1378 - if (r < max) { 1378 + if (r <= max) { 1379 1379 return r; 1380 1380 } else { 1381 1381 s->float_exception_flags = orig_flags | float_flag_invalid;