1 /* This file contains the definitions and documentation for the
2 machine modes used in the GNU compiler.
3 Copyright (C) 1987, 1992, 1994, 1997, 1998, 2000, 2003
4 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 /* This file defines all the MACHINE MODES used by GCC.
26 A machine mode specifies a size and format of data
29 Each RTL expression has a machine mode.
31 At the syntax tree level, each ..._TYPE and each ..._DECL node
32 has a machine mode which describes data of that type or the
33 data of the variable declared. */
35 /* This file is included by the genmodes program. Its text is the
36 body of a function. Do not rely on this, it will change in the
39 The following statements can be used in this file -- all have
40 the form of a C macro call. In their arguments:
42 A CLASS argument must be one of the constants defined in
43 mode-classes.def, less the leading MODE_ prefix; some statements
44 that take CLASS arguments have restructions on which classes are
45 acceptable. For instance, INT.
47 A MODE argument must be the printable name of a machine mode,
48 without quotation marks or trailing "mode". For instance, SI.
50 A BITSIZE, BYTESIZE, or COUNT argument must be a positive integer
53 A FORMAT argument must be one of the real_mode_format structures
54 declared in real.h, or else a literal 0.
56 This file defines only those modes which are of use on almost all
57 machines. Other modes can be defined in the target-specific
58 mode definition file, config/ARCH/ARCH-modes.def.
60 Order matters in this file in so far as statements which refer to
61 other modes must appear after the modes they refer to. However,
62 statements which do not refer to other modes may appear in any
66 declares MODE to be of class RANDOM.
69 declares MODE to be of class CC.
71 INT_MODE (MODE, BYTESIZE);
72 declares MODE to be of class INT and BYTESIZE bytes wide.
73 All of the bits of its representation are significant.
75 FRACTIONAL_INT_MODE (MODE, BITSIZE, BYTESIZE);
76 declares MODE to be of class INT, BYTESIZE bytes wide in
77 storage, but with only BITSIZE significant bits.
79 FLOAT_MODE (MODE, BYTESIZE, FORMAT);
80 declares MODE to be of class FLOAT and BYTESIZE bytes wide,
81 using floating point format FORMAT.
82 All of the bits of its representation are significant.
84 FRACTIONAL_FLOAT_MODE (MODE, BITSIZE, BYTESIZE, FORMAT);
85 declares MODE to be of class FLOAT, BYTESIZE bytes wide in
86 storage, but with only BITSIZE significant bits, using
87 floating point format FORMAT.
89 RESET_FLOAT_FORMAT (MODE, FORMAT);
90 changes the format of MODE, which must be class FLOAT,
91 to FORMAT. Use in an ARCH-modes.def to reset the format
92 of one of the float modes defined in this file.
94 PARTIAL_INT_MODE (MODE);
95 declares a mode of class PARTIAL_INT with the same size as
96 MODE (which must be an INT mode). The name of the new mode
97 is made by prefixing a P to the name MODE. This statement
98 may grow a BITSIZE argument in the future.
100 VECTOR_MODE (CLASS, MODE, COUNT);
101 Declare a vector mode whose component mode is MODE (of class
102 CLASS) with COUNT components. CLASS must be INT or FLOAT.
103 The name of the vector mode takes the form VnX where n is
104 COUNT in decimal and X is MODE.
106 VECTOR_MODES (CLASS, WIDTH);
107 For all modes presently declared in class CLASS, construct
108 corresponding vector modes having width WIDTH. Modes whose
109 byte sizes do not evenly divide WIDTH are ignored, as are
110 modes that would produce vector modes with only one component,
111 and modes smaller than one byte (if CLASS is INT) or smaller
112 than two bytes (if CLASS is FLOAT). CLASS must be INT or
113 FLOAT. The names follow the same rule as VECTOR_MODE uses.
115 COMPLEX_MODES (CLASS);
116 For all modes presently declared in class CLASS, construct
117 corresponding complex modes. Modes smaller than one byte
118 are ignored. For FLOAT modes, the names are derived by
119 replacing the 'F' in the mode name with a 'C'. (It is an
120 error if there is no 'F'. For INT modes, the names are
121 derived by prefixing a C to the name.
123 Note: If a mode is ever made which is more than 255 bytes wide,
124 machmode.h and genmodes.c will have to be changed to allocate
125 more space for the mode_size and mode_alignment arrays. */
127 /* VOIDmode is used when no mode needs to be specified,
128 as for example on CONST_INT RTL expressions. */
131 /* BLKmode is used for structures, arrays, etc.
132 that fit no more specific mode. */
135 /* Single bit mode used for booleans. */
136 FRACTIONAL_INT_MODE (BI, 1, 1);
138 /* Basic integer modes. We go up to TI in generic code (128 bits).
139 The name OI is reserved for a 256-bit type (needed by some back ends).
140 FIXME TI shouldn't be generically available either. */
147 /* No partial integer modes are defined by default. */
149 /* Basic floating point modes. SF and DF are the only modes provided
150 by default. The names QF, HF, XF, and TF are reserved for targets
151 that need 1-word, 2-word, 80-bit, or 128-bit float types respectively.
153 These are the IEEE mappings. They can be overridden with
154 RESET_FLOAT_FORMAT or at runtime (in OVERRIDE_OPTIONS). */
156 FLOAT_MODE (SF, 4, ieee_single_format);
157 FLOAT_MODE (DF, 8, ieee_double_format);
160 FIXME define this only for targets that need it. */
163 /* Allow the target to specify additional modes of various kinds. */
165 # include EXTRA_MODES_FILE
170 COMPLEX_MODES (FLOAT);
173 VECTOR_MODES (INT, 2); /* V2QI */
174 VECTOR_MODES (INT, 4); /* V4QI V2HI */
175 VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
176 VECTOR_MODES (INT, 16); /* V16QI V8HI V4SI V2DI */
177 /* VECTOR_MODES (INT, 32); V8SI V4DI */
178 /* VECTOR_MODES (INT, 64); V8DI */
180 VECTOR_MODE (INT, SI, 8)
181 VECTOR_MODE (INT, DI, 4);
182 VECTOR_MODE (INT, DI, 8);
184 /* PPC uses this to distinguish between DImode passed in
185 float registers and DImode passed in vector registers.
186 It would be in rs6000-modes.def but it's referenced in
187 c-common.c. FIXME. */
189 VECTOR_MODE (INT, DI, 1);
191 VECTOR_MODES (FLOAT, 4); /* V2HF */
192 VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */
193 VECTOR_MODES (FLOAT, 16); /* V8HF V4SF V2DF */
194 /* VECTOR_MODES (FLOAT, 32); V8SF V4DF */
195 /* VECTOR_MODES (FLOAT, 64); V16SF V8DF */
197 VECTOR_MODE (FLOAT, SF, 8);
198 VECTOR_MODE (FLOAT, SF, 16);
199 VECTOR_MODE (FLOAT, DF, 4);
200 VECTOR_MODE (FLOAT, DF, 8);
202 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
203 The tm.h file specifies which one. It is not a distinct mode. */