mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
softfloat: Move sf_canonicalize to softfloat-parts.c.inc
At the same time, convert to pointers, rename to parts$N_canonicalize and define a macro for parts_canonicalize using QEMU_GENERIC. Rearrange the cases to recognize float_class_normal as early as possible. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
979582d071
commit
d46975bce1
2 changed files with 112 additions and 38 deletions
|
@ -100,3 +100,36 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
|
|||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
/*
|
||||
* Canonicalize the FloatParts structure. Determine the class,
|
||||
* unbias the exponent, and normalize the fraction.
|
||||
*/
|
||||
static void partsN(canonicalize)(FloatPartsN *p, float_status *status,
|
||||
const FloatFmt *fmt)
|
||||
{
|
||||
if (unlikely(p->exp == 0)) {
|
||||
if (likely(frac_eqz(p))) {
|
||||
p->cls = float_class_zero;
|
||||
} else if (status->flush_inputs_to_zero) {
|
||||
float_raise(float_flag_input_denormal, status);
|
||||
p->cls = float_class_zero;
|
||||
frac_clear(p);
|
||||
} else {
|
||||
int shift = frac_normalize(p);
|
||||
p->cls = float_class_normal;
|
||||
p->exp = fmt->frac_shift - fmt->exp_bias - shift + 1;
|
||||
}
|
||||
} else if (likely(p->exp < fmt->exp_max) || fmt->arm_althp) {
|
||||
p->cls = float_class_normal;
|
||||
p->exp -= fmt->exp_bias;
|
||||
frac_shl(p, fmt->frac_shift);
|
||||
p->frac_hi |= DECOMPOSED_IMPLICIT_BIT;
|
||||
} else if (likely(frac_eqz(p))) {
|
||||
p->cls = float_class_inf;
|
||||
} else {
|
||||
frac_shl(p, fmt->frac_shift);
|
||||
p->cls = (parts_is_snan_frac(p->frac_hi, status)
|
||||
? float_class_snan : float_class_qnan);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue