2000-02-18 03:39:52 +08:00
|
|
|
#ifndef __IEEE_BIG_ENDIAN
|
|
|
|
#ifndef __IEEE_LITTLE_ENDIAN
|
|
|
|
|
2001-04-04 21:33:01 +08:00
|
|
|
/* This file can define macros to choose variations of the IEEE float
|
|
|
|
format:
|
|
|
|
|
|
|
|
_FLT_LARGEST_EXPONENT_IS_NORMAL
|
|
|
|
|
|
|
|
Defined if the float format uses the largest exponent for finite
|
|
|
|
numbers rather than NaN and infinity representations. Such a
|
|
|
|
format cannot represent NaNs or infinities at all, but it's FLT_MAX
|
|
|
|
is twice the IEEE value.
|
|
|
|
|
|
|
|
_FLT_NO_DENORMALS
|
|
|
|
|
|
|
|
Defined if the float format does not support IEEE denormals. Every
|
|
|
|
float with a zero exponent is taken to be a zero representation.
|
2002-07-16 05:35:44 +08:00
|
|
|
|
|
|
|
??? At the moment, there are no equivalent macros above for doubles and
|
|
|
|
the macros are not fully supported by --enable-newlib-hw-fp.
|
2001-04-04 21:33:01 +08:00
|
|
|
|
2002-07-16 05:35:44 +08:00
|
|
|
__IEEE_BIG_ENDIAN
|
|
|
|
|
|
|
|
Defined if the float format is big endian. This is mutually exclusive
|
|
|
|
with __IEEE_LITTLE_ENDIAN.
|
|
|
|
|
|
|
|
__IEEE_LITTLE_ENDIAN
|
|
|
|
|
|
|
|
Defined if the float format is little endian. This is mutually exclusive
|
|
|
|
with __IEEE_BIG_ENDIAN.
|
|
|
|
|
|
|
|
Note that one of __IEEE_BIG_ENDIAN or __IEEE_LITTLE_ENDIAN must be specified for a
|
|
|
|
platform or error will occur.
|
|
|
|
|
|
|
|
__IEEE_BYTES_LITTLE_ENDIAN
|
|
|
|
|
|
|
|
This flag is used in conjunction with __IEEE_BIG_ENDIAN to describe a situation
|
|
|
|
whereby multiple words of an IEEE floating point are in big endian order, but the
|
|
|
|
words themselves are little endian with respect to the bytes.
|
|
|
|
|
2008-04-24 19:26:41 +08:00
|
|
|
_DOUBLE_IS_32BITS
|
2002-07-16 05:35:44 +08:00
|
|
|
|
|
|
|
This is used on platforms that support double by using the 32-bit IEEE
|
|
|
|
float type.
|
|
|
|
|
|
|
|
_FLOAT_ARG
|
|
|
|
|
|
|
|
This represents what type a float arg is passed as. It is used when the type is
|
|
|
|
not promoted to double.
|
|
|
|
|
New expf, exp2f, logf, log2f and powf implementations
Based on code from https://github.com/ARM-software/optimized-routines/
This patch adds a highly optimized generic implementation of expf,
exp2f, logf, log2f and powf. The new functions are not only
faster (6x for powf!), but are also smaller and more accurate.
In order to achieve this, the algorithm uses double precision
arithmetic for accuracy, avoids divisions and uses small table
lookups to minimize the polynomials. Special cases are handled
inline to avoid the unnecessary overhead of wrapper functions and
set errno to POSIX requirements.
The new functions are added under newlib/libm/common, but the old
implementations are kept (in newlib/libm/math) for non-IEEE or
pre-C99 systems. Targets can enable the new math code by defining
__OBSOLETE_MATH_DEFAULT to 0 in newlib/libc/include/machine/ieeefp.h,
users can override the default by defining __OBSOLETE_MATH.
Currently the new code is enabled for AArch64 and AArch32 with VFP.
Targets with a single precision FPU may still prefer the old
implementation.
libm.a size changes:
arm: -1692
arm/thumb/v7-a/nofp: -878
arm/thumb/v7-a+fp/hard: -864
arm/thumb/v7-a+fp/softfp: -908
aarch64: -1476
2017-05-25 23:41:38 +08:00
|
|
|
|
|
|
|
__OBSOLETE_MATH_DEFAULT
|
|
|
|
|
|
|
|
Default value for __OBSOLETE_MATH if that's not set by the user.
|
|
|
|
It should be set here based on predefined feature macros.
|
|
|
|
|
|
|
|
__OBSOLETE_MATH
|
|
|
|
|
|
|
|
If set to 1 then some new math code will be disabled and older libm
|
|
|
|
code will be used instead. This is necessary because the new math
|
|
|
|
code does not support all targets, it assumes that the toolchain has
|
|
|
|
ISO C99 support (hexfloat literals, standard fenv semantics), the
|
|
|
|
target has IEEE-754 conforming binary32 float and binary64 double
|
|
|
|
(not mixed endian) representation, standard SNaN representation,
|
|
|
|
double and single precision arithmetics has similar latency and it
|
|
|
|
has no legacy SVID matherr support, only POSIX errno and fenv
|
|
|
|
exception based error handling.
|
2002-07-16 05:35:44 +08:00
|
|
|
*/
|
2001-04-04 21:33:01 +08:00
|
|
|
|
2003-02-21 03:14:12 +08:00
|
|
|
#if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
|
2004-02-06 04:08:52 +08:00
|
|
|
/* ARM traditionally used big-endian words; and within those words the
|
|
|
|
byte ordering was big or little endian depending upon the target.
|
|
|
|
Modern floating-point formats are naturally ordered; in this case
|
2004-02-06 04:21:03 +08:00
|
|
|
__VFP_FP__ will be defined, even if soft-float. */
|
2004-02-06 04:08:52 +08:00
|
|
|
#ifdef __VFP_FP__
|
|
|
|
# ifdef __ARMEL__
|
|
|
|
# define __IEEE_LITTLE_ENDIAN
|
|
|
|
# else
|
|
|
|
# define __IEEE_BIG_ENDIAN
|
|
|
|
# endif
|
2018-01-23 18:43:54 +08:00
|
|
|
# if __ARM_FP & 0x8
|
|
|
|
# define __OBSOLETE_MATH_DEFAULT 0
|
|
|
|
# endif
|
2004-02-06 04:08:52 +08:00
|
|
|
#else
|
2010-06-19 00:26:25 +08:00
|
|
|
# define __IEEE_BIG_ENDIAN
|
2004-02-06 04:08:52 +08:00
|
|
|
# ifdef __ARMEL__
|
|
|
|
# define __IEEE_BYTES_LITTLE_ENDIAN
|
|
|
|
# endif
|
2001-06-28 18:40:09 +08:00
|
|
|
#endif
|
2020-08-04 23:04:39 +08:00
|
|
|
#ifndef __SOFTFP__
|
|
|
|
# define _SUPPORTS_ERREXCEPT
|
|
|
|
#endif
|
2022-03-30 21:40:59 +08:00
|
|
|
/* As per ISO/IEC TS 18661 '__FLT_EVAL_METHOD__' will be defined to 16
|
|
|
|
(if compiling with +fp16 support) so it can't be used by math.h to
|
|
|
|
define float_t and double_t. For values of '__FLT_EVAL_METHOD__'
|
|
|
|
other than 0, 1, 2 the definition of float_t and double_t is
|
|
|
|
implementation-defined. */
|
|
|
|
#define __DOUBLE_TYPE double
|
|
|
|
#define __FLOAT_TYPE float
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
|
2012-09-27 04:06:50 +08:00
|
|
|
#if defined (__aarch64__)
|
|
|
|
#if defined (__AARCH64EL__)
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
New expf, exp2f, logf, log2f and powf implementations
Based on code from https://github.com/ARM-software/optimized-routines/
This patch adds a highly optimized generic implementation of expf,
exp2f, logf, log2f and powf. The new functions are not only
faster (6x for powf!), but are also smaller and more accurate.
In order to achieve this, the algorithm uses double precision
arithmetic for accuracy, avoids divisions and uses small table
lookups to minimize the polynomials. Special cases are handled
inline to avoid the unnecessary overhead of wrapper functions and
set errno to POSIX requirements.
The new functions are added under newlib/libm/common, but the old
implementations are kept (in newlib/libm/math) for non-IEEE or
pre-C99 systems. Targets can enable the new math code by defining
__OBSOLETE_MATH_DEFAULT to 0 in newlib/libc/include/machine/ieeefp.h,
users can override the default by defining __OBSOLETE_MATH.
Currently the new code is enabled for AArch64 and AArch32 with VFP.
Targets with a single precision FPU may still prefer the old
implementation.
libm.a size changes:
arm: -1692
arm/thumb/v7-a/nofp: -878
arm/thumb/v7-a+fp/hard: -864
arm/thumb/v7-a+fp/softfp: -908
aarch64: -1476
2017-05-25 23:41:38 +08:00
|
|
|
#define __OBSOLETE_MATH_DEFAULT 0
|
2020-08-04 23:04:39 +08:00
|
|
|
#ifdef __ARM_FP
|
|
|
|
# define _SUPPORTS_ERREXCEPT
|
|
|
|
#endif
|
2022-03-30 21:40:59 +08:00
|
|
|
/* As per ISO/IEC TS 18661 '__FLT_EVAL_METHOD__' will be defined to 16
|
|
|
|
(if compiling with +fp16 support) so it can't be used by math.h to
|
|
|
|
define float_t and double_t. For values of '__FLT_EVAL_METHOD__'
|
|
|
|
other than 0, 1, 2 the definition of float_t and double_t is
|
|
|
|
implementation-defined. */
|
|
|
|
#define __DOUBLE_TYPE double
|
|
|
|
#define __FLOAT_TYPE float
|
2012-09-27 04:06:50 +08:00
|
|
|
#endif
|
|
|
|
|
2012-02-22 06:34:31 +08:00
|
|
|
#ifdef __epiphany__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define Sudden_Underflow 1
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __hppa__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2013-07-10 03:06:47 +08:00
|
|
|
#ifdef __nds32__
|
|
|
|
#ifdef __big_endian__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2006-08-17 05:39:43 +08:00
|
|
|
#ifdef __SPU__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
|
2010-02-12 05:03:51 +08:00
|
|
|
#define isfinite(__y) \
|
|
|
|
(__extension__ ({int __cy; \
|
|
|
|
(sizeof (__y) == sizeof (float)) ? (1) : \
|
|
|
|
(__cy = fpclassify(__y)) != FP_INFINITE && __cy != FP_NAN;}))
|
|
|
|
|
2009-07-10 01:04:56 +08:00
|
|
|
#define isinf(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x))
|
|
|
|
#define isnan(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x))
|
2007-04-27 03:23:37 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Macros for use in ieeefp.h. We can't just define the real ones here
|
|
|
|
* (like those above) as we have name space issues when this is *not*
|
|
|
|
* included via generic the ieeefp.h.
|
|
|
|
*/
|
|
|
|
#define __ieeefp_isnanf(x) 0
|
|
|
|
#define __ieeefp_isinff(x) 0
|
|
|
|
#define __ieeefp_finitef(x) 1
|
|
|
|
#endif
|
2006-08-17 05:39:43 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __sparc__
|
|
|
|
#ifdef __LITTLE_ENDIAN_DATA__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__m68k__) || defined(__mc68000__)
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2002-07-24 23:44:24 +08:00
|
|
|
#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#ifdef __HAVE_SHORT_DOUBLE__
|
|
|
|
# define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2004-06-23 05:54:52 +08:00
|
|
|
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__)
|
2000-02-18 03:39:52 +08:00
|
|
|
#define __IEEE_BIG_ENDIAN
|
2002-07-16 05:35:44 +08:00
|
|
|
#define _FLOAT_ARG float
|
2000-02-18 03:39:52 +08:00
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
|
2009-12-11 01:12:11 +08:00
|
|
|
#if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define _FLOAT_ARG float
|
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __sh__
|
|
|
|
#ifdef __LITTLE_ENDIAN__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
2004-07-30 17:03:39 +08:00
|
|
|
#if defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A_SINGLE_ONLY__)
|
2000-02-18 03:39:52 +08:00
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _AM29K
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __i386__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
2020-08-04 23:04:39 +08:00
|
|
|
# define _SUPPORTS_ERREXCEPT
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
|
2017-07-27 16:44:22 +08:00
|
|
|
#ifdef __riscv
|
2021-02-24 05:31:16 +08:00
|
|
|
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#else
|
2017-07-27 16:44:22 +08:00
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
2021-02-24 05:31:16 +08:00
|
|
|
#endif
|
2020-08-04 23:04:39 +08:00
|
|
|
#ifdef __riscv_flen
|
|
|
|
# define _SUPPORTS_ERREXCEPT
|
|
|
|
#endif
|
2017-07-27 16:44:22 +08:00
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __i960__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2008-12-12 04:05:38 +08:00
|
|
|
#ifdef __lm32__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __M32R__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2018-04-14 03:42:37 +08:00
|
|
|
#ifdef __nvptx__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2004-02-03 00:59:53 +08:00
|
|
|
#if defined(_C4x) || defined(_C3x)
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
|
2010-10-09 10:33:30 +08:00
|
|
|
#ifdef __TMS320C6X__
|
|
|
|
#ifdef _BIG_ENDIAN
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __TIC80__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __MIPSEL__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
#ifdef __MIPSEB__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2001-11-12 Hans-Peter Nilsson <hp@bitrange.com>
* libc/include/machine/ieeefp.h: Add support for mmix target.
* libc/include/machine/setjmp.h: Ditto.
* configure.host: Ditto.
* libc/sys/mmixware/Makefile.am, libc/sys/mmixware/_exit.c,
libc/sys/mmixware/access.c, libc/sys/mmixware/aclocal.m4,
libc/sys/mmixware/chmod.c, libc/sys/mmixware/chown.c,
libc/sys/mmixware/close.c, libc/sys/mmixware/configure.in,
libc/sys/mmixware/creat.c, libc/sys/mmixware/crt0.c,
libc/sys/mmixware/execv.c, libc/sys/mmixware/execve.c,
libc/sys/mmixware/fork.c, libc/sys/mmixware/fstat.c,
libc/sys/mmixware/getpid.c, libc/sys/mmixware/gettime.c,
libc/sys/mmixware/isatty.c, libc/sys/mmixware/kill.c,
libc/sys/mmixware/lseek.c, libc/sys/mmixware/open.c,
libc/sys/mmixware/pipe.c, libc/sys/mmixware/read.c,
libc/sys/mmixware/sbrk.c, libc/sys/mmixware/setjmp.S,
libc/sys/mmixware/stat.c, libc/sys/mmixware/sys/syscall.h,
libc/sys/mmixware/time.c, libc/sys/mmixware/times.c,
libc/sys/mmixware/unlink.c, libc/sys/mmixware/utime.c,
libc/sys/mmixware/wait.c, libc/sys/mmixware/write.c: New files.
* libc/sys/mmixware/configure, libc/sys/mmixware/Makefile.in,
libc/sys/mmixware/aclocal.m4: Generate.
2001-11-13 05:04:41 +08:00
|
|
|
#ifdef __MMIX__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2002-07-16 05:35:44 +08:00
|
|
|
#ifdef __D30V__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
/* necv70 was __IEEE_LITTLE_ENDIAN. */
|
|
|
|
|
|
|
|
#ifdef __W65__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__Z8001__) || defined(__Z8002__)
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __m88k__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __mn10300__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __mn10200__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __v800
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __v850
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __D10V__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
2002-01-08 03:33:23 +08:00
|
|
|
#if __DOUBLE__ == 32
|
2000-02-18 03:39:52 +08:00
|
|
|
#define _DOUBLE_IS_32BITS
|
2002-01-08 03:33:23 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __PPC__
|
|
|
|
#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX)
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#else
|
|
|
|
#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32)
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2002-07-16 05:35:44 +08:00
|
|
|
#ifdef __xstormy16__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __arc__
|
|
|
|
#ifdef __big_endian__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2004-10-06 03:44:24 +08:00
|
|
|
#ifdef __CRX__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2020-09-24 03:06:09 +08:00
|
|
|
#ifdef __CSKY__
|
|
|
|
#ifdef __CSKYBE__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __fr30__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2015-09-05 01:17:53 +08:00
|
|
|
#ifdef __FT32__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __mcore__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2005-12-14 06:57:31 +08:00
|
|
|
#ifdef __mt__
|
2005-07-06 21:14:10 +08:00
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2002-06-19 05:20:28 +08:00
|
|
|
#ifdef __frv__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2009-04-23 03:52:49 +08:00
|
|
|
#ifdef __moxie__
|
2012-09-14 07:57:33 +08:00
|
|
|
#ifdef __MOXIE_BIG_ENDIAN__
|
2009-04-23 03:52:49 +08:00
|
|
|
#define __IEEE_BIG_ENDIAN
|
2012-09-14 07:57:33 +08:00
|
|
|
#else
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
2009-04-23 03:52:49 +08:00
|
|
|
#endif
|
|
|
|
|
2000-05-11 10:28:06 +08:00
|
|
|
#ifdef __ia64__
|
|
|
|
#ifdef __BIG_ENDIAN__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2000-06-28 03:51:33 +08:00
|
|
|
#ifdef __AVR__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
|
2014-07-18 02:43:05 +08:00
|
|
|
#if defined(__or1k__) || defined(__OR1K__) || defined(__OR1KND__)
|
2000-12-05 02:22:10 +08:00
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2003-01-18 16:55:07 +08:00
|
|
|
#ifdef __IP2K__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#define __SMALL_BITFIELDS
|
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
|
2003-06-10 23:32:27 +08:00
|
|
|
#ifdef __iq2000__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2003-02-21 03:14:12 +08:00
|
|
|
#ifdef __MAVERICK__
|
|
|
|
#ifdef __ARMEL__
|
|
|
|
# define __IEEE_LITTLE_ENDIAN
|
|
|
|
#else /* must be __ARMEB__ */
|
|
|
|
# define __IEEE_BIG_ENDIAN
|
|
|
|
#endif /* __ARMEL__ */
|
|
|
|
#endif /* __MAVERICK__ */
|
|
|
|
|
2005-08-11 04:35:13 +08:00
|
|
|
#ifdef __m32c__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define __SMALL_BITFIELDS
|
|
|
|
#endif
|
|
|
|
|
2005-01-27 Hans-Peter Nilsson <hp@axis.com>
* configure.host: Add support for cris-*-* and crisv32-*-*.
* libc/include/machine/ieeefp.h: Ditto.
* libc/include/machine/setjmp.h: Ditto.
* libc/machine/cris/configure.in, libc/machine/cris/Makefile.am,
libc/machine/cris/libcdtor.c, libc/machine/cris/setjmp.c,
libc/machine/cris/memmove.c, libc/machine/cris/memcpy.c,
libc/machine/cris/memset.c, libc/machine/cris/include/pthread.h,
libc/machine/cris/sys/signal.h, libc/machine/cris/sys/fcntl.h,
libc/machine/cris/sys/errno.h, libc/machine/cris/aclocal.m4,
libc/machine/cris/configure, libc/machine/cris/Makefile.in: New
files.
2005-01-28 07:54:46 +08:00
|
|
|
#ifdef __CRIS__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2006-11-09 03:26:43 +08:00
|
|
|
#ifdef __BFIN__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2007-08-29 05:56:50 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
2020-08-04 23:04:39 +08:00
|
|
|
# define _SUPPORTS_ERREXCEPT
|
2007-08-29 05:56:50 +08:00
|
|
|
#endif
|
|
|
|
|
2007-11-08 05:42:24 +08:00
|
|
|
#ifdef __mep__
|
|
|
|
#ifdef __LITTLE_ENDIAN__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2009-09-28 Michael Eager <eager@eagercon.com>
* configure.host: Add microblaze.
* libc/include/machine/ieeefp.h [MICROBLAZE]: Define __IEEE_BIG_ENDIAN.
* libc/include/machine/setjmp.h [MICROBLAZE]: Define _JBLEN, _JBTYPE.
* libc/include/sys/config.h [MICROBLAZE]: Define _REENT_SMALL,
_UNIX98_THREAD_MUTEX_ATTRIBUTES.
* libc/include/sys/types.h: Treat XMK like rtems, define
PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT, PTHREAD_STACK_MIN, define stuct pthread_attr_s.
* libc/machine/configure.in: Add microblaze.
* libc/machine/configure: Add microblaze (not regenerated).
* libc/machine/microblaze/configure.in: NEW.
* libc/machine/microblaze/configure: Generate.
* libc/machine/microblaze/Makefile.am: NEW.
* libc/machine/microblaze/Makefile.in: Generate.
* libc/machine/microblaze/{abort.c, strcmp.c, strcpy.c, strlen.c,
mallocr.c, longjmp.S, setjmp.S}: NEW.
* libc/stdlib/mallocr.c [MICROBLAZE]: Don't declare sbrk prototype,
mALLOc(): return malloc value.
2009-09-29 00:42:21 +08:00
|
|
|
#ifdef __MICROBLAZE__
|
2013-07-16 15:48:53 +08:00
|
|
|
#ifndef __MICROBLAZEEL__
|
2009-09-28 Michael Eager <eager@eagercon.com>
* configure.host: Add microblaze.
* libc/include/machine/ieeefp.h [MICROBLAZE]: Define __IEEE_BIG_ENDIAN.
* libc/include/machine/setjmp.h [MICROBLAZE]: Define _JBLEN, _JBTYPE.
* libc/include/sys/config.h [MICROBLAZE]: Define _REENT_SMALL,
_UNIX98_THREAD_MUTEX_ATTRIBUTES.
* libc/include/sys/types.h: Treat XMK like rtems, define
PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT, PTHREAD_STACK_MIN, define stuct pthread_attr_s.
* libc/machine/configure.in: Add microblaze.
* libc/machine/configure: Add microblaze (not regenerated).
* libc/machine/microblaze/configure.in: NEW.
* libc/machine/microblaze/configure: Generate.
* libc/machine/microblaze/Makefile.am: NEW.
* libc/machine/microblaze/Makefile.in: Generate.
* libc/machine/microblaze/{abort.c, strcmp.c, strcpy.c, strlen.c,
mallocr.c, longjmp.S, setjmp.S}: NEW.
* libc/stdlib/mallocr.c [MICROBLAZE]: Don't declare sbrk prototype,
mALLOc(): return malloc value.
2009-09-29 00:42:21 +08:00
|
|
|
#define __IEEE_BIG_ENDIAN
|
2013-07-16 15:48:53 +08:00
|
|
|
#else
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
2009-09-28 Michael Eager <eager@eagercon.com>
* configure.host: Add microblaze.
* libc/include/machine/ieeefp.h [MICROBLAZE]: Define __IEEE_BIG_ENDIAN.
* libc/include/machine/setjmp.h [MICROBLAZE]: Define _JBLEN, _JBTYPE.
* libc/include/sys/config.h [MICROBLAZE]: Define _REENT_SMALL,
_UNIX98_THREAD_MUTEX_ATTRIBUTES.
* libc/include/sys/types.h: Treat XMK like rtems, define
PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT, PTHREAD_STACK_MIN, define stuct pthread_attr_s.
* libc/machine/configure.in: Add microblaze.
* libc/machine/configure: Add microblaze (not regenerated).
* libc/machine/microblaze/configure.in: NEW.
* libc/machine/microblaze/configure: Generate.
* libc/machine/microblaze/Makefile.am: NEW.
* libc/machine/microblaze/Makefile.in: Generate.
* libc/machine/microblaze/{abort.c, strcmp.c, strcpy.c, strlen.c,
mallocr.c, longjmp.S, setjmp.S}: NEW.
* libc/stdlib/mallocr.c [MICROBLAZE]: Don't declare sbrk prototype,
mALLOc(): return malloc value.
2009-09-29 00:42:21 +08:00
|
|
|
#endif
|
|
|
|
|
2013-05-14 05:39:51 +08:00
|
|
|
#ifdef __MSP430__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define __SMALL_BITFIELDS /* 16 Bit INT */
|
|
|
|
#endif
|
|
|
|
|
2018-03-12 04:23:26 +08:00
|
|
|
#ifdef __PRU__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2011-11-29 14:33:49 +08:00
|
|
|
#ifdef __RL78__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define __SMALL_BITFIELDS /* 16 Bit INT */
|
2014-05-14 19:33:24 +08:00
|
|
|
#ifndef __RL78_64BIT_DOUBLES__
|
2011-11-29 14:33:49 +08:00
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
2014-05-14 19:33:24 +08:00
|
|
|
#endif
|
2011-11-29 14:33:49 +08:00
|
|
|
|
2009-10-26 18:05:23 +08:00
|
|
|
#ifdef __RX__
|
|
|
|
|
|
|
|
#ifdef __RX_BIG_ENDIAN__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#else
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __RX_64BIT_DOUBLES__
|
|
|
|
#define _DOUBLE_IS_32BITS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __RX_16BIT_INTS__
|
|
|
|
#define __SMALL_BITFIELDS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-12-03 03:30:47 +08:00
|
|
|
#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#define __SMALL_BITFIELDS /* 16 Bit INT */
|
|
|
|
#endif
|
|
|
|
|
2013-05-07 02:23:09 +08:00
|
|
|
#ifdef __NIOS2__
|
|
|
|
# ifdef __nios2_big_endian__
|
|
|
|
# define __IEEE_BIG_ENDIAN
|
|
|
|
# else
|
|
|
|
# define __IEEE_LITTLE_ENDIAN
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2015-01-22 02:27:47 +08:00
|
|
|
#ifdef __VISIUM__
|
|
|
|
#define __IEEE_BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2019-01-15 23:36:50 +08:00
|
|
|
#ifdef __AMDGCN__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2019-12-17 05:56:11 +08:00
|
|
|
#ifdef __XTENSA_EL__
|
|
|
|
#define __IEEE_LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2018-06-27 21:53:51 +08:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
#define __OBSOLETE_MATH_DEFAULT 0
|
|
|
|
#endif
|
|
|
|
|
New expf, exp2f, logf, log2f and powf implementations
Based on code from https://github.com/ARM-software/optimized-routines/
This patch adds a highly optimized generic implementation of expf,
exp2f, logf, log2f and powf. The new functions are not only
faster (6x for powf!), but are also smaller and more accurate.
In order to achieve this, the algorithm uses double precision
arithmetic for accuracy, avoids divisions and uses small table
lookups to minimize the polynomials. Special cases are handled
inline to avoid the unnecessary overhead of wrapper functions and
set errno to POSIX requirements.
The new functions are added under newlib/libm/common, but the old
implementations are kept (in newlib/libm/math) for non-IEEE or
pre-C99 systems. Targets can enable the new math code by defining
__OBSOLETE_MATH_DEFAULT to 0 in newlib/libc/include/machine/ieeefp.h,
users can override the default by defining __OBSOLETE_MATH.
Currently the new code is enabled for AArch64 and AArch32 with VFP.
Targets with a single precision FPU may still prefer the old
implementation.
libm.a size changes:
arm: -1692
arm/thumb/v7-a/nofp: -878
arm/thumb/v7-a+fp/hard: -864
arm/thumb/v7-a+fp/softfp: -908
aarch64: -1476
2017-05-25 23:41:38 +08:00
|
|
|
#ifndef __OBSOLETE_MATH_DEFAULT
|
|
|
|
/* Use old math code by default. */
|
|
|
|
#define __OBSOLETE_MATH_DEFAULT 1
|
|
|
|
#endif
|
|
|
|
#ifndef __OBSOLETE_MATH
|
|
|
|
#define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifndef __IEEE_BIG_ENDIAN
|
|
|
|
#ifndef __IEEE_LITTLE_ENDIAN
|
|
|
|
#error Endianess not declared!!
|
|
|
|
#endif /* not __IEEE_LITTLE_ENDIAN */
|
|
|
|
#endif /* not __IEEE_BIG_ENDIAN */
|
|
|
|
|
|
|
|
#endif /* not __IEEE_LITTLE_ENDIAN */
|
|
|
|
#endif /* not __IEEE_BIG_ENDIAN */
|
|
|
|
|