diff options
author | Laurent Vivier <laurent@vivier.eu> | 2018-02-24 21:18:01 +0100 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2018-03-04 17:27:35 +0100 |
commit | 0f605c889ca3fe9744166ad4149d0dff6dacb696 (patch) | |
tree | de34c83801495a6c79d7e51db65faa98a7fbe0ce /include | |
parent | 591596b77a1872d0652e666271ca055e57ea1e21 (diff) |
softfloat: use floatx80_infinity in softfloat
Since f3218a8 ("softfloat: add floatx80 constants")
floatx80_infinity is defined but never used.
This patch updates floatx80 functions to use
this definition.
This allows to define a different default Infinity
value on m68k: the m68k FPU defines infinity with
all bits set to zero in the mantissa.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180224201802.911-4-laurent@vivier.eu>
Diffstat (limited to 'include')
-rw-r--r-- | include/fpu/softfloat.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index fa4fae224f..36626a501b 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -573,6 +573,11 @@ float64 floatx80_to_float64(floatx80, float_status *status); float128 floatx80_to_float128(floatx80, float_status *status); /*---------------------------------------------------------------------------- +| The pattern for an extended double-precision inf. +*----------------------------------------------------------------------------*/ +extern const floatx80 floatx80_infinity; + +/*---------------------------------------------------------------------------- | Software IEC/IEEE extended double-precision operations. *----------------------------------------------------------------------------*/ floatx80 floatx80_round(floatx80 a, float_status *status); @@ -612,7 +617,12 @@ static inline floatx80 floatx80_chs(floatx80 a) static inline int floatx80_is_infinity(floatx80 a) { - return (a.high & 0x7fff) == 0x7fff && a.low == 0x8000000000000000LL; +#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 } static inline int floatx80_is_neg(floatx80 a) @@ -655,7 +665,6 @@ static inline bool floatx80_invalid_encoding(floatx80 a) #define floatx80_ln2 make_floatx80(0x3ffe, 0xb17217f7d1cf79acLL) #define floatx80_pi make_floatx80(0x4000, 0xc90fdaa22168c235LL) #define floatx80_half make_floatx80(0x3ffe, 0x8000000000000000LL) -#define floatx80_infinity make_floatx80(0x7fff, 0x8000000000000000LL) /*---------------------------------------------------------------------------- | Returns the fraction bits of the extended double-precision floating-point |