mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
fpu: Make targets specify whether floatx80 Inf can have Int bit clear
In Intel terminology, a floatx80 Infinity with the explicit integer bit clear is a "pseudo-infinity"; for x86 these are not valid infinity values. m68k is looser and does not care whether the Integer bit is set or clear in an infinity. Move this setting to runtime rather than using an ifdef in floatx80_is_infinity(). Since this was the last use of the floatx80_infinity global constant, we remove it and its definition here. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20250224111524.1101196-6-peter.maydell@linaro.org Message-id: 20250217125055.160887-5-peter.maydell@linaro.org
This commit is contained in:
parent
9ea6d1f141
commit
44eb32a983
4 changed files with 19 additions and 18 deletions
|
@ -237,16 +237,6 @@ floatx80 floatx80_default_inf(bool zSign, float_status *status)
|
|||
return packFloatx80(zSign, 0x7fff, z ? 0 : (1ULL << 63));
|
||||
}
|
||||
|
||||
#define floatx80_infinity_high 0x7FFF
|
||||
#if defined(TARGET_M68K)
|
||||
#define floatx80_infinity_low UINT64_C(0x0000000000000000)
|
||||
#else
|
||||
#define floatx80_infinity_low UINT64_C(0x8000000000000000)
|
||||
#endif
|
||||
|
||||
const floatx80 floatx80_infinity
|
||||
= make_floatx80_init(floatx80_infinity_high, floatx80_infinity_low);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
| Returns 1 if the half-precision floating-point value `a' is a quiet
|
||||
| NaN; otherwise returns 0.
|
||||
|
|
|
@ -330,6 +330,11 @@ typedef enum __attribute__((__packed__)) {
|
|||
typedef enum __attribute__((__packed__)) {
|
||||
/* In the default Infinity value, is the Integer bit 0 ? */
|
||||
floatx80_default_inf_int_bit_is_zero = 1,
|
||||
/*
|
||||
* Are Pseudo-infinities (Inf with the Integer bit zero) valid?
|
||||
* If so, floatx80_is_infinity() will return true for them.
|
||||
*/
|
||||
floatx80_pseudo_inf_valid = 2,
|
||||
} FloatX80Behaviour;
|
||||
|
||||
/*
|
||||
|
|
|
@ -960,7 +960,6 @@ float128 floatx80_to_float128(floatx80, float_status *status);
|
|||
/*----------------------------------------------------------------------------
|
||||
| The pattern for an extended double-precision inf.
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern const floatx80 floatx80_infinity;
|
||||
floatx80 floatx80_default_inf(bool zSign, float_status *status);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
@ -998,12 +997,17 @@ static inline floatx80 floatx80_chs(floatx80 a)
|
|||
|
||||
static inline bool floatx80_is_infinity(floatx80 a, float_status *status)
|
||||
{
|
||||
#if defined(TARGET_M68K)
|
||||
return (a.high & 0x7fff) == floatx80_infinity.high && !(a.low << 1);
|
||||
#else
|
||||
return (a.high & 0x7fff) == floatx80_infinity.high &&
|
||||
a.low == floatx80_infinity.low;
|
||||
#endif
|
||||
/*
|
||||
* It's target-specific whether the Integer bit is permitted
|
||||
* to be 0 in a valid Infinity value. (x86 says no, m68k says yes).
|
||||
*/
|
||||
bool intbit = a.low >> 63;
|
||||
|
||||
if (!intbit &&
|
||||
!(status->floatx80_behaviour & floatx80_pseudo_inf_valid)) {
|
||||
return false;
|
||||
}
|
||||
return (a.high & 0x7fff) == 0x7fff && !(a.low << 1);
|
||||
}
|
||||
|
||||
static inline bool floatx80_is_neg(floatx80 a)
|
||||
|
|
|
@ -110,8 +110,10 @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type)
|
|||
/*
|
||||
* m68k-specific floatx80 behaviour:
|
||||
* * default Infinity values have a zero Integer bit
|
||||
* * input Infinities may have the Integer bit either 0 or 1
|
||||
*/
|
||||
set_floatx80_behaviour(floatx80_default_inf_int_bit_is_zero,
|
||||
set_floatx80_behaviour(floatx80_default_inf_int_bit_is_zero |
|
||||
floatx80_pseudo_inf_valid,
|
||||
&env->fp_status);
|
||||
|
||||
nan = floatx80_default_nan(&env->fp_status);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue