diff options
author | Richard Henderson | 2020-11-20 02:34:28 +0100 |
---|---|---|
committer | Richard Henderson | 2021-05-16 14:13:51 +0200 |
commit | 57547c6023344f4b4562d7cadb1799a31c8a4549 (patch) | |
tree | cab7859ab3152b7906cd93ec9b97819f2b7e5649 /fpu/softfloat.c | |
parent | softfloat: Use return_nan in float_to_float (diff) | |
download | qemu-57547c6023344f4b4562d7cadb1799a31c8a4549.tar.gz qemu-57547c6023344f4b4562d7cadb1799a31c8a4549.tar.xz qemu-57547c6023344f4b4562d7cadb1799a31c8a4549.zip |
softfloat: fix return_nan vs default_nan_mode
Do not call parts_silence_nan when default_nan_mode is in
effect. This will avoid an assert in a later patch.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'fpu/softfloat.c')
-rw-r--r-- | fpu/softfloat.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index b694e38522..6589f00b23 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -892,21 +892,16 @@ static float64 float64_round_pack_canonical(FloatParts p, float_status *s) static FloatParts return_nan(FloatParts a, float_status *s) { - switch (a.cls) { - case float_class_snan: + g_assert(is_nan(a.cls)); + if (is_snan(a.cls)) { float_raise(float_flag_invalid, s); - a = parts_silence_nan(a, s); - /* fall through */ - case float_class_qnan: - if (s->default_nan_mode) { - return parts_default_nan(s); + if (!s->default_nan_mode) { + return parts_silence_nan(a, s); } - break; - - default: - g_assert_not_reached(); + } else if (!s->default_nan_mode) { + return a; } - return a; + return parts_default_nan(s); } static FloatParts pick_nan(FloatParts a, FloatParts b, float_status *s) |