mirror of https://github.com/xemu-project/xemu.git
fpu/softfloat: Introduce parts_is_snan_frac
Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
94933df0e5
commit
298b468e43
|
@ -86,6 +86,21 @@ this code that are retained.
|
||||||
#define NO_SIGNALING_NANS 1
|
#define NO_SIGNALING_NANS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| For the deconstructed floating-point with fraction FRAC, return true
|
||||||
|
| if the fraction represents a signalling NaN; otherwise false.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static bool parts_is_snan_frac(uint64_t frac, float_status *status)
|
||||||
|
{
|
||||||
|
#ifdef NO_SIGNALING_NANS
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
flag msb = extract64(frac, DECOMPOSED_BINARY_POINT - 1, 1);
|
||||||
|
return msb == status->snan_bit_is_one;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
| The pattern for a default generated half-precision NaN.
|
| The pattern for a default generated half-precision NaN.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -331,16 +331,8 @@ static FloatParts canonicalize(FloatParts part, const FloatFmt *parm,
|
||||||
part.cls = float_class_inf;
|
part.cls = float_class_inf;
|
||||||
} else {
|
} else {
|
||||||
part.frac <<= parm->frac_shift;
|
part.frac <<= parm->frac_shift;
|
||||||
#ifdef NO_SIGNALING_NANS
|
part.cls = (parts_is_snan_frac(part.frac, status)
|
||||||
part.cls = float_class_qnan;
|
? float_class_snan : float_class_qnan);
|
||||||
#else
|
|
||||||
int64_t msb = part.frac << 2;
|
|
||||||
if ((msb < 0) == status->snan_bit_is_one) {
|
|
||||||
part.cls = float_class_snan;
|
|
||||||
} else {
|
|
||||||
part.cls = float_class_qnan;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
} else if (part.exp == 0) {
|
} else if (part.exp == 0) {
|
||||||
if (likely(part.frac == 0)) {
|
if (likely(part.frac == 0)) {
|
||||||
|
|
Loading…
Reference in New Issue