1 /** @file
2 
3   Copyright (c) 2014, ARM Limited. All rights reserved.
4 
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 /* $NetBSD: arm-gcc.h,v 1.4 2013/01/26 07:08:14 matt Exp $ */
16 
17 /*
18 -------------------------------------------------------------------------------
19 One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
20 -------------------------------------------------------------------------------
21 */
22 #ifdef __ARMEB__
23 #define BIGENDIAN
24 #else
25 #define LITTLEENDIAN
26 #endif
27 
28 /*
29 -------------------------------------------------------------------------------
30 The macro `BITS64' can be defined to indicate that 64-bit integer types are
31 supported by the compiler.
32 -------------------------------------------------------------------------------
33 */
34 #define BITS64
35 
36 /*
37 -------------------------------------------------------------------------------
38 Each of the following `typedef's defines the most convenient type that holds
39 integers of at least as many bits as specified.  For example, `uint8' should
40 be the most convenient type that can hold unsigned integers of as many as
41 8 bits.  The `flag' type must be able to hold either a 0 or 1.  For most
42 implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
43 to the same as `int'.
44 -------------------------------------------------------------------------------
45 */
46 typedef int flag;
47 typedef int uint8;
48 typedef int int8;
49 typedef int uint16;
50 typedef int int16;
51 typedef unsigned int uint32;
52 typedef signed int int32;
53 #ifdef BITS64
54 typedef unsigned long long int uint64;
55 typedef signed long long int int64;
56 #endif
57 
58 /*
59 -------------------------------------------------------------------------------
60 Each of the following `typedef's defines a type that holds integers
61 of _exactly_ the number of bits specified.  For instance, for most
62 implementation of C, `bits16' and `sbits16' should be `typedef'ed to
63 `unsigned short int' and `signed short int' (or `short int'), respectively.
64 -------------------------------------------------------------------------------
65 */
66 typedef unsigned char bits8;
67 typedef signed char sbits8;
68 typedef unsigned short int bits16;
69 typedef signed short int sbits16;
70 typedef unsigned int bits32;
71 typedef signed int sbits32;
72 #ifdef BITS64
73 typedef unsigned long long int bits64;
74 typedef signed long long int sbits64;
75 #endif
76 
77 #ifdef BITS64
78 /*
79 -------------------------------------------------------------------------------
80 The `LIT64' macro takes as its argument a textual integer literal and
81 if necessary ``marks'' the literal as having a 64-bit integer type.
82 For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
83 appended with the letters `LL' standing for `long long', which is `gcc's
84 name for the 64-bit integer type.  Some compilers may allow `LIT64' to be
85 defined as the identity macro:  `#define LIT64( a ) a'.
86 -------------------------------------------------------------------------------
87 */
88 #define LIT64( a ) a##ULL
89 #endif
90 
91 /*
92 -------------------------------------------------------------------------------
93 The macro `INLINE' can be used before functions that should be inlined.  If
94 a compiler does not support explicit inlining, this macro should be defined
95 to be `static'.
96 -------------------------------------------------------------------------------
97 */
98 #define INLINE static inline
99 
100 /*
101 -------------------------------------------------------------------------------
102 The ARM FPA is odd in that it stores doubles high-order word first, no matter
103 what the endianness of the CPU.  VFP is sane.
104 -------------------------------------------------------------------------------
105 */
106 #if defined(SOFTFLOAT_FOR_GCC)
107 #if defined(__VFP_FP__) || defined(__ARMEB__)
108 #define FLOAT64_DEMANGLE(a) (a)
109 #define FLOAT64_MANGLE(a)   (a)
110 #else
111 #define FLOAT64_DEMANGLE(a) (((a) << 32) | ((a) >> 32))
112 #define FLOAT64_MANGLE(a)   FLOAT64_DEMANGLE(a)
113 #endif
114 #endif
115