diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2014-03-21 21:27:29 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2014-03-21 21:27:29 +0000 |
commit | b7f5fb36f13aa27b1cd6198af58d11dc674d1b2c (patch) | |
tree | 0f366e5734d87ba880a6e0700e88f30c11d2f6fb /newlib/libc/stdlib/ldtoa.c | |
parent | e669b401f702dbcae29b46524091b5c1eb2e7abf (diff) | |
download | cygnal-b7f5fb36f13aa27b1cd6198af58d11dc674d1b2c.tar.gz cygnal-b7f5fb36f13aa27b1cd6198af58d11dc674d1b2c.tar.bz2 cygnal-b7f5fb36f13aa27b1cd6198af58d11dc674d1b2c.zip |
2014-03-21 Maciej W. Rozycki <macro@codesourcery.com>
* libc/stdlib/gd_qnan.h (f_QNAN, d_QNAN0, d_QNAN1): Add MIPS
versions.
(ld_QNAN0, ld_QNAN1, ld_QNAN2, ld_QNAN3): Don't define for MIPS.
(ldus_QNAN0, ldus_QNAN1, ldus_QNAN2, ldus_QNAN3, ldus_QNAN4):
Likewise.
* libc/stdlib/ldtoa.c (nan113, nan64, nan53, nan24): Add MIPS
versions.
(enan): Handle legacy MIPS payloads.
* libm/common/s_nan.c (nan): Use __builtin_nan if supported by
the compiler.
* libm/common/sf_nan.c (nanf): Likewise.
Diffstat (limited to 'newlib/libc/stdlib/ldtoa.c')
-rw-r--r-- | newlib/libc/stdlib/ldtoa.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/newlib/libc/stdlib/ldtoa.c b/newlib/libc/stdlib/ldtoa.c index b13ac69be..76b4638ff 100644 --- a/newlib/libc/stdlib/ldtoa.c +++ b/newlib/libc/stdlib/ldtoa.c @@ -3679,16 +3679,40 @@ emdnorm( num, 0, 0, ln, 0, ldp ); /* NaN bit patterns */ #ifdef MIEEE +#if !defined(__mips) static _CONST unsigned short nan113[8] = { 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}; -static _CONST unsigned short nan64[6] = {0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}; +static _CONST unsigned short nan64[6] = { + 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}; static _CONST unsigned short nan53[4] = {0x7fff, 0xffff, 0xffff, 0xffff}; static _CONST unsigned short nan24[2] = {0x7fff, 0xffff}; +#elif defined(__mips_nan2008) /* __mips */ +static _CONST unsigned short nan113[8] = {0x7fff, 0x8000, 0, 0, 0, 0, 0, 0}; +static _CONST unsigned short nan64[6] = {0x7fff, 0xc000, 0, 0, 0, 0}; +static _CONST unsigned short nan53[4] = {0x7ff8, 0, 0, 0}; +static _CONST unsigned short nan24[2] = {0x7fc0, 0}; +#else /* __mips && !__mips_nan2008 */ +static _CONST unsigned short nan113[8] = { + 0x7fff, 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}; +static _CONST unsigned short nan64[6] = { + 0x7fff, 0xbfff, 0xffff, 0xffff, 0xffff, 0xffff}; +static _CONST unsigned short nan53[4] = {0x7ff7, 0xffff, 0xffff, 0xffff}; +static _CONST unsigned short nan24[2] = {0x7fbf, 0xffff}; +#endif /* __mips && !__mips_nan2008 */ #else /* !MIEEE */ +#if !defined(__mips) || defined(__mips_nan2008) static _CONST unsigned short nan113[8] = {0, 0, 0, 0, 0, 0, 0x8000, 0x7fff}; static _CONST unsigned short nan64[6] = {0, 0, 0, 0, 0xc000, 0x7fff}; static _CONST unsigned short nan53[4] = {0, 0, 0, 0x7ff8}; static _CONST unsigned short nan24[2] = {0, 0x7fc0}; +#else /* __mips && !__mips_nan2008 */ +static _CONST unsigned short nan113[8] = { + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0x7fff}; +static _CONST unsigned short nan64[6] = { + 0xffff, 0xffff, 0xffff, 0xffff, 0xbfff, 0x7fff}; +static _CONST unsigned short nan53[4] = {0xffff, 0xffff, 0xffff, 0x7ff7}; +static _CONST unsigned short nan24[2] = {0xffff, 0x7fbf}; +#endif /* __mips && !__mips_nan2008 */ #endif /* !MIEEE */ @@ -3721,9 +3745,15 @@ switch( size ) break; case NBITS: +#if !defined(__mips) || defined(__mips_nan2008) for( i=0; i<NE-2; i++ ) *nan++ = 0; *nan++ = 0xc000; +#else /* __mips && !__mips_nan2008 */ + for( i=0; i<NE-2; i++ ) + *nan++ = 0xffff; + *nan++ = 0xbfff; +#endif /* __mips && !__mips_nan2008 */ *nan++ = 0x7fff; return; @@ -3731,9 +3761,16 @@ switch( size ) *nan++ = 0; *nan++ = 0x7fff; *nan++ = 0; +#if !defined(__mips) || defined(__mips_nan2008) *nan++ = 0xc000; - for( i=4; i<NI; i++ ) + for( i=4; i<NI-1; i++ ) *nan++ = 0; +#else /* __mips && !__mips_nan2008 */ + *nan++ = 0xbfff; + for( i=4; i<NI-1; i++ ) + *nan++ = 0xffff; +#endif /* __mips && !__mips_nan2008 */ + *nan++ = 0; return; #endif default: |