source: trunk/libs/newlib/src/newlib/libc/include/machine/ieeefp.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 9.4 KB
Line 
1#ifndef __IEEE_BIG_ENDIAN
2#ifndef __IEEE_LITTLE_ENDIAN
3
4/* This file can define macros to choose variations of the IEEE float
5   format:
6
7   _FLT_LARGEST_EXPONENT_IS_NORMAL
8
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.
13
14   _FLT_NO_DENORMALS
15
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.
18 
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.
21
22   __IEEE_BIG_ENDIAN
23
24        Defined if the float format is big endian.  This is mutually exclusive
25        with __IEEE_LITTLE_ENDIAN.
26
27   __IEEE_LITTLE_ENDIAN
28 
29        Defined if the float format is little endian.  This is mutually exclusive
30        with __IEEE_BIG_ENDIAN.
31
32   Note that one of __IEEE_BIG_ENDIAN or __IEEE_LITTLE_ENDIAN must be specified for a
33   platform or error will occur.
34
35   __IEEE_BYTES_LITTLE_ENDIAN
36
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.
40
41   _DOUBLE_IS_32BITS
42
43        This is used on platforms that support double by using the 32-bit IEEE
44        float type.
45
46   _FLOAT_ARG
47
48        This represents what type a float arg is passed as.  It is used when the type is
49        not promoted to double.
50       
51
52   __OBSOLETE_MATH_DEFAULT
53
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.
56
57   __OBSOLETE_MATH
58
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.
68*/
69
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.  */
75#ifdef __VFP_FP__
76# ifdef __ARMEL__
77#  define __IEEE_LITTLE_ENDIAN
78# else
79#  define __IEEE_BIG_ENDIAN
80# endif
81# define __OBSOLETE_MATH_DEFAULT 0
82#else
83# define __IEEE_BIG_ENDIAN
84# ifdef __ARMEL__
85#  define __IEEE_BYTES_LITTLE_ENDIAN
86# endif
87#endif
88#endif
89
90#if defined (__aarch64__)
91#if defined (__AARCH64EL__)
92#define __IEEE_LITTLE_ENDIAN
93#else
94#define __IEEE_BIG_ENDIAN
95#endif
96#define __OBSOLETE_MATH_DEFAULT 0
97#endif
98
99#ifdef __epiphany__
100#define __IEEE_LITTLE_ENDIAN
101#define Sudden_Underflow 1
102#endif
103
104#ifdef __hppa__
105#define __IEEE_BIG_ENDIAN
106#endif
107
108#ifdef __nds32__
109#ifdef __big_endian__
110#define __IEEE_BIG_ENDIAN
111#else
112#define __IEEE_LITTLE_ENDIAN
113#endif
114#endif
115
116#ifdef __SPU__
117#define __IEEE_BIG_ENDIAN
118
119#define isfinite(__y) \
120        (__extension__ ({int __cy; \
121                (sizeof (__y) == sizeof (float))  ? (1) : \
122                (__cy = fpclassify(__y)) != FP_INFINITE && __cy != FP_NAN;}))
123
124#define isinf(__x) ((sizeof (__x) == sizeof (float))  ?  (0) : __isinfd(__x))
125#define isnan(__x) ((sizeof (__x) == sizeof (float))  ?  (0) : __isnand(__x))
126
127/*
128 * Macros for use in ieeefp.h. We can't just define the real ones here
129 * (like those above) as we have name space issues when this is *not*
130 * included via generic the ieeefp.h.
131 */
132#define __ieeefp_isnanf(x)      0
133#define __ieeefp_isinff(x)      0
134#define __ieeefp_finitef(x)     1
135#endif
136
137#ifdef __sparc__
138#ifdef __LITTLE_ENDIAN_DATA__
139#define __IEEE_LITTLE_ENDIAN
140#else
141#define __IEEE_BIG_ENDIAN
142#endif
143#endif
144
145#if defined(__m68k__) || defined(__mc68000__)
146#define __IEEE_BIG_ENDIAN
147#endif
148
149#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
150#define __IEEE_BIG_ENDIAN
151#ifdef __HAVE_SHORT_DOUBLE__
152# define _DOUBLE_IS_32BITS
153#endif
154#endif
155
156#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__)
157#define __IEEE_BIG_ENDIAN
158#define _FLOAT_ARG float
159#define _DOUBLE_IS_32BITS
160#endif
161
162#if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
163#define __IEEE_LITTLE_ENDIAN
164#define _FLOAT_ARG float
165#define _DOUBLE_IS_32BITS
166#endif
167
168
169#ifdef __sh__
170#ifdef __LITTLE_ENDIAN__
171#define __IEEE_LITTLE_ENDIAN
172#else
173#define __IEEE_BIG_ENDIAN
174#endif
175#if defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A_SINGLE_ONLY__)
176#define _DOUBLE_IS_32BITS
177#endif
178#endif
179
180#ifdef _AM29K
181#define __IEEE_BIG_ENDIAN
182#endif
183
184#ifdef _WIN32
185#define __IEEE_LITTLE_ENDIAN
186#endif
187
188#ifdef __i386__
189#define __IEEE_LITTLE_ENDIAN
190#endif
191
192#ifdef __riscv
193#define __IEEE_LITTLE_ENDIAN
194#endif
195
196#ifdef __i960__
197#define __IEEE_LITTLE_ENDIAN
198#endif
199
200#ifdef __lm32__
201#define __IEEE_BIG_ENDIAN
202#endif
203
204#ifdef __M32R__
205#define __IEEE_BIG_ENDIAN
206#endif
207
208#if defined(_C4x) || defined(_C3x)
209#define __IEEE_BIG_ENDIAN
210#define _DOUBLE_IS_32BITS
211#endif
212
213#ifdef __TMS320C6X__
214#ifdef _BIG_ENDIAN
215#define __IEEE_BIG_ENDIAN
216#else
217#define __IEEE_LITTLE_ENDIAN
218#endif
219#endif
220
221#ifdef __TIC80__
222#define __IEEE_LITTLE_ENDIAN
223#endif
224
225#ifdef __MIPSEL__
226#define __IEEE_LITTLE_ENDIAN
227#endif
228#ifdef __MIPSEB__
229#define __IEEE_BIG_ENDIAN
230#endif
231
232#ifdef __MMIX__
233#define __IEEE_BIG_ENDIAN
234#endif
235
236#ifdef __D30V__
237#define __IEEE_BIG_ENDIAN
238#endif
239
240/* necv70 was __IEEE_LITTLE_ENDIAN. */
241
242#ifdef __W65__
243#define __IEEE_LITTLE_ENDIAN
244#define _DOUBLE_IS_32BITS
245#endif
246
247#if defined(__Z8001__) || defined(__Z8002__)
248#define __IEEE_BIG_ENDIAN
249#endif
250
251#ifdef __m88k__
252#define __IEEE_BIG_ENDIAN
253#endif
254
255#ifdef __mn10300__
256#define __IEEE_LITTLE_ENDIAN
257#endif
258
259#ifdef __mn10200__
260#define __IEEE_LITTLE_ENDIAN
261#define _DOUBLE_IS_32BITS
262#endif
263
264#ifdef __v800
265#define __IEEE_LITTLE_ENDIAN
266#endif
267
268#ifdef __v850
269#define __IEEE_LITTLE_ENDIAN
270#endif
271
272#ifdef __D10V__
273#define __IEEE_BIG_ENDIAN
274#if __DOUBLE__ == 32
275#define _DOUBLE_IS_32BITS
276#endif
277#endif
278
279#ifdef __PPC__
280#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX)
281#define __IEEE_BIG_ENDIAN
282#else
283#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32)
284#define __IEEE_LITTLE_ENDIAN
285#endif
286#endif
287#endif
288
289#ifdef __xstormy16__
290#define __IEEE_LITTLE_ENDIAN
291#endif
292
293#ifdef __arc__
294#ifdef __big_endian__
295#define __IEEE_BIG_ENDIAN
296#else
297#define __IEEE_LITTLE_ENDIAN
298#endif
299#endif
300
301#ifdef __CRX__
302#define __IEEE_LITTLE_ENDIAN
303#endif
304
305#ifdef __fr30__
306#define __IEEE_BIG_ENDIAN
307#endif
308
309#ifdef __FT32__
310#define __IEEE_LITTLE_ENDIAN
311#endif
312
313#ifdef __mcore__
314#define __IEEE_BIG_ENDIAN
315#endif
316
317#ifdef __mt__
318#define __IEEE_BIG_ENDIAN
319#endif
320
321#ifdef __frv__
322#define __IEEE_BIG_ENDIAN
323#endif
324
325#ifdef __moxie__
326#ifdef __MOXIE_BIG_ENDIAN__
327#define __IEEE_BIG_ENDIAN
328#else
329#define __IEEE_LITTLE_ENDIAN
330#endif
331#endif
332
333#ifdef __ia64__
334#ifdef __BIG_ENDIAN__
335#define __IEEE_BIG_ENDIAN
336#else
337#define __IEEE_LITTLE_ENDIAN
338#endif
339#endif
340
341#ifdef __AVR__
342#define __IEEE_LITTLE_ENDIAN
343#define _DOUBLE_IS_32BITS
344#endif
345
346#if defined(__or1k__) || defined(__OR1K__) || defined(__OR1KND__)
347#define __IEEE_BIG_ENDIAN
348#endif
349
350#ifdef __IP2K__
351#define __IEEE_BIG_ENDIAN
352#define __SMALL_BITFIELDS
353#define _DOUBLE_IS_32BITS
354#endif
355
356#ifdef __iq2000__
357#define __IEEE_BIG_ENDIAN
358#endif
359
360#ifdef __MAVERICK__
361#ifdef __ARMEL__
362#  define __IEEE_LITTLE_ENDIAN
363#else  /* must be __ARMEB__ */
364#  define __IEEE_BIG_ENDIAN
365#endif /* __ARMEL__ */
366#endif /* __MAVERICK__ */
367
368#ifdef __m32c__
369#define __IEEE_LITTLE_ENDIAN
370#define __SMALL_BITFIELDS
371#endif
372
373#ifdef __CRIS__
374#define __IEEE_LITTLE_ENDIAN
375#endif
376
377#ifdef __BFIN__
378#define __IEEE_LITTLE_ENDIAN
379#endif
380
381#ifdef __x86_64__
382#define __IEEE_LITTLE_ENDIAN
383#endif
384
385#ifdef __mep__
386#ifdef __LITTLE_ENDIAN__
387#define __IEEE_LITTLE_ENDIAN
388#else
389#define __IEEE_BIG_ENDIAN
390#endif
391#endif
392
393#ifdef __MICROBLAZE__
394#ifndef __MICROBLAZEEL__
395#define __IEEE_BIG_ENDIAN
396#else
397#define __IEEE_LITTLE_ENDIAN
398#endif
399#endif
400
401#ifdef __MSP430__
402#define __IEEE_LITTLE_ENDIAN
403#define __SMALL_BITFIELDS       /* 16 Bit INT */
404#endif
405
406#ifdef __RL78__
407#define __IEEE_LITTLE_ENDIAN
408#define __SMALL_BITFIELDS       /* 16 Bit INT */
409#ifndef __RL78_64BIT_DOUBLES__
410#define _DOUBLE_IS_32BITS
411#endif
412#endif
413
414#ifdef __RX__
415
416#ifdef __RX_BIG_ENDIAN__
417#define __IEEE_BIG_ENDIAN
418#else
419#define __IEEE_LITTLE_ENDIAN
420#endif
421
422#ifndef __RX_64BIT_DOUBLES__
423#define _DOUBLE_IS_32BITS
424#endif
425
426#ifdef __RX_16BIT_INTS__
427#define __SMALL_BITFIELDS
428#endif
429
430#endif
431
432#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
433#define __IEEE_LITTLE_ENDIAN
434#define __SMALL_BITFIELDS       /* 16 Bit INT */
435#endif
436
437#ifdef __NIOS2__
438# ifdef __nios2_big_endian__
439#  define __IEEE_BIG_ENDIAN
440# else
441#  define __IEEE_LITTLE_ENDIAN
442# endif
443#endif
444
445#ifdef __VISIUM__
446#define __IEEE_BIG_ENDIAN
447#endif
448
449#ifndef __OBSOLETE_MATH_DEFAULT
450/* Use old math code by default.  */
451#define __OBSOLETE_MATH_DEFAULT 1
452#endif
453#ifndef __OBSOLETE_MATH
454#define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT
455#endif
456
457#ifndef __IEEE_BIG_ENDIAN
458#ifndef __IEEE_LITTLE_ENDIAN
459#error Endianess not declared!!
460#endif /* not __IEEE_LITTLE_ENDIAN */
461#endif /* not __IEEE_BIG_ENDIAN */
462
463#endif /* not __IEEE_LITTLE_ENDIAN */
464#endif /* not __IEEE_BIG_ENDIAN */
465
Note: See TracBrowser for help on using the repository browser.