summaryrefslogtreecommitdiffstats
path: root/fpu/softfloat.c
diff options
context:
space:
mode:
authorRichard Henderson2020-10-23 23:17:19 +0200
committerRichard Henderson2021-05-16 14:13:51 +0200
commitd8fdd17280a7dfe7f2bc95a5a76ea241e844020d (patch)
treea558c8b331f083b1f3bad2f01a2f0acd2b78f4a5 /fpu/softfloat.c
parentsoftfloat: Use pointers with parts_default_nan (diff)
downloadqemu-d8fdd17280a7dfe7f2bc95a5a76ea241e844020d.tar.gz
qemu-d8fdd17280a7dfe7f2bc95a5a76ea241e844020d.tar.xz
qemu-d8fdd17280a7dfe7f2bc95a5a76ea241e844020d.zip
softfloat: Use pointers with unpack_raw
At the same time, rename to unpack_raw64. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'fpu/softfloat.c')
-rw-r--r--fpu/softfloat.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index c7f95961cf..5ff9368012 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -580,36 +580,45 @@ static const FloatFmt float64_params = {
};
/* Unpack a float to parts, but do not canonicalize. */
-static inline FloatParts64 unpack_raw(FloatFmt fmt, uint64_t raw)
+static void unpack_raw64(FloatParts64 *r, const FloatFmt *fmt, uint64_t raw)
{
- const int sign_pos = fmt.frac_size + fmt.exp_size;
+ const int f_size = fmt->frac_size;
+ const int e_size = fmt->exp_size;
- return (FloatParts64) {
+ *r = (FloatParts64) {
.cls = float_class_unclassified,
- .sign = extract64(raw, sign_pos, 1),
- .exp = extract64(raw, fmt.frac_size, fmt.exp_size),
- .frac = extract64(raw, 0, fmt.frac_size),
+ .sign = extract64(raw, f_size + e_size, 1),
+ .exp = extract64(raw, f_size, e_size),
+ .frac = extract64(raw, 0, f_size)
};
}
static inline FloatParts64 float16_unpack_raw(float16 f)
{
- return unpack_raw(float16_params, f);
+ FloatParts64 p;
+ unpack_raw64(&p, &float16_params, f);
+ return p;
}
static inline FloatParts64 bfloat16_unpack_raw(bfloat16 f)
{
- return unpack_raw(bfloat16_params, f);
+ FloatParts64 p;
+ unpack_raw64(&p, &bfloat16_params, f);
+ return p;
}
static inline FloatParts64 float32_unpack_raw(float32 f)
{
- return unpack_raw(float32_params, f);
+ FloatParts64 p;
+ unpack_raw64(&p, &float32_params, f);
+ return p;
}
static inline FloatParts64 float64_unpack_raw(float64 f)
{
- return unpack_raw(float64_params, f);
+ FloatParts64 p;
+ unpack_raw64(&p, &float64_params, f);
+ return p;
}
/* Pack a float from parts, but do not canonicalize. */