xref: /openbsd-src/lib/libc/arch/arm/softfloat/arm-gcc.h (revision d45a0e270db178ccbfd7b63e28a4c8dcf511dbb1)
1*d45a0e27Sdrahn /*	$OpenBSD: arm-gcc.h,v 1.2 2004/02/01 05:40:52 drahn Exp $	*/
2d987040fSdrahn /* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */
3d987040fSdrahn 
4d987040fSdrahn /*
5d987040fSdrahn -------------------------------------------------------------------------------
6d987040fSdrahn One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
7d987040fSdrahn -------------------------------------------------------------------------------
8d987040fSdrahn */
9d987040fSdrahn #ifdef __ARMEB__
10d987040fSdrahn #define BIGENDIAN
11d987040fSdrahn #else
12d987040fSdrahn #define LITTLEENDIAN
13d987040fSdrahn #endif
14d987040fSdrahn 
15d987040fSdrahn /*
16d987040fSdrahn -------------------------------------------------------------------------------
17d987040fSdrahn The macro `BITS64' can be defined to indicate that 64-bit integer types are
18d987040fSdrahn supported by the compiler.
19d987040fSdrahn -------------------------------------------------------------------------------
20d987040fSdrahn */
21d987040fSdrahn #define BITS64
22d987040fSdrahn 
23d987040fSdrahn /*
24d987040fSdrahn -------------------------------------------------------------------------------
25d987040fSdrahn Each of the following `typedef's defines the most convenient type that holds
26d987040fSdrahn integers of at least as many bits as specified.  For example, `uint8' should
27d987040fSdrahn be the most convenient type that can hold unsigned integers of as many as
28d987040fSdrahn 8 bits.  The `flag' type must be able to hold either a 0 or 1.  For most
29d987040fSdrahn implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
30d987040fSdrahn to the same as `int'.
31d987040fSdrahn -------------------------------------------------------------------------------
32d987040fSdrahn */
33d987040fSdrahn typedef int flag;
34d987040fSdrahn typedef int uint8;
35d987040fSdrahn typedef int int8;
36d987040fSdrahn typedef int uint16;
37d987040fSdrahn typedef int int16;
38d987040fSdrahn typedef unsigned int uint32;
39d987040fSdrahn typedef signed int int32;
40d987040fSdrahn #ifdef BITS64
41d987040fSdrahn typedef unsigned long long int uint64;
42d987040fSdrahn typedef signed long long int int64;
43d987040fSdrahn #endif
44d987040fSdrahn 
45d987040fSdrahn /*
46d987040fSdrahn -------------------------------------------------------------------------------
47d987040fSdrahn Each of the following `typedef's defines a type that holds integers
48d987040fSdrahn of _exactly_ the number of bits specified.  For instance, for most
49d987040fSdrahn implementation of C, `bits16' and `sbits16' should be `typedef'ed to
50d987040fSdrahn `unsigned short int' and `signed short int' (or `short int'), respectively.
51d987040fSdrahn -------------------------------------------------------------------------------
52d987040fSdrahn */
53d987040fSdrahn typedef unsigned char bits8;
54d987040fSdrahn typedef signed char sbits8;
55d987040fSdrahn typedef unsigned short int bits16;
56d987040fSdrahn typedef signed short int sbits16;
57d987040fSdrahn typedef unsigned int bits32;
58d987040fSdrahn typedef signed int sbits32;
59d987040fSdrahn #ifdef BITS64
60d987040fSdrahn typedef unsigned long long int bits64;
61d987040fSdrahn typedef signed long long int sbits64;
62d987040fSdrahn #endif
63d987040fSdrahn 
64d987040fSdrahn #ifdef BITS64
65d987040fSdrahn /*
66d987040fSdrahn -------------------------------------------------------------------------------
67d987040fSdrahn The `LIT64' macro takes as its argument a textual integer literal and
68d987040fSdrahn if necessary ``marks'' the literal as having a 64-bit integer type.
69d987040fSdrahn For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
70d987040fSdrahn appended with the letters `LL' standing for `long long', which is `gcc's
71d987040fSdrahn name for the 64-bit integer type.  Some compilers may allow `LIT64' to be
72d987040fSdrahn defined as the identity macro:  `#define LIT64( a ) a'.
73d987040fSdrahn -------------------------------------------------------------------------------
74d987040fSdrahn */
75d987040fSdrahn #define LIT64( a ) a##LL
76d987040fSdrahn #endif
77d987040fSdrahn 
78d987040fSdrahn /*
79d987040fSdrahn -------------------------------------------------------------------------------
80d987040fSdrahn The macro `INLINE' can be used before functions that should be inlined.  If
81d987040fSdrahn a compiler does not support explicit inlining, this macro should be defined
82d987040fSdrahn to be `static'.
83d987040fSdrahn -------------------------------------------------------------------------------
84d987040fSdrahn */
85d987040fSdrahn #define INLINE static __inline
86d987040fSdrahn 
87d987040fSdrahn /*
88d987040fSdrahn -------------------------------------------------------------------------------
89d987040fSdrahn The ARM FPA is odd in that it stores doubles high-order word first, no matter
90d987040fSdrahn what the endianness of the CPU.  VFP is sane.
91d987040fSdrahn -------------------------------------------------------------------------------
92d987040fSdrahn */
93d987040fSdrahn #if defined(__VFP_FP__) || defined(__ARMEB__)
94d987040fSdrahn #define FLOAT64_DEMANGLE(a)	(a)
95d987040fSdrahn #define FLOAT64_MANGLE(a)	(a)
96d987040fSdrahn #else
97d987040fSdrahn #define FLOAT64_DEMANGLE(a)	(((a) << 32) | ((a) >> 32))
98d987040fSdrahn #define FLOAT64_MANGLE(a)	FLOAT64_DEMANGLE(a)
99d987040fSdrahn #endif
100