aboutsummaryrefslogtreecommitdiff
path: root/fpu
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-15 17:14:12 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-15 17:14:12 +0000
commit1b2ad2ec7a79634f8186098dbe34a162d4851ded (patch)
treebd29a7a8dd2631f1226d9e6e9e540578c6786cc8 /fpu
parenttarget-ppc: correctly propagate NaN in division (diff)
downloadqemu-kvm-1b2ad2ec7a79634f8186098dbe34a162d4851ded.tar.gz
qemu-kvm-1b2ad2ec7a79634f8186098dbe34a162d4851ded.tar.bz2
qemu-kvm-1b2ad2ec7a79634f8186098dbe34a162d4851ded.zip
softfloat-native: fix *nan()
Fix float64_is_nan() Fix floatx80_is_signaling_nan() Add floatx80_is_nan() Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6049 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'fpu')
-rw-r--r--fpu/softfloat-native.c15
-rw-r--r--fpu/softfloat-native.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/fpu/softfloat-native.c b/fpu/softfloat-native.c
index cd88113f9..7273ae5b4 100644
--- a/fpu/softfloat-native.c
+++ b/fpu/softfloat-native.c
@@ -431,7 +431,7 @@ int float64_is_nan( float64 a1 )
u.f = a1;
a = u.i;
- return ( LIT64( 0xFFE0000000000000 ) < (bits64) ( a<<1 ) );
+ return ( LIT64( 0xFFF0000000000000 ) < (bits64) ( a<<1 ) );
}
@@ -507,6 +507,19 @@ int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM )
int floatx80_is_signaling_nan( floatx80 a1)
{
floatx80u u;
+ uint64_t aLow;
+ u.f = a1;
+
+ aLow = u.i.low & ~ LIT64( 0x4000000000000000 );
+ return
+ ( ( u.i.high & 0x7FFF ) == 0x7FFF )
+ && (bits64) ( aLow<<1 )
+ && ( u.i.low == aLow );
+}
+
+int floatx80_is_nan( floatx80 a1 )
+{
+ floatx80u u;
u.f = a1;
return ( ( u.i.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( u.i.low<<1 );
}
diff --git a/fpu/softfloat-native.h b/fpu/softfloat-native.h
index 817a2a813..f0a7c2e53 100644
--- a/fpu/softfloat-native.h
+++ b/fpu/softfloat-native.h
@@ -425,6 +425,7 @@ INLINE int floatx80_unordered( floatx80 a, floatx80 b STATUS_PARAM)
int floatx80_compare( floatx80, floatx80 STATUS_PARAM );
int floatx80_compare_quiet( floatx80, floatx80 STATUS_PARAM );
int floatx80_is_signaling_nan( floatx80 );
+int floatx80_is_nan( floatx80 );
INLINE floatx80 floatx80_abs(floatx80 a)
{