mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 05:06:46 +00:00
fpu/softfloat: raise float_invalid for NaN/Inf in round_to_int_and_pack
The re-factor broke the raising of INVALID when NaN/Inf is passed to the float_to_int conversion functions. round_to_uint_and_pack got this right for NaN but also missed out the Inf handling. Fixes https://bugs.launchpad.net/qemu/+bug/1759264 Backports commit 801bc56336a127d9b351b3a2cc0336e4d0cb2686 from qemu
This commit is contained in:
parent
74b7fe484c
commit
9517a002da
|
@ -1344,8 +1344,10 @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode,
|
|||
case float_class_qnan:
|
||||
case float_class_dnan:
|
||||
case float_class_msnan:
|
||||
s->float_exception_flags = orig_flags | float_flag_invalid;
|
||||
return max;
|
||||
case float_class_inf:
|
||||
s->float_exception_flags = orig_flags | float_flag_invalid;
|
||||
return p.sign ? min : max;
|
||||
case float_class_zero:
|
||||
return 0;
|
||||
|
@ -1437,6 +1439,7 @@ static uint64_t round_to_uint_and_pack(FloatParts in, int rmode, uint64_t max,
|
|||
s->float_exception_flags = orig_flags | float_flag_invalid;
|
||||
return max;
|
||||
case float_class_inf:
|
||||
s->float_exception_flags = orig_flags | float_flag_invalid;
|
||||
return p.sign ? 0 : max;
|
||||
case float_class_zero:
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue