[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/46] softfloat: Use pointers with pack_raw
From: |
Richard Henderson |
Subject: |
[PULL 20/46] softfloat: Use pointers with pack_raw |
Date: |
Sun, 16 May 2021 07:34:05 -0500 |
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>
---
fpu/softfloat.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 5a736a46cf..b59b777bca 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));
}
/*----------------------------------------------------------------------------
--
2.25.1
- [PULL 04/46] accel/tcg: Use add/sub overflow routines in tcg-runtime-gvec.c, (continued)
- [PULL 04/46] accel/tcg: Use add/sub overflow routines in tcg-runtime-gvec.c, Richard Henderson, 2021/05/16
- [PULL 06/46] softfloat: Move the binary point to the msb, Richard Henderson, 2021/05/16
- [PULL 09/46] softfloat: Tidy a * b + inf return, Richard Henderson, 2021/05/16
- [PULL 08/46] softfloat: Use float_raise in more places, Richard Henderson, 2021/05/16
- [PULL 10/46] softfloat: Add float_cmask and constants, Richard Henderson, 2021/05/16
- [PULL 11/46] softfloat: Use return_nan in float_to_float, Richard Henderson, 2021/05/16
- [PULL 13/46] target/mips: Set set_default_nan_mode with set_snan_bit_is_one, Richard Henderson, 2021/05/16
- [PULL 16/46] softfloat: Move type-specific pack/unpack routines, Richard Henderson, 2021/05/16
- [PULL 14/46] softfloat: Do not produce a default_nan from parts_silence_nan, Richard Henderson, 2021/05/16
- [PULL 15/46] softfloat: Rename FloatParts to FloatParts64, Richard Henderson, 2021/05/16
- [PULL 20/46] softfloat: Use pointers with pack_raw,
Richard Henderson <=
- [PULL 23/46] softfloat: Use pointers with ftype_round_pack_canonical, Richard Henderson, 2021/05/16
- [PULL 12/46] softfloat: fix return_nan vs default_nan_mode, Richard Henderson, 2021/05/16
- [PULL 17/46] softfloat: Use pointers with parts_default_nan, Richard Henderson, 2021/05/16
- [PULL 29/46] softfloat: Move pick_nan to softfloat-parts.c.inc, Richard Henderson, 2021/05/16
- [PULL 33/46] softfloat: Use uadd64_carry, usub64_borrow in softfloat-macros.h, Richard Henderson, 2021/05/16
- [PULL 18/46] softfloat: Use pointers with unpack_raw, Richard Henderson, 2021/05/16
- [PULL 19/46] softfloat: Use pointers with ftype_unpack_raw, Richard Henderson, 2021/05/16
- [PULL 07/46] softfloat: Inline float_raise, Richard Henderson, 2021/05/16
- [PULL 31/46] softfloat: Move sf_canonicalize to softfloat-parts.c.inc, Richard Henderson, 2021/05/16
- [PULL 22/46] softfloat: Use pointers with ftype_unpack_canonical, Richard Henderson, 2021/05/16