mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
fpu/softfloat: Define floatN_default_nan in terms of parts_default_nan
Isolate the target-specific choice to 2 functions instead of 6. The code in float16_default_nan was only correct for ARM, MIPS, and X86. Though float16 support is rare among our targets. The code in float128_default_nan was arguably wrong for Sparc. While QEMU supports the Sparc 128-bit insns, no real cpu enables it. The code in floatx80_default_nan tried to be over-general. There are only two targets that support this format: x86 and m68k. Thus there is no point in inventing a value for snan_bit_is_one. Move routines that no longer have ifdefs out of softfloat-specialize.h. Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
3bd2dec1a1
commit
0218a16e54
2 changed files with 47 additions and 99 deletions
|
@ -2092,6 +2092,47 @@ float64 __attribute__((flatten)) float64_sqrt(float64 a, float_status *status)
|
|||
return float64_round_pack_canonical(pr, status);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
| The pattern for a default generated NaN.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
float16 float16_default_nan(float_status *status)
|
||||
{
|
||||
FloatParts p = parts_default_nan(status);
|
||||
p.frac >>= float16_params.frac_shift;
|
||||
return float16_pack_raw(p);
|
||||
}
|
||||
|
||||
float32 float32_default_nan(float_status *status)
|
||||
{
|
||||
FloatParts p = parts_default_nan(status);
|
||||
p.frac >>= float32_params.frac_shift;
|
||||
return float32_pack_raw(p);
|
||||
}
|
||||
|
||||
float64 float64_default_nan(float_status *status)
|
||||
{
|
||||
FloatParts p = parts_default_nan(status);
|
||||
p.frac >>= float64_params.frac_shift;
|
||||
return float64_pack_raw(p);
|
||||
}
|
||||
|
||||
float128 float128_default_nan(float_status *status)
|
||||
{
|
||||
FloatParts p = parts_default_nan(status);
|
||||
float128 r;
|
||||
|
||||
/* Extrapolate from the choices made by parts_default_nan to fill
|
||||
* in the quad-floating format. If the low bit is set, assume we
|
||||
* want to set all non-snan bits.
|
||||
*/
|
||||
r.low = -(p.frac & 1);
|
||||
r.high = p.frac >> (DECOMPOSED_BINARY_POINT - 48);
|
||||
r.high |= LIT64(0x7FFF000000000000);
|
||||
r.high |= (uint64_t)p.sign << 63;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
| Takes a 64-bit fixed-point value `absZ' with binary point between bits 6
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue