1 #ifndef __IEEE_BIG_ENDIAN
2 #ifndef __IEEE_LITTLE_ENDIAN
4 /* This file can define macros to choose variations of the IEEE float
7 _FLT_LARGEST_EXPONENT_IS_NORMAL
9 Defined if the float format uses the largest exponent for finite
10 numbers rather than NaN and infinity representations. Such a
11 format cannot represent NaNs or infinities at all, but it's FLT_MAX
12 is twice the IEEE value.
16 Defined if the float format does not support IEEE denormals. Every
17 float with a zero exponent is taken to be a zero representation.
19 ??? At the moment, there are no equivalent macros above for doubles and
20 the macros are not fully supported by --enable-newlib-hw-fp.
24 Defined if the float format is big endian. This is mutually exclusive
25 with __IEEE_LITTLE_ENDIAN.
29 Defined if the float format is little endian. This is mutually exclusive
30 with __IEEE_BIG_ENDIAN.
32 Note that one of __IEEE_BIG_ENDIAN or __IEEE_LITTLE_ENDIAN must be specified for a
33 platform or error will occur.
35 __IEEE_BYTES_LITTLE_ENDIAN
37 This flag is used in conjunction with __IEEE_BIG_ENDIAN to describe a situation
38 whereby multiple words of an IEEE floating point are in big endian order, but the
39 words themselves are little endian with respect to the bytes.
43 This is used on platforms that support double by using the 32-bit IEEE
48 This represents what type a float arg is passed as. It is used when the type is
49 not promoted to double.
52 __OBSOLETE_MATH_DEFAULT
54 Default value for __OBSOLETE_MATH if that's not set by the user.
55 It should be set here based on predefined feature macros.
59 If set to 1 then some new math code will be disabled and older libm
60 code will be used instead. This is necessary because the new math
61 code does not support all targets, it assumes that the toolchain has
62 ISO C99 support (hexfloat literals, standard fenv semantics), the
63 target has IEEE-754 conforming binary32 float and binary64 double
64 (not mixed endian) representation, standard SNaN representation,
65 double and single precision arithmetics has similar latency and it
66 has no legacy SVID matherr support, only POSIX errno and fenv
67 exception based error handling.
70 #if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
71 /* ARM traditionally used big-endian words; and within those words the
72 byte ordering was big or little endian depending upon the target.
73 Modern floating-point formats are naturally ordered; in this case
74 __VFP_FP__ will be defined, even if soft-float. */
77 # define __IEEE_LITTLE_ENDIAN
79 # define __IEEE_BIG_ENDIAN
82 # define __OBSOLETE_MATH_DEFAULT 0
85 # define __IEEE_BIG_ENDIAN
87 # define __IEEE_BYTES_LITTLE_ENDIAN
91 # define _SUPPORTS_ERREXCEPT
93 /* As per ISO/IEC TS 18661 '__FLT_EVAL_METHOD__' will be defined to 16
94 (if compiling with +fp16 support) so it can't be used by math.h to
95 define float_t and double_t. For values of '__FLT_EVAL_METHOD__'
96 other than 0, 1, 2 the definition of float_t and double_t is
97 implementation-defined. */
98 #define __DOUBLE_TYPE double
99 #define __FLOAT_TYPE float
102 #if defined (__aarch64__)
103 #if defined (__AARCH64EL__)
104 #define __IEEE_LITTLE_ENDIAN
106 #define __IEEE_BIG_ENDIAN
108 #define __OBSOLETE_MATH_DEFAULT 0
110 # define _SUPPORTS_ERREXCEPT
112 /* As per ISO/IEC TS 18661 '__FLT_EVAL_METHOD__' will be defined to 16
113 (if compiling with +fp16 support) so it can't be used by math.h to
114 define float_t and double_t. For values of '__FLT_EVAL_METHOD__'
115 other than 0, 1, 2 the definition of float_t and double_t is
116 implementation-defined. */
117 #define __DOUBLE_TYPE double
118 #define __FLOAT_TYPE float
122 #define __IEEE_LITTLE_ENDIAN
123 #define Sudden_Underflow 1
127 #define __IEEE_BIG_ENDIAN
131 #ifdef __big_endian__
132 #define __IEEE_BIG_ENDIAN
134 #define __IEEE_LITTLE_ENDIAN
139 #define __IEEE_BIG_ENDIAN
141 #define isfinite(__y) \
142 (__extension__ ({int __cy; \
143 (sizeof (__y) == sizeof (float)) ? (1) : \
144 (__cy = fpclassify(__y)) != FP_INFINITE && __cy != FP_NAN;}))
146 #define isinf(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x))
147 #define isnan(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x))
150 * Macros for use in ieeefp.h. We can't just define the real ones here
151 * (like those above) as we have name space issues when this is *not*
152 * included via generic the ieeefp.h.
154 #define __ieeefp_isnanf(x) 0
155 #define __ieeefp_isinff(x) 0
156 #define __ieeefp_finitef(x) 1
160 #ifdef __LITTLE_ENDIAN_DATA__
161 #define __IEEE_LITTLE_ENDIAN
163 #define __IEEE_BIG_ENDIAN
167 #if defined(__m68k__) || defined(__mc68000__)
168 #define __IEEE_BIG_ENDIAN
171 #if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
172 #define __IEEE_BIG_ENDIAN
173 #ifdef __HAVE_SHORT_DOUBLE__
174 # define _DOUBLE_IS_32BITS
178 #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__)
179 #define __IEEE_BIG_ENDIAN
180 #define _FLOAT_ARG float
181 #define _DOUBLE_IS_32BITS
184 #if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
185 #define __IEEE_LITTLE_ENDIAN
186 #define _FLOAT_ARG float
187 #define _DOUBLE_IS_32BITS
192 #ifdef __LITTLE_ENDIAN__
193 #define __IEEE_LITTLE_ENDIAN
195 #define __IEEE_BIG_ENDIAN
197 #if defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A_SINGLE_ONLY__)
198 #define _DOUBLE_IS_32BITS
203 #define __IEEE_BIG_ENDIAN
207 #define __IEEE_LITTLE_ENDIAN
211 #define __IEEE_LITTLE_ENDIAN
212 # define _SUPPORTS_ERREXCEPT
216 #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
217 #define __IEEE_BIG_ENDIAN
219 #define __IEEE_LITTLE_ENDIAN
221 #if defined(__riscv_flen) || defined (__riscv_zfinx)
222 # define _SUPPORTS_ERREXCEPT
224 #if (__riscv_flen == 64) || defined (__riscv_zdinx)
225 # define __OBSOLETE_MATH_DEFAULT 0
227 # define __OBSOLETE_MATH_DEFAULT 1
232 #define __IEEE_LITTLE_ENDIAN
236 #define __IEEE_BIG_ENDIAN
240 #define __IEEE_BIG_ENDIAN
244 #define __IEEE_LITTLE_ENDIAN
247 #if defined(_C4x) || defined(_C3x)
248 #define __IEEE_BIG_ENDIAN
249 #define _DOUBLE_IS_32BITS
254 #define __IEEE_BIG_ENDIAN
256 #define __IEEE_LITTLE_ENDIAN
261 #define __IEEE_LITTLE_ENDIAN
265 #define __IEEE_LITTLE_ENDIAN
268 #define __IEEE_BIG_ENDIAN
272 #define __IEEE_BIG_ENDIAN
276 #define __IEEE_BIG_ENDIAN
279 /* necv70 was __IEEE_LITTLE_ENDIAN. */
282 #define __IEEE_LITTLE_ENDIAN
283 #define _DOUBLE_IS_32BITS
286 #if defined(__Z8001__) || defined(__Z8002__)
287 #define __IEEE_BIG_ENDIAN
291 #define __IEEE_BIG_ENDIAN
295 #define __IEEE_LITTLE_ENDIAN
299 #define __IEEE_LITTLE_ENDIAN
300 #define _DOUBLE_IS_32BITS
304 #define __IEEE_LITTLE_ENDIAN
308 #define __IEEE_LITTLE_ENDIAN
312 #define __IEEE_BIG_ENDIAN
314 #define _DOUBLE_IS_32BITS
319 #if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX)
320 #define __IEEE_BIG_ENDIAN
322 #if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32)
323 #define __IEEE_LITTLE_ENDIAN
329 #define __IEEE_LITTLE_ENDIAN
333 #ifdef __big_endian__
334 #define __IEEE_BIG_ENDIAN
336 #define __IEEE_LITTLE_ENDIAN
341 #define __IEEE_LITTLE_ENDIAN
345 #define __IEEE_LITTLE_ENDIAN
350 #define __IEEE_BIG_ENDIAN
352 #define __IEEE_LITTLE_ENDIAN
357 #define __IEEE_BIG_ENDIAN
361 #define __IEEE_LITTLE_ENDIAN
365 #define __IEEE_BIG_ENDIAN
369 #define __IEEE_BIG_ENDIAN
373 #define __IEEE_BIG_ENDIAN
377 #ifdef __MOXIE_BIG_ENDIAN__
378 #define __IEEE_BIG_ENDIAN
380 #define __IEEE_LITTLE_ENDIAN
385 #ifdef __BIG_ENDIAN__
386 #define __IEEE_BIG_ENDIAN
388 #define __IEEE_LITTLE_ENDIAN
393 #define __IEEE_LITTLE_ENDIAN
394 #define _DOUBLE_IS_32BITS
397 #if defined(__or1k__) || defined(__OR1K__) || defined(__OR1KND__)
398 #define __IEEE_BIG_ENDIAN
402 #define __IEEE_BIG_ENDIAN
403 #define __SMALL_BITFIELDS
404 #define _DOUBLE_IS_32BITS
408 #define __IEEE_BIG_ENDIAN
413 # define __IEEE_LITTLE_ENDIAN
414 #else /* must be __ARMEB__ */
415 # define __IEEE_BIG_ENDIAN
416 #endif /* __ARMEL__ */
417 #endif /* __MAVERICK__ */
420 #define __IEEE_LITTLE_ENDIAN
421 #define __SMALL_BITFIELDS
425 #define __IEEE_LITTLE_ENDIAN
429 #define __IEEE_LITTLE_ENDIAN
433 #define __IEEE_LITTLE_ENDIAN
434 # define _SUPPORTS_ERREXCEPT
438 #ifdef __LITTLE_ENDIAN__
439 #define __IEEE_LITTLE_ENDIAN
441 #define __IEEE_BIG_ENDIAN
445 #ifdef __MICROBLAZE__
446 #ifndef __MICROBLAZEEL__
447 #define __IEEE_BIG_ENDIAN
449 #define __IEEE_LITTLE_ENDIAN
454 #define __IEEE_LITTLE_ENDIAN
455 #define __SMALL_BITFIELDS /* 16 Bit INT */
459 #define __IEEE_LITTLE_ENDIAN
463 #define __IEEE_LITTLE_ENDIAN
464 #define __SMALL_BITFIELDS /* 16 Bit INT */
465 #ifndef __RL78_64BIT_DOUBLES__
466 #define _DOUBLE_IS_32BITS
472 #ifdef __RX_BIG_ENDIAN__
473 #define __IEEE_BIG_ENDIAN
475 #define __IEEE_LITTLE_ENDIAN
478 #ifndef __RX_64BIT_DOUBLES__
479 #define _DOUBLE_IS_32BITS
482 #ifdef __RX_16BIT_INTS__
483 #define __SMALL_BITFIELDS
488 #if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
489 #define __IEEE_LITTLE_ENDIAN
490 #define __SMALL_BITFIELDS /* 16 Bit INT */
494 # ifdef __nios2_big_endian__
495 # define __IEEE_BIG_ENDIAN
497 # define __IEEE_LITTLE_ENDIAN
502 #define __IEEE_BIG_ENDIAN
506 #define __IEEE_LITTLE_ENDIAN
510 #define __IEEE_LITTLE_ENDIAN
514 #define __IEEE_BIG_ENDIAN
518 #define __OBSOLETE_MATH_DEFAULT 0
521 #ifndef __OBSOLETE_MATH_DEFAULT
522 /* Use old math code by default. */
523 #define __OBSOLETE_MATH_DEFAULT 1
525 #ifndef __OBSOLETE_MATH
526 #define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT
529 #ifndef __IEEE_BIG_ENDIAN
530 #ifndef __IEEE_LITTLE_ENDIAN
531 #error Endianess not declared!!
532 #endif /* not __IEEE_LITTLE_ENDIAN */
533 #endif /* not __IEEE_BIG_ENDIAN */
535 #endif /* not __IEEE_LITTLE_ENDIAN */
536 #endif /* not __IEEE_BIG_ENDIAN */