diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2020-10-23 17:03:11 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-05-16 07:13:51 -0500 |
commit | 22c355f41785f258689cbba0af1c1e78365c4180 (patch) | |
tree | e5a91cbff83b7d2f51f284893902d990b235c611 /fpu/softfloat-parts.c.inc | |
parent | 7c45bad866b098b8f91ffe727769d3d9f7e99cac (diff) | |
download | qemu-22c355f41785f258689cbba0af1c1e78365c4180.zip qemu-22c355f41785f258689cbba0af1c1e78365c4180.tar.gz qemu-22c355f41785f258689cbba0af1c1e78365c4180.tar.bz2 |
softfloat: Move pick_nan to softfloat-parts.c.inc
At the same time, convert to pointers, rename to parts$N_pick_nan
and define a macro for parts_pick_nan using QEMU_GENERIC.
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'fpu/softfloat-parts.c.inc')
-rw-r--r-- | fpu/softfloat-parts.c.inc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 2a3075d..11a7165 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -35,3 +35,28 @@ static void partsN(return_nan)(FloatPartsN *a, float_status *s) g_assert_not_reached(); } } + +static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, + float_status *s) +{ + if (is_snan(a->cls) || is_snan(b->cls)) { + float_raise(float_flag_invalid, s); + } + + if (s->default_nan_mode) { + parts_default_nan(a, s); + } else { + int cmp = frac_cmp(a, b); + if (cmp == 0) { + cmp = a->sign < b->sign; + } + + if (pickNaN(a->cls, b->cls, cmp > 0, s)) { + a = b; + } + if (is_snan(a->cls)) { + parts_silence_nan(a, s); + } + } + return a; +} |