diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2011-01-21 20:33:00 -0200 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-01-21 20:33:00 -0200 |
commit | 0f46d152542a7186a01420b2bb22679a4dffa9f7 (patch) | |
tree | 480e80d94e06581841ecd173c18f0921ad5d884d /fpu | |
parent | adb76372d9b324468da0bf9ca707da94c0adf209 (diff) | |
parent | b947c12c0bb217fe09968e652873e0d22b269d68 (diff) |
Merge commit 'b947c12c0bb217fe09968e652873e0d22b269d68' into upstream-merge
* commit 'b947c12c0bb217fe09968e652873e0d22b269d68': (130 commits)
sm501: fix screen redraw
checkpatch: adjust to QEMUisms
Add checkpatch.pl from Linux kernel
Add scripts directory
gt64xxx: set isa_mem_base during registration
hw/pl190.c: Fix writing of default vector address
target-ppc: fix wrong NaN tests
target-ppc: fix sNaN propagation
pci: use qemu_malloc() in pcibus_get_dev_path()
msix: simplify write config
msi: simplify write config a bit.
pci: deassert intx on reset.
pxa2xx_lcd: restore updating of display
pxa2xx: fix vmstate_pxa2xx_i2c
scoop: fix access to registers from second instance
mainstone: fix name of the allocated memory for roms
add bepo (french dvorak) keyboard layout
stc91c111: Implement save/restore
pl080: Implement save/restore
pl110: Implement save/restore
...
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'fpu')
-rw-r--r-- | fpu/softfloat-specialize.h | 58 | ||||
-rw-r--r-- | fpu/softfloat.h | 5 |
2 files changed, 36 insertions, 27 deletions
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index f293f2435..eb644b227 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -30,7 +30,7 @@ these four paragraphs for those parts of this code that are retained. =============================================================================*/ -#if defined(TARGET_MIPS) +#if defined(TARGET_MIPS) || defined(TARGET_SH4) #define SNAN_BIT_IS_ONE 1 #else #define SNAN_BIT_IS_ONE 0 @@ -108,7 +108,7 @@ float32 float32_maybe_silence_nan( float32 a_ ) { if (float32_is_signaling_nan(a_)) { #if SNAN_BIT_IS_ONE -# if defined(TARGET_MIPS) +# if defined(TARGET_MIPS) || defined(TARGET_SH4) return float32_default_nan; # else # error Rules for silencing a signaling NaN are target-specific @@ -278,9 +278,6 @@ static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM) flag aIsLargerSignificand; bits32 av, bv; - if ( STATUS(default_nan_mode) ) - return float32_default_nan; - aIsQuietNaN = float32_is_quiet_nan( a ); aIsSignalingNaN = float32_is_signaling_nan( a ); bIsQuietNaN = float32_is_quiet_nan( b ); @@ -290,6 +287,9 @@ static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM) if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR); + if ( STATUS(default_nan_mode) ) + return float32_default_nan; + if ((bits32)(av<<1) < (bits32)(bv<<1)) { aIsLargerSignificand = 0; } else if ((bits32)(bv<<1) < (bits32)(av<<1)) { @@ -362,7 +362,7 @@ float64 float64_maybe_silence_nan( float64 a_ ) { if (float64_is_signaling_nan(a_)) { #if SNAN_BIT_IS_ONE -# if defined(TARGET_MIPS) +# if defined(TARGET_MIPS) || defined(TARGET_SH4) return float64_default_nan; # else # error Rules for silencing a signaling NaN are target-specific @@ -423,9 +423,6 @@ static float64 propagateFloat64NaN( float64 a, float64 b STATUS_PARAM) flag aIsLargerSignificand; bits64 av, bv; - if ( STATUS(default_nan_mode) ) - return float64_default_nan; - aIsQuietNaN = float64_is_quiet_nan( a ); aIsSignalingNaN = float64_is_signaling_nan( a ); bIsQuietNaN = float64_is_quiet_nan( b ); @@ -435,6 +432,9 @@ static float64 propagateFloat64NaN( float64 a, float64 b STATUS_PARAM) if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR); + if ( STATUS(default_nan_mode) ) + return float64_default_nan; + if ((bits64)(av<<1) < (bits64)(bv<<1)) { aIsLargerSignificand = 0; } else if ((bits64)(bv<<1) < (bits64)(av<<1)) { @@ -468,7 +468,8 @@ static float64 propagateFloat64NaN( float64 a, float64 b STATUS_PARAM) /*---------------------------------------------------------------------------- | Returns 1 if the extended double-precision floating-point value `a' is a -| quiet NaN; otherwise returns 0. +| quiet NaN; otherwise returns 0. This slightly differs from the same +| function for other types as floatx80 has an explicit bit. *----------------------------------------------------------------------------*/ int floatx80_is_quiet_nan( floatx80 a ) @@ -482,19 +483,22 @@ int floatx80_is_quiet_nan( floatx80 a ) && (bits64) ( aLow<<1 ) && ( a.low == aLow ); #else - return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 ); + return ( ( a.high & 0x7FFF ) == 0x7FFF ) + && (LIT64( 0x8000000000000000 ) <= ((bits64) ( a.low<<1 ))); #endif } /*---------------------------------------------------------------------------- | Returns 1 if the extended double-precision floating-point value `a' is a -| signaling NaN; otherwise returns 0. +| signaling NaN; otherwise returns 0. This slightly differs from the same +| function for other types as floatx80 has an explicit bit. *----------------------------------------------------------------------------*/ int floatx80_is_signaling_nan( floatx80 a ) { #if SNAN_BIT_IS_ONE - return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 ); + return ( ( a.high & 0x7FFF ) == 0x7FFF ) + && (LIT64( 0x8000000000000000 ) <= ((bits64) ( a.low<<1 ))); #else bits64 aLow; @@ -515,7 +519,7 @@ floatx80 floatx80_maybe_silence_nan( floatx80 a ) { if (floatx80_is_signaling_nan(a)) { #if SNAN_BIT_IS_ONE -# if defined(TARGET_MIPS) +# if defined(TARGET_MIPS) || defined(TARGET_SH4) a.low = floatx80_default_nan_low; a.high = floatx80_default_nan_high; # else @@ -574,12 +578,6 @@ static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b STATUS_PARAM) flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN; flag aIsLargerSignificand; - if ( STATUS(default_nan_mode) ) { - a.low = floatx80_default_nan_low; - a.high = floatx80_default_nan_high; - return a; - } - aIsQuietNaN = floatx80_is_quiet_nan( a ); aIsSignalingNaN = floatx80_is_signaling_nan( a ); bIsQuietNaN = floatx80_is_quiet_nan( b ); @@ -587,6 +585,12 @@ static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b STATUS_PARAM) if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR); + if ( STATUS(default_nan_mode) ) { + a.low = floatx80_default_nan_low; + a.high = floatx80_default_nan_high; + return a; + } + if (a.low < b.low) { aIsLargerSignificand = 0; } else if (b.low < a.low) { @@ -664,7 +668,7 @@ float128 float128_maybe_silence_nan( float128 a ) { if (float128_is_signaling_nan(a)) { #if SNAN_BIT_IS_ONE -# if defined(TARGET_MIPS) +# if defined(TARGET_MIPS) || defined(TARGET_SH4) a.low = float128_default_nan_low; a.high = float128_default_nan_high; # else @@ -719,12 +723,6 @@ static float128 propagateFloat128NaN( float128 a, float128 b STATUS_PARAM) flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN; flag aIsLargerSignificand; - if ( STATUS(default_nan_mode) ) { - a.low = float128_default_nan_low; - a.high = float128_default_nan_high; - return a; - } - aIsQuietNaN = float128_is_quiet_nan( a ); aIsSignalingNaN = float128_is_signaling_nan( a ); bIsQuietNaN = float128_is_quiet_nan( b ); @@ -732,6 +730,12 @@ static float128 propagateFloat128NaN( float128 a, float128 b STATUS_PARAM) if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR); + if ( STATUS(default_nan_mode) ) { + a.low = float128_default_nan_low; + a.high = float128_default_nan_high; + return a; + } + if (lt128(a.high<<1, a.low, b.high<<1, b.low)) { aIsLargerSignificand = 0; } else if (lt128(b.high<<1, b.low, a.high<<1, a.low)) { diff --git a/fpu/softfloat.h b/fpu/softfloat.h index a6d0f16b4..4a5345cec 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -336,6 +336,11 @@ INLINE int float32_is_any_nan(float32 a) return ((float32_val(a) & ~(1 << 31)) > 0x7f800000UL); } +INLINE int float32_is_zero_or_denormal(float32 a) +{ + return (float32_val(a) & 0x7f800000) == 0; +} + #define float32_zero make_float32(0) #define float32_one make_float32(0x3f800000) #define float32_ln2 make_float32(0x3f317218) |