1 /* This file is part of psim (model of the PowerPC(tm) architecture)
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License
7 as published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 PowerPC is a trademark of International Business Machines Corporation. */
24 /* Basic type sizes for the PowerPC */
30 /* INTEGER QUANTITIES:
34 natural* sign determined by host
35 signed* signed type of the given size
36 unsigned* The corresponding insigned type
40 *NN Size based on the number of bits
41 *_NN Size according to the number of bytes
42 *_word Size based on the target architecture's word
43 word size (32/64 bits)
44 *_cell Size based on the target architecture's
45 IEEE 1275 cell size (almost always 32 bits)
46 *_address Fits target address
51 Alias for unsigned_address
53 cell_word Alias for signed_cell
55 fp_word Holds a floating point word.
61 typedef char natural8;
62 typedef short natural16;
63 typedef long natural32;
65 typedef signed char signed8;
66 typedef signed short signed16;
67 typedef signed long signed32;
69 typedef unsigned char unsigned8;
70 typedef unsigned short unsigned16;
71 typedef unsigned long unsigned32;
73 #if defined __GNUC__ || defined _MSC_VER
76 /* GDB sometimes likes to make what appear to be signed `0x*L' values
77 unsigned by default */
79 typedef long long natural64;
80 typedef signed long long signed64;
81 typedef unsigned long long unsigned64;
83 #define UNSIGNED64(X) (X##ULL)
84 #define SIGNED64(X) ((signed64) X##LL)
86 #define UNSIGNED32(X) (X##UL)
87 #define SIGNED32(X) ((signed32) X##L)
91 typedef __int64 natural64;
92 typedef signed __int64 signed64;
93 typedef unsigned __int64 unsigned64;
95 #define UNSIGNED64(X) (X##ui64)
96 #define SIGNED64(X) (X##i64)
98 #define SIGNED32(X) (X##ui32)
99 #define UNSIGNED32(X) (X##i32)
101 #endif /* _MSC_VER */
103 typedef struct { unsigned64 a[2]; } unsigned128;
104 typedef struct { signed64 a[2]; } signed128;
106 #else /* Not GNUC or _MSC_VER */
111 typedef natural8 natural_1;
112 typedef natural16 natural_2;
113 typedef natural32 natural_4;
114 typedef natural64 natural_8;
115 /* typedef natural64 natural_8; */
117 typedef signed8 signed_1;
118 typedef signed16 signed_2;
119 typedef signed32 signed_4;
120 typedef signed64 signed_8;
121 typedef signed128 signed_16;
123 typedef unsigned8 unsigned_1;
124 typedef unsigned16 unsigned_2;
125 typedef unsigned32 unsigned_4;
126 typedef unsigned64 unsigned_8;
127 typedef unsigned128 unsigned_16;
130 /* for general work, the following are defined */
131 /* unsigned: >= 32 bits */
132 /* signed: >= 32 bits */
133 /* long: >= 32 bits, sign undefined */
134 /* int: small indicator */
136 /* target architecture based */
137 #if (WITH_TARGET_WORD_BITSIZE == 64)
138 typedef natural64 natural_word;
139 typedef unsigned64 unsigned_word;
140 typedef signed64 signed_word;
142 #if (WITH_TARGET_WORD_BITSIZE == 32)
143 typedef natural32 natural_word;
144 typedef unsigned32 unsigned_word;
145 typedef signed32 signed_word;
149 /* Other instructions */
150 #if (WITH_TARGET_ADDRESS_BITSIZE == 64)
151 typedef unsigned64 unsigned_address;
152 typedef signed64 signed_address;
154 #if (WITH_TARGET_ADDRESS_BITSIZE == 32)
155 typedef unsigned32 unsigned_address;
156 typedef signed32 signed_address;
158 typedef unsigned_address address_word;
160 /* IEEE 1275 cell size */
161 #if (WITH_TARGET_CELL_BITSIZE == 64)
162 typedef natural64 natural_cell;
163 typedef unsigned64 unsigned_cell;
164 typedef signed64 signed_cell;
166 #if (WITH_TARGET_CELL_BITSIZE == 32)
167 typedef natural32 natural_cell;
168 typedef unsigned32 unsigned_cell;
169 typedef signed32 signed_cell;
172 /* Floating point registers */
173 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
174 typedef unsigned64 fp_word;
176 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
177 typedef unsigned32 fp_word;