On 12 January 2015 at 14:38, Peter Maydell <[email protected]> wrote:
> Revert the parts of commits b645bb4885 and 5a6932d51d which are still
> in the codebase and under a SoftFloat-2b license.
>
> Reimplement support for architectures where the most significant bit
> in the mantissa is 1 for a signaling NaN rather than a quiet NaN,
> by adding handling for SNAN_BIT_IS_ONE being set to the functions
> which test values for NaN-ness.
>
> This includes restoring the bugfixes lost in the reversion where
> some of the float*_is_quiet_nan() functions were returning true
> for both signaling and quiet NaNs.
>
> [This is a mechanical squashing together of two separate "revert"
> and "reimplement" patches.]
> @@ -1029,13 +1031,12 @@ int float128_is_signaling_nan(float128 a_)
> int float128_is_quiet_nan( float128 a )
> {
> #if SNAN_BIT_IS_ONE
> - return
> - ( ( ( a.high>>47 ) & 0xFFFF ) == 0xFFFE )
> - && ( a.low || ( a.high & LIT64( 0x00007FFFFFFFFFFF ) ) );
> + return (((a.high >> 47) & 0xffff) == 0xfffe)
> + && (a.low || (a.high & 0x00007fffffffffffULL));
> #else
> return
> - ( LIT64( 0xFFFE000000000000 ) <= (uint64_t) ( a.high<<1 ) )
> - && ( a.low || ( a.high & LIT64( 0x0000FFFFFFFFFFFF ) ) );
> + ((a.high << 1) >= 0xffff000000000000)
> + && (a.low || (a.high & 0x0000ffffffffffffULL));
> #endif
> }
>
> @@ -1048,8 +1049,8 @@ int float128_is_signaling_nan( float128 a )
> {
> #if SNAN_BIT_IS_ONE
> return
> - ( LIT64( 0xFFFE000000000000 ) <= (uint64_t) ( a.high<<1 ) )
> - && ( a.low || ( a.high & LIT64( 0x0000FFFFFFFFFFFF ) ) );
> + ((a.high << 1) >= 0xffff000000000000)
> + && (a.low || (a.high & 0x0000ffffffffffffULL));
> #else
> return
> ( ( ( a.high>>47 ) & 0xFFFF ) == 0xFFFE )
These hunks turn out to be missing some "ULL" suffixes on the
"0xffff000000000000" constants, which makes the Windows build
complain. I'm going to fold the trivial fix in as I apply.
-- PMM