Commit 1b2ad2ec7a79634f8186098dbe34a162d4851ded

Authored by aurel32
1 parent 3b27fc36

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
fpu/softfloat-native.c
... ... @@ -431,7 +431,7 @@ int float64_is_nan( float64 a1 )
431 431 u.f = a1;
432 432 a = u.i;
433 433  
434   - return ( LIT64( 0xFFE0000000000000 ) < (bits64) ( a<<1 ) );
  434 + return ( LIT64( 0xFFF0000000000000 ) < (bits64) ( a<<1 ) );
435 435  
436 436 }
437 437  
... ... @@ -507,6 +507,19 @@ int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM )
507 507 int floatx80_is_signaling_nan( floatx80 a1)
508 508 {
509 509 floatx80u u;
  510 + uint64_t aLow;
  511 + u.f = a1;
  512 +
  513 + aLow = u.i.low & ~ LIT64( 0x4000000000000000 );
  514 + return
  515 + ( ( u.i.high & 0x7FFF ) == 0x7FFF )
  516 + && (bits64) ( aLow<<1 )
  517 + && ( u.i.low == aLow );
  518 +}
  519 +
  520 +int floatx80_is_nan( floatx80 a1 )
  521 +{
  522 + floatx80u u;
510 523 u.f = a1;
511 524 return ( ( u.i.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( u.i.low<<1 );
512 525 }
... ...
fpu/softfloat-native.h
... ... @@ -425,6 +425,7 @@ INLINE int floatx80_unordered( floatx80 a, floatx80 b STATUS_PARAM)
425 425 int floatx80_compare( floatx80, floatx80 STATUS_PARAM );
426 426 int floatx80_compare_quiet( floatx80, floatx80 STATUS_PARAM );
427 427 int floatx80_is_signaling_nan( floatx80 );
  428 +int floatx80_is_nan( floatx80 );
428 429  
429 430 INLINE floatx80 floatx80_abs(floatx80 a)
430 431 {
... ...