diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2020-10-23 15:22:08 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-05-16 07:13:51 -0500 |
commit | 9e4af58c244e48352f57c0c02dfbd3bcbaa5e3bd (patch) | |
tree | 6b7e71bcdbd3b3a14e00ff7b7811d47b318f38c7 | |
parent | 3dddb203bc570b5284d604d689c84c6b207a5317 (diff) | |
download | qemu-9e4af58c244e48352f57c0c02dfbd3bcbaa5e3bd.zip qemu-9e4af58c244e48352f57c0c02dfbd3bcbaa5e3bd.tar.gz qemu-9e4af58c244e48352f57c0c02dfbd3bcbaa5e3bd.tar.bz2 |
softfloat: Use pointers with pack_raw
At the same time, rename to pack_raw64.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r-- | fpu/softfloat.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 5a736a4..b59b777 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -614,31 +614,36 @@ static inline void float64_unpack_raw(FloatParts64 *p, float64 f) } /* Pack a float from parts, but do not canonicalize. */ -static inline uint64_t pack_raw(FloatFmt fmt, FloatParts64 p) +static uint64_t pack_raw64(const FloatParts64 *p, const FloatFmt *fmt) { - const int sign_pos = fmt.frac_size + fmt.exp_size; - uint64_t ret = deposit64(p.frac, fmt.frac_size, fmt.exp_size, p.exp); - return deposit64(ret, sign_pos, 1, p.sign); + const int f_size = fmt->frac_size; + const int e_size = fmt->exp_size; + uint64_t ret; + + ret = (uint64_t)p->sign << (f_size + e_size); + ret = deposit64(ret, f_size, e_size, p->exp); + ret = deposit64(ret, 0, f_size, p->frac); + return ret; } static inline float16 float16_pack_raw(FloatParts64 p) { - return make_float16(pack_raw(float16_params, p)); + return make_float16(pack_raw64(&p, &float16_params)); } static inline bfloat16 bfloat16_pack_raw(FloatParts64 p) { - return pack_raw(bfloat16_params, p); + return pack_raw64(&p, &bfloat16_params); } static inline float32 float32_pack_raw(FloatParts64 p) { - return make_float32(pack_raw(float32_params, p)); + return make_float32(pack_raw64(&p, &float32_params)); } static inline float64 float64_pack_raw(FloatParts64 p) { - return make_float64(pack_raw(float64_params, p)); + return make_float64(pack_raw64(&p, &float64_params)); } /*---------------------------------------------------------------------------- |