[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 70/99] fpu/softfloat: Don't set Invalid for float-t
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 70/99] fpu/softfloat: Don't set Invalid for float-to-int(MAXINT) |
Date: |
Mon, 23 Jul 2018 15:17:19 -0500 |
From: Peter Maydell <address@hidden>
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: address@hidden
Fixes: ab52f973a50
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-id: address@hidden
(cherry picked from commit 333583757c5e910b040bef793974773635ce1918)
Signed-off-by: Michael Roth <address@hidden>
---
fpu/softfloat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 8401b37bd4..9bcaaebe4f 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1368,14 +1368,14 @@ static int64_t round_to_int_and_pack(FloatParts in, int
rmode,
r = UINT64_MAX;
}
if (p.sign) {
- if (r < -(uint64_t) min) {
+ if (r <= -(uint64_t) min) {
return -r;
} else {
s->float_exception_flags = orig_flags | float_flag_invalid;
return min;
}
} else {
- if (r < max) {
+ if (r <= max) {
return r;
} else {
s->float_exception_flags = orig_flags | float_flag_invalid;
--
2.17.1
- [Qemu-stable] [PATCH 59/99] iotests: Add test for cancelling a mirror job, (continued)
- [Qemu-stable] [PATCH 59/99] iotests: Add test for cancelling a mirror job, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 61/99] riscv: htif: increase the priority of the htif subregion, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 62/99] riscv: requires libfdt, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 63/99] nbd/client: Relax handling of large NBD_CMD_BLOCK_STATUS reply, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 64/99] tcg/i386: Fix dup_vec in non-AVX2 codepath, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 65/99] softfloat: Handle default NaN mode after pickNaNMulAdd, not before, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 66/99] tcg: Limit the number of ops in a TB, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 67/99] RISC-V: Minimal QEMU 2.12 fix for sifive_u machine, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 69/99] target/arm: Fix fp_status_f16 tininess before rounding, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 68/99] blockjob: expose error string via query, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 70/99] fpu/softfloat: Don't set Invalid for float-to-int(MAXINT),
Michael Roth <=
- [Qemu-stable] [PATCH 06/99] tcg/arm: Fix memory barrier encoding, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 71/99] target/arm: Implement vector shifted SCVF/UCVF for fp16, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 72/99] target/arm: Implement vector shifted FCVT for fp16, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 73/99] target/arm: Fix float16 to/from int16, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 74/99] target/arm: Clear SVE high bits for FMOV, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 76/99] target/arm: Implement FMOV (general) for fp16, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 75/99] fpu/softfloat: Fix conversion from uint64 to float128, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 78/99] target/arm: Implement FCVT (scalar, fixed-point) for fp16, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 77/99] target/arm: Implement FCVT (scalar, integer) for fp16, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 80/99] target/arm: Implement FP data-processing (2 source) for fp16, Michael Roth, 2018/07/23