]>
Commit | Line | Data |
---|---|---|
34af06d1 | 1 | /* This file contains the definitions and documentation for the |
3398e91d | 2 | machine modes used in the GNU compiler. |
8e8f6434 | 3 | Copyright (C) 1987-2018 Free Software Foundation, Inc. |
34af06d1 | 4 | |
f12b58b3 | 5 | This file is part of GCC. |
34af06d1 | 6 | |
f12b58b3 | 7 | GCC is free software; you can redistribute it and/or modify it under |
8 | the terms of the GNU General Public License as published by the Free | |
8c4c00c1 | 9 | Software Foundation; either version 3, or (at your option) any later |
f12b58b3 | 10 | version. |
34af06d1 | 11 | |
f12b58b3 | 12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
34af06d1 | 16 | |
17 | You should have received a copy of the GNU General Public License | |
8c4c00c1 | 18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
34af06d1 | 20 | |
21 | ||
f12b58b3 | 22 | /* This file defines all the MACHINE MODES used by GCC. |
34af06d1 | 23 | |
24 | A machine mode specifies a size and format of data | |
25 | at the machine level. | |
26 | ||
27 | Each RTL expression has a machine mode. | |
28 | ||
29 | At the syntax tree level, each ..._TYPE and each ..._DECL node | |
30 | has a machine mode which describes data of that type or the | |
31 | data of the variable declared. */ | |
32 | ||
47a2c1d4 | 33 | /* This file is included by the genmodes program. Its text is the |
34 | body of a function. Do not rely on this, it will change in the | |
35 | future. | |
36 | ||
37 | The following statements can be used in this file -- all have | |
38 | the form of a C macro call. In their arguments: | |
39 | ||
40 | A CLASS argument must be one of the constants defined in | |
41 | mode-classes.def, less the leading MODE_ prefix; some statements | |
06b27565 | 42 | that take CLASS arguments have restrictions on which classes are |
47a2c1d4 | 43 | acceptable. For instance, INT. |
44 | ||
45 | A MODE argument must be the printable name of a machine mode, | |
46 | without quotation marks or trailing "mode". For instance, SI. | |
47 | ||
7c0390e7 | 48 | A PRECISION, BYTESIZE, or COUNT argument must be a positive integer |
47a2c1d4 | 49 | constant. |
50 | ||
15460c97 | 51 | A FORMAT argument must be one of the real_mode_format structures |
f58875bf | 52 | declared in real.h, or else a literal 0. Do not put a leading & |
53 | on the argument. | |
54 | ||
55 | An EXPR argument must be a syntactically valid C expression. | |
56 | If an EXPR contains commas, you may need to write an extra pair of | |
57 | parentheses around it, so it appears to be a single argument to the | |
58 | statement. | |
15460c97 | 59 | |
60 | This file defines only those modes which are of use on almost all | |
61 | machines. Other modes can be defined in the target-specific | |
62 | mode definition file, config/ARCH/ARCH-modes.def. | |
63 | ||
47a2c1d4 | 64 | Order matters in this file in so far as statements which refer to |
65 | other modes must appear after the modes they refer to. However, | |
66 | statements which do not refer to other modes may appear in any | |
67 | order. | |
68 | ||
69 | RANDOM_MODE (MODE); | |
70 | declares MODE to be of class RANDOM. | |
71 | ||
72 | CC_MODE (MODE); | |
73 | declares MODE to be of class CC. | |
74 | ||
75 | INT_MODE (MODE, BYTESIZE); | |
76 | declares MODE to be of class INT and BYTESIZE bytes wide. | |
77 | All of the bits of its representation are significant. | |
78 | ||
7c0390e7 | 79 | FRACTIONAL_INT_MODE (MODE, PRECISION, BYTESIZE); |
47a2c1d4 | 80 | declares MODE to be of class INT, BYTESIZE bytes wide in |
7c0390e7 | 81 | storage, but with only PRECISION significant bits. |
47a2c1d4 | 82 | |
15460c97 | 83 | FLOAT_MODE (MODE, BYTESIZE, FORMAT); |
84 | declares MODE to be of class FLOAT and BYTESIZE bytes wide, | |
85 | using floating point format FORMAT. | |
47a2c1d4 | 86 | All of the bits of its representation are significant. |
87 | ||
7c0390e7 | 88 | FRACTIONAL_FLOAT_MODE (MODE, PRECISION, BYTESIZE, FORMAT); |
47a2c1d4 | 89 | declares MODE to be of class FLOAT, BYTESIZE bytes wide in |
7c0390e7 | 90 | storage, but with only PRECISION significant bits, using |
15460c97 | 91 | floating point format FORMAT. |
92 | ||
7f24e187 | 93 | DECIMAL_FLOAT_MODE (MODE, BYTESIZE, FORMAT); |
94 | declares MODE to be of class DECIMAL_FLOAT and BYTESIZE bytes | |
95 | wide. All of the bits of its representation are significant. | |
96 | ||
97 | FRACTIONAL_DECIMAL_FLOAT_MODE (MODE, BYTESIZE, FORMAT); | |
98 | declares MODE to be of class DECIMAL_FLOAT and BYTESIZE bytes | |
99 | wide. All of the bits of its representation are significant. | |
100 | ||
c559c639 | 101 | FRACT_MODE (MODE, BYTESIZE, FBIT); |
102 | declares MODE to be of class FRACT and BYTESIZE bytes wide | |
103 | with FBIT fractional bits. There may be padding bits. | |
104 | ||
105 | UFRACT_MODE (MODE, BYTESIZE, FBIT); | |
106 | declares MODE to be of class UFRACT and BYTESIZE bytes wide | |
107 | with FBIT fractional bits. There may be padding bits. | |
108 | ||
109 | ACCUM_MODE (MODE, BYTESIZE, IBIT, FBIT); | |
110 | declares MODE to be of class ACCUM and BYTESIZE bytes wide | |
111 | with IBIT integral bits and FBIT fractional bits. | |
112 | There may be padding bits. | |
113 | ||
7f24e187 | 114 | UACCUM_MODE (MODE, BYTESIZE, IBIT, FBIT); |
c559c639 | 115 | declares MODE to be of class UACCUM and BYTESIZE bytes wide |
116 | with IBIT integral bits and FBIT fractional bits. | |
117 | There may be padding bits. | |
118 | ||
15460c97 | 119 | RESET_FLOAT_FORMAT (MODE, FORMAT); |
120 | changes the format of MODE, which must be class FLOAT, | |
121 | to FORMAT. Use in an ARCH-modes.def to reset the format | |
122 | of one of the float modes defined in this file. | |
47a2c1d4 | 123 | |
0d58d930 | 124 | PARTIAL_INT_MODE (MODE, PRECISION, NAME); |
47a2c1d4 | 125 | declares a mode of class PARTIAL_INT with the same size as |
0d58d930 | 126 | MODE (which must be an INT mode) and precision PREC. |
127 | Optionally, NAME is the new name of the mode. NAME is the | |
128 | name of the mode. | |
47a2c1d4 | 129 | |
130 | VECTOR_MODE (CLASS, MODE, COUNT); | |
131 | Declare a vector mode whose component mode is MODE (of class | |
132 | CLASS) with COUNT components. CLASS must be INT or FLOAT. | |
133 | The name of the vector mode takes the form VnX where n is | |
134 | COUNT in decimal and X is MODE. | |
135 | ||
136 | VECTOR_MODES (CLASS, WIDTH); | |
137 | For all modes presently declared in class CLASS, construct | |
138 | corresponding vector modes having width WIDTH. Modes whose | |
139 | byte sizes do not evenly divide WIDTH are ignored, as are | |
140 | modes that would produce vector modes with only one component, | |
141 | and modes smaller than one byte (if CLASS is INT) or smaller | |
142 | than two bytes (if CLASS is FLOAT). CLASS must be INT or | |
143 | FLOAT. The names follow the same rule as VECTOR_MODE uses. | |
144 | ||
486626ef | 145 | VECTOR_MODES_WITH_PREFIX (PREFIX, CLASS, WIDTH); |
146 | Like VECTOR_MODES, but start the mode names with PREFIX instead | |
147 | of the usual "V". | |
148 | ||
8464736b | 149 | VECTOR_BOOL_MODE (NAME, COUNT, BYTESIZE) |
150 | Create a vector mode called NAME that contains COUNT boolean | |
151 | elements and occupies BYTESIZE bytes in total. Each boolean | |
152 | element occupies (COUNT * BITS_PER_UNIT) / BYTESIZE bits, with | |
153 | the element at index 0 occupying the lsb of the first byte in | |
154 | memory. Only the lowest bit of each element is significant. | |
155 | ||
47a2c1d4 | 156 | COMPLEX_MODES (CLASS); |
157 | For all modes presently declared in class CLASS, construct | |
158 | corresponding complex modes. Modes smaller than one byte | |
159 | are ignored. For FLOAT modes, the names are derived by | |
160 | replacing the 'F' in the mode name with a 'C'. (It is an | |
161 | error if there is no 'F'. For INT modes, the names are | |
162 | derived by prefixing a C to the name. | |
163 | ||
f58875bf | 164 | ADJUST_BYTESIZE (MODE, EXPR); |
165 | ADJUST_ALIGNMENT (MODE, EXPR); | |
166 | ADJUST_FLOAT_FORMAT (MODE, EXPR); | |
c559c639 | 167 | ADJUST_IBIT (MODE, EXPR); |
168 | ADJUST_FBIT (MODE, EXPR); | |
169 | Arrange for the byte size, alignment, floating point format, ibit, | |
170 | or fbit of MODE to be adjustable at run time. EXPR will be executed | |
f58875bf | 171 | once after processing all command line options, and should |
c559c639 | 172 | evaluate to the desired byte size, alignment, format, ibit or fbit. |
f58875bf | 173 | |
174 | Unlike a FORMAT argument, if you are adjusting a float format | |
175 | you must put an & in front of the name of each format structure. | |
176 | ||
b75c5ec0 | 177 | ADJUST_NUNITS (MODE, EXPR); |
178 | Like the above, but set the number of nunits of MODE to EXPR. | |
179 | This changes the size and precision of the mode in proportion | |
180 | to the change in the number of units; for example, doubling | |
181 | the number of units doubles the size and precision as well. | |
182 | ||
47a2c1d4 | 183 | Note: If a mode is ever made which is more than 255 bytes wide, |
184 | machmode.h and genmodes.c will have to be changed to allocate | |
185 | more space for the mode_size and mode_alignment arrays. */ | |
34af06d1 | 186 | |
187 | /* VOIDmode is used when no mode needs to be specified, | |
188 | as for example on CONST_INT RTL expressions. */ | |
47a2c1d4 | 189 | RANDOM_MODE (VOID); |
190 | ||
191 | /* BLKmode is used for structures, arrays, etc. | |
192 | that fit no more specific mode. */ | |
193 | RANDOM_MODE (BLK); | |
194 | ||
195 | /* Single bit mode used for booleans. */ | |
196 | FRACTIONAL_INT_MODE (BI, 1, 1); | |
3573fd04 | 197 | |
15460c97 | 198 | /* Basic integer modes. We go up to TI in generic code (128 bits). |
f9cb58ae | 199 | TImode is needed here because the some front ends now genericly |
200 | support __int128. If the front ends decide to generically support | |
201 | larger types, then corresponding modes must be added here. The | |
202 | name OI is reserved for a 256-bit type (needed by some back ends). | |
203 | */ | |
47a2c1d4 | 204 | INT_MODE (QI, 1); |
205 | INT_MODE (HI, 2); | |
206 | INT_MODE (SI, 4); | |
207 | INT_MODE (DI, 8); | |
208 | INT_MODE (TI, 16); | |
15460c97 | 209 | |
210 | /* No partial integer modes are defined by default. */ | |
211 | ||
9f75f026 | 212 | /* The target normally defines any target-specific __intN types and |
213 | their modes, but __int128 for TImode is fairly common so define it | |
214 | here. The type will not be created unless the target supports | |
215 | TImode. */ | |
216 | ||
217 | INT_N (TI, 128); | |
218 | ||
15460c97 | 219 | /* Basic floating point modes. SF and DF are the only modes provided |
220 | by default. The names QF, HF, XF, and TF are reserved for targets | |
221 | that need 1-word, 2-word, 80-bit, or 128-bit float types respectively. | |
222 | ||
223 | These are the IEEE mappings. They can be overridden with | |
4c834714 | 224 | RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE). */ |
15460c97 | 225 | |
226 | FLOAT_MODE (SF, 4, ieee_single_format); | |
227 | FLOAT_MODE (DF, 8, ieee_double_format); | |
228 | ||
229 | /* Basic CC modes. | |
230 | FIXME define this only for targets that need it. */ | |
47a2c1d4 | 231 | CC_MODE (CC); |
232 | ||
c559c639 | 233 | /* Fixed-point modes. */ |
234 | FRACT_MODE (QQ, 1, 7); /* s.7 */ | |
235 | FRACT_MODE (HQ, 2, 15); /* s.15 */ | |
236 | FRACT_MODE (SQ, 4, 31); /* s.31 */ | |
237 | FRACT_MODE (DQ, 8, 63); /* s.63 */ | |
238 | FRACT_MODE (TQ, 16, 127); /* s.127 */ | |
239 | ||
240 | UFRACT_MODE (UQQ, 1, 8); /* .8 */ | |
241 | UFRACT_MODE (UHQ, 2, 16); /* .16 */ | |
242 | UFRACT_MODE (USQ, 4, 32); /* .32 */ | |
243 | UFRACT_MODE (UDQ, 8, 64); /* .64 */ | |
244 | UFRACT_MODE (UTQ, 16, 128); /* .128 */ | |
245 | ||
246 | ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */ | |
247 | ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */ | |
248 | ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */ | |
249 | ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */ | |
250 | ||
251 | UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */ | |
252 | UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */ | |
253 | UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */ | |
254 | UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */ | |
255 | ||
47a2c1d4 | 256 | /* Allow the target to specify additional modes of various kinds. */ |
257 | #if HAVE_EXTRA_MODES | |
47a2c1d4 | 258 | # include EXTRA_MODES_FILE |
47a2c1d4 | 259 | #endif |
34af06d1 | 260 | |
a4531b55 | 261 | /* Complex modes. */ |
47a2c1d4 | 262 | COMPLEX_MODES (INT); |
dff73565 | 263 | COMPLEX_MODES (PARTIAL_INT); |
47a2c1d4 | 264 | COMPLEX_MODES (FLOAT); |
a4531b55 | 265 | |
3c28f41a | 266 | /* Decimal floating point modes. */ |
267 | DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format); | |
268 | DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format); | |
269 | DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format); | |
270 | ||
34af06d1 | 271 | /* The symbol Pmode stands for one of the above machine modes (usually SImode). |
47a2c1d4 | 272 | The tm.h file specifies which one. It is not a distinct mode. */ |
34af06d1 | 273 | |
274 | /* | |
275 | Local variables: | |
276 | mode:c | |
277 | version-control: t | |
278 | End: | |
279 | */ |