Skip to content

Commit

Permalink
target/s390x: Fix CONVERT TO LOGICAL/FIXED with out-of-range inputs
Browse files Browse the repository at this point in the history
CONVERT TO LOGICAL/FIXED deviate from IEEE 754 in that they raise an
inexact exception on out-of-range inputs. float_flag_invalid_cvti
aligns nicely with that behavior, so convert it to
S390_IEEE_MASK_INEXACT.

Cc: qemu-stable@nongnu.org
Fixes: defb0e3 ("s390x: Implement opcode helpers")
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20230724082032.66864-4-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 53684e3)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
iii-i authored and Michael Tokarev committed Jul 25, 2023
1 parent 616a71e commit 7414ac9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion target/s390x/tcg/fpu_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ uint8_t s390_softfloat_exc_to_ieee(unsigned int exc)
s390_exc |= (exc & float_flag_divbyzero) ? S390_IEEE_MASK_DIVBYZERO : 0;
s390_exc |= (exc & float_flag_overflow) ? S390_IEEE_MASK_OVERFLOW : 0;
s390_exc |= (exc & float_flag_underflow) ? S390_IEEE_MASK_UNDERFLOW : 0;
s390_exc |= (exc & float_flag_inexact) ? S390_IEEE_MASK_INEXACT : 0;
s390_exc |= (exc & (float_flag_inexact | float_flag_invalid_cvti)) ?
S390_IEEE_MASK_INEXACT : 0;

return s390_exc;
}
Expand Down

0 comments on commit 7414ac9

Please sign in to comment.