From b7f5fb36f13aa27b1cd6198af58d11dc674d1b2c Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 21 Mar 2014 21:27:29 +0000 Subject: 2014-03-21 Maciej W. Rozycki * 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. --- newlib/libc/stdlib/ldtoa.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'newlib/libc/stdlib/ldtoa.c') 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