mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-15 06:01:58 -06:00
softfloat: Use parts_pick_nan in propagateFloatx80NaN
Unpacking and repacking the parts may be slightly more work than we did before, but we get to reuse more code. For a code path handling exceptional values, this is an improvement. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20241203203949.483774-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
313938c105
commit
1b34f934dd
1 changed files with 5 additions and 38 deletions
|
@ -4928,48 +4928,15 @@ void normalizeFloatx80Subnormal(uint64_t aSig, int32_t *zExpPtr,
|
||||||
|
|
||||||
floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
|
floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
|
||||||
{
|
{
|
||||||
bool aIsLargerSignificand;
|
FloatParts128 pa, pb, *pr;
|
||||||
FloatClass a_cls, b_cls;
|
|
||||||
|
|
||||||
/* This is not complete, but is good enough for pickNaN. */
|
if (!floatx80_unpack_canonical(&pa, a, status) ||
|
||||||
a_cls = (!floatx80_is_any_nan(a)
|
!floatx80_unpack_canonical(&pb, b, status)) {
|
||||||
? float_class_normal
|
|
||||||
: floatx80_is_signaling_nan(a, status)
|
|
||||||
? float_class_snan
|
|
||||||
: float_class_qnan);
|
|
||||||
b_cls = (!floatx80_is_any_nan(b)
|
|
||||||
? float_class_normal
|
|
||||||
: floatx80_is_signaling_nan(b, status)
|
|
||||||
? float_class_snan
|
|
||||||
: float_class_qnan);
|
|
||||||
|
|
||||||
if (is_snan(a_cls) || is_snan(b_cls)) {
|
|
||||||
float_raise(float_flag_invalid, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status->default_nan_mode) {
|
|
||||||
return floatx80_default_nan(status);
|
return floatx80_default_nan(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.low < b.low) {
|
pr = parts_pick_nan(&pa, &pb, status);
|
||||||
aIsLargerSignificand = 0;
|
return floatx80_round_pack_canonical(pr, status);
|
||||||
} else if (b.low < a.low) {
|
|
||||||
aIsLargerSignificand = 1;
|
|
||||||
} else {
|
|
||||||
aIsLargerSignificand = (a.high < b.high) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pickNaN(a_cls, b_cls, aIsLargerSignificand, status)) {
|
|
||||||
if (is_snan(b_cls)) {
|
|
||||||
return floatx80_silence_nan(b, status);
|
|
||||||
}
|
|
||||||
return b;
|
|
||||||
} else {
|
|
||||||
if (is_snan(a_cls)) {
|
|
||||||
return floatx80_silence_nan(a, status);
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue