diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2020-11-14 14:48:31 -0800 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-06-03 13:59:34 -0700 |
commit | 37c954a1b96a65d836705a6e530eeab58cc9d964 (patch) | |
tree | 14a90dd21b772c9780eb525f9ceb3e3e3d209c79 /fpu/softfloat-parts.c.inc | |
parent | e368951998ca6ffb0a1812af9beef916125dd769 (diff) | |
download | qemu-37c954a1b96a65d836705a6e530eeab58cc9d964.zip qemu-37c954a1b96a65d836705a6e530eeab58cc9d964.tar.gz qemu-37c954a1b96a65d836705a6e530eeab58cc9d964.tar.bz2 |
softfloat: Move uint_to_float to softfloat-parts.c.inc
Rename to parts$N_uint_to_float.
Reimplement uint64_to_float128 with FloatParts128.
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-parts.c.inc')
-rw-r--r-- | fpu/softfloat-parts.c.inc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index b7486f0..2eb7bb9 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -915,3 +915,26 @@ static void partsN(sint_to_float)(FloatPartsN *p, int64_t a, p->exp = DECOMPOSED_BINARY_POINT - shift + scale; p->frac_hi = f << shift; } + +/* + * Unsigned Integer to float conversions + * + * Returns the result of converting the unsigned integer `a' to the + * floating-point format. The conversion is performed according to the + * IEC/IEEE Standard for Binary Floating-Point Arithmetic. + */ +static void partsN(uint_to_float)(FloatPartsN *p, uint64_t a, + int scale, float_status *status) +{ + memset(p, 0, sizeof(*p)); + + if (a == 0) { + p->cls = float_class_zero; + } else { + int shift = clz64(a); + scale = MIN(MAX(scale, -0x10000), 0x10000); + p->cls = float_class_normal; + p->exp = DECOMPOSED_BINARY_POINT - shift + scale; + p->frac_hi = a << shift; + } +} |