arm-gcc.h revision 255361
1104349Sphk/* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */
2104349Sphk/* $FreeBSD: head/lib/libc/arm/softfloat/arm-gcc.h 255361 2013-09-07 14:04:10Z andrew $ */
3104349Sphk
4104349Sphk/*
5104349Sphk-------------------------------------------------------------------------------
6104349SphkOne of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
7104349Sphk-------------------------------------------------------------------------------
8104349Sphk*/
9247296Sdelphij#ifdef __ARMEB__
10104349Sphk#define BIGENDIAN
11104349Sphk#else
12104349Sphk#define LITTLEENDIAN
13104349Sphk#endif
14104349Sphk
15104349Sphk/*
16104349Sphk-------------------------------------------------------------------------------
17104349SphkThe macro `BITS64' can be defined to indicate that 64-bit integer types are
18104349Sphksupported by the compiler.
19104349Sphk-------------------------------------------------------------------------------
20104349Sphk*/
21104349Sphk#define BITS64
22104349Sphk
23104349Sphk/*
24104349Sphk-------------------------------------------------------------------------------
25104349SphkEach of the following `typedef's defines the most convenient type that holds
26104349Sphkintegers of at least as many bits as specified.  For example, `uint8' should
27104349Sphkbe the most convenient type that can hold unsigned integers of as many as
28104349Sphk8 bits.  The `flag' type must be able to hold either a 0 or 1.  For most
29104349Sphkimplementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
30104349Sphkto the same as `int'.
31104349Sphk-------------------------------------------------------------------------------
32104349Sphk*/
33104349Sphktypedef int flag;
34178848Scokanetypedef int uint8;
35178848Scokanetypedef int int8;
36104349Sphktypedef int uint16;
37178848Scokanetypedef int int16;
38178848Scokanetypedef unsigned int uint32;
39178848Scokanetypedef signed int int32;
40104349Sphk#ifdef BITS64
41104349Sphktypedef unsigned long long int uint64;
42247296Sdelphijtypedef signed long long int int64;
43104349Sphk#endif
44104349Sphk
45104349Sphk/*
46104349Sphk-------------------------------------------------------------------------------
47104349SphkEach of the following `typedef's defines a type that holds integers
48104349Sphkof _exactly_ the number of bits specified.  For instance, for most
49178848Scokaneimplementation of C, `bits16' and `sbits16' should be `typedef'ed to
50178848Scokane`unsigned short int' and `signed short int' (or `short int'), respectively.
51104349Sphk-------------------------------------------------------------------------------
52178848Scokane*/
53178848Scokanetypedef unsigned char bits8;
54178848Scokanetypedef signed char sbits8;
55104349Sphktypedef unsigned short int bits16;
56104349Sphktypedef signed short int sbits16;
57178848Scokanetypedef unsigned int bits32;
58247296Sdelphijtypedef signed int sbits32;
59104349Sphk#ifdef BITS64
60178848Scokanetypedef unsigned long long int bits64;
61178848Scokanetypedef signed long long int sbits64;
62104349Sphk#endif
63104349Sphk
64104349Sphk#ifdef BITS64
65104349Sphk/*
66104349Sphk-------------------------------------------------------------------------------
67178848ScokaneThe `LIT64' macro takes as its argument a textual integer literal and
68104349Sphkif necessary ``marks'' the literal as having a 64-bit integer type.
69104349SphkFor example, the GNU C Compiler (`gcc') requires that 64-bit literals be
70104349Sphkappended with the letters `LL' standing for `long long', which is `gcc's
71104349Sphkname for the 64-bit integer type.  Some compilers may allow `LIT64' to be
72104349Sphkdefined as the identity macro:  `#define LIT64( a ) a'.
73104349Sphk-------------------------------------------------------------------------------
74104349Sphk*/
75178848Scokane#define LIT64( a ) a##LL
76178848Scokane#endif
77178848Scokane
78178848Scokane/*
79178848Scokane-------------------------------------------------------------------------------
80178848ScokaneThe macro `INLINE' can be used before functions that should be inlined.  If
81178848Scokanea compiler does not support explicit inlining, this macro should be defined
82178848Scokaneto be `static'.
83104349Sphk-------------------------------------------------------------------------------
84104349Sphk*/
85104349Sphk#define INLINE static __inline
86104349Sphk
87104349Sphk/*
88178848Scokane-------------------------------------------------------------------------------
89178848ScokaneThe ARM FPA is odd in that it stores doubles high-order word first, no matter
90178848Scokanewhat the endianness of the CPU.  VFP is sane.
91178848Scokane-------------------------------------------------------------------------------
92178848Scokane*/
93178848Scokane#if defined(SOFTFLOAT_FOR_GCC)
94178848Scokane#if defined (__ARM_EABI__) || defined(__VFP_FP__) || defined(__ARMEB__)
95178848Scokane#define FLOAT64_DEMANGLE(a)	(a)
96178848Scokane#define FLOAT64_MANGLE(a)	(a)
97104349Sphk#else
98104349Sphk#define FLOAT64_DEMANGLE(a)	((((a) & 0xfffffffful) << 32) | ((a) >> 32))
99104349Sphk#define FLOAT64_MANGLE(a)	FLOAT64_DEMANGLE(a)
100178848Scokane#endif
101178848Scokane#endif
102104349Sphk