xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/machmode.def (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg/* This file contains the definitions and documentation for the
21debfc3dSmrg   machine modes used in the GNU compiler.
3*8feb0f0bSmrg   Copyright (C) 1987-2020 Free Software Foundation, Inc.
41debfc3dSmrg
51debfc3dSmrgThis file is part of GCC.
61debfc3dSmrg
71debfc3dSmrgGCC is free software; you can redistribute it and/or modify it under
81debfc3dSmrgthe terms of the GNU General Public License as published by the Free
91debfc3dSmrgSoftware Foundation; either version 3, or (at your option) any later
101debfc3dSmrgversion.
111debfc3dSmrg
121debfc3dSmrgGCC is distributed in the hope that it will be useful, but WITHOUT ANY
131debfc3dSmrgWARRANTY; without even the implied warranty of MERCHANTABILITY or
141debfc3dSmrgFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
151debfc3dSmrgfor more details.
161debfc3dSmrg
171debfc3dSmrgYou should have received a copy of the GNU General Public License
181debfc3dSmrgalong with GCC; see the file COPYING3.  If not see
191debfc3dSmrg<http://www.gnu.org/licenses/>.  */
201debfc3dSmrg
211debfc3dSmrg
221debfc3dSmrg/* This file defines all the MACHINE MODES used by GCC.
231debfc3dSmrg
241debfc3dSmrg   A machine mode specifies a size and format of data
251debfc3dSmrg   at the machine level.
261debfc3dSmrg
271debfc3dSmrg   Each RTL expression has a machine mode.
281debfc3dSmrg
291debfc3dSmrg   At the syntax tree level, each ..._TYPE and each ..._DECL node
301debfc3dSmrg   has a machine mode which describes data of that type or the
311debfc3dSmrg   data of the variable declared.  */
321debfc3dSmrg
331debfc3dSmrg/* This file is included by the genmodes program.  Its text is the
341debfc3dSmrg   body of a function.  Do not rely on this, it will change in the
351debfc3dSmrg   future.
361debfc3dSmrg
371debfc3dSmrg   The following statements can be used in this file -- all have
381debfc3dSmrg   the form of a C macro call.  In their arguments:
391debfc3dSmrg
401debfc3dSmrg   A CLASS argument must be one of the constants defined in
411debfc3dSmrg   mode-classes.def, less the leading MODE_ prefix; some statements
421debfc3dSmrg   that take CLASS arguments have restrictions on which classes are
431debfc3dSmrg   acceptable.  For instance, INT.
441debfc3dSmrg
451debfc3dSmrg   A MODE argument must be the printable name of a machine mode,
461debfc3dSmrg   without quotation marks or trailing "mode".  For instance, SI.
471debfc3dSmrg
481debfc3dSmrg   A PRECISION, BYTESIZE, or COUNT argument must be a positive integer
491debfc3dSmrg   constant.
501debfc3dSmrg
511debfc3dSmrg   A FORMAT argument must be one of the real_mode_format structures
521debfc3dSmrg   declared in real.h, or else a literal 0.  Do not put a leading &
531debfc3dSmrg   on the argument.
541debfc3dSmrg
551debfc3dSmrg   An EXPR argument must be a syntactically valid C expression.
561debfc3dSmrg   If an EXPR contains commas, you may need to write an extra pair of
571debfc3dSmrg   parentheses around it, so it appears to be a single argument to the
581debfc3dSmrg   statement.
591debfc3dSmrg
601debfc3dSmrg   This file defines only those modes which are of use on almost all
611debfc3dSmrg   machines.  Other modes can be defined in the target-specific
621debfc3dSmrg   mode definition file, config/ARCH/ARCH-modes.def.
631debfc3dSmrg
641debfc3dSmrg   Order matters in this file in so far as statements which refer to
651debfc3dSmrg   other modes must appear after the modes they refer to.  However,
661debfc3dSmrg   statements which do not refer to other modes may appear in any
671debfc3dSmrg   order.
681debfc3dSmrg
691debfc3dSmrg     RANDOM_MODE (MODE);
701debfc3dSmrg        declares MODE to be of class RANDOM.
711debfc3dSmrg
721debfc3dSmrg     CC_MODE (MODE);
731debfc3dSmrg        declares MODE to be of class CC.
741debfc3dSmrg
751debfc3dSmrg     INT_MODE (MODE, BYTESIZE);
761debfc3dSmrg        declares MODE to be of class INT and BYTESIZE bytes wide.
771debfc3dSmrg	All of the bits of its representation are significant.
781debfc3dSmrg
791debfc3dSmrg     FRACTIONAL_INT_MODE (MODE, PRECISION, BYTESIZE);
801debfc3dSmrg        declares MODE to be of class INT, BYTESIZE bytes wide in
811debfc3dSmrg	storage, but with only PRECISION significant bits.
821debfc3dSmrg
831debfc3dSmrg     FLOAT_MODE (MODE, BYTESIZE, FORMAT);
841debfc3dSmrg        declares MODE to be of class FLOAT and BYTESIZE bytes wide,
851debfc3dSmrg	using floating point format FORMAT.
861debfc3dSmrg	All of the bits of its representation are significant.
871debfc3dSmrg
881debfc3dSmrg     FRACTIONAL_FLOAT_MODE (MODE, PRECISION, BYTESIZE, FORMAT);
891debfc3dSmrg        declares MODE to be of class FLOAT, BYTESIZE bytes wide in
901debfc3dSmrg	storage, but with only PRECISION significant bits, using
911debfc3dSmrg	floating point format FORMAT.
921debfc3dSmrg
931debfc3dSmrg     DECIMAL_FLOAT_MODE (MODE, BYTESIZE, FORMAT);
941debfc3dSmrg	declares MODE to be of class DECIMAL_FLOAT and BYTESIZE bytes
951debfc3dSmrg	wide.  All of the bits of its representation are significant.
961debfc3dSmrg
971debfc3dSmrg     FRACTIONAL_DECIMAL_FLOAT_MODE (MODE, BYTESIZE, FORMAT);
981debfc3dSmrg	declares MODE to be of class DECIMAL_FLOAT and BYTESIZE bytes
991debfc3dSmrg	wide.  All of the bits of its representation are significant.
1001debfc3dSmrg
1011debfc3dSmrg     FRACT_MODE (MODE, BYTESIZE, FBIT);
1021debfc3dSmrg	declares MODE to be of class FRACT and BYTESIZE bytes wide
1031debfc3dSmrg	with FBIT fractional bits.  There may be padding bits.
1041debfc3dSmrg
1051debfc3dSmrg     UFRACT_MODE (MODE, BYTESIZE, FBIT);
1061debfc3dSmrg	declares MODE to be of class UFRACT and BYTESIZE bytes wide
1071debfc3dSmrg	with FBIT fractional bits.  There may be padding bits.
1081debfc3dSmrg
1091debfc3dSmrg     ACCUM_MODE (MODE, BYTESIZE, IBIT, FBIT);
1101debfc3dSmrg	declares MODE to be of class ACCUM and BYTESIZE bytes wide
1111debfc3dSmrg	with IBIT integral bits and FBIT fractional bits.
1121debfc3dSmrg	There may be padding bits.
1131debfc3dSmrg
1141debfc3dSmrg     UACCUM_MODE (MODE, BYTESIZE, IBIT, FBIT);
1151debfc3dSmrg	declares MODE to be of class UACCUM and BYTESIZE bytes wide
1161debfc3dSmrg	with IBIT integral bits and FBIT fractional bits.
1171debfc3dSmrg	There may be padding bits.
1181debfc3dSmrg
1191debfc3dSmrg     RESET_FLOAT_FORMAT (MODE, FORMAT);
1201debfc3dSmrg	changes the format of MODE, which must be class FLOAT,
1211debfc3dSmrg	to FORMAT.  Use in an ARCH-modes.def to reset the format
1221debfc3dSmrg	of one of the float modes defined in this file.
1231debfc3dSmrg
1241debfc3dSmrg     PARTIAL_INT_MODE (MODE, PRECISION, NAME);
1251debfc3dSmrg        declares a mode of class PARTIAL_INT with the same size as
1261debfc3dSmrg	MODE (which must be an INT mode) and precision PREC.
1271debfc3dSmrg	Optionally, NAME is the new name of the mode.  NAME is the
1281debfc3dSmrg	name of the mode.
1291debfc3dSmrg
1301debfc3dSmrg     VECTOR_MODE (CLASS, MODE, COUNT);
1311debfc3dSmrg        Declare a vector mode whose component mode is MODE (of class
1321debfc3dSmrg	CLASS) with COUNT components.  CLASS must be INT or FLOAT.
1331debfc3dSmrg	The name of the vector mode takes the form VnX where n is
1341debfc3dSmrg	COUNT in decimal and X is MODE.
1351debfc3dSmrg
1361debfc3dSmrg     VECTOR_MODES (CLASS, WIDTH);
1371debfc3dSmrg        For all modes presently declared in class CLASS, construct
1381debfc3dSmrg	corresponding vector modes having width WIDTH.  Modes whose
1391debfc3dSmrg	byte sizes do not evenly divide WIDTH are ignored, as are
1401debfc3dSmrg	modes that would produce vector modes with only one component,
1411debfc3dSmrg	and modes smaller than one byte (if CLASS is INT) or smaller
1421debfc3dSmrg	than two bytes (if CLASS is FLOAT).  CLASS must be INT or
1431debfc3dSmrg	FLOAT.  The names follow the same rule as VECTOR_MODE uses.
1441debfc3dSmrg
145a2dc1f3fSmrg     VECTOR_MODES_WITH_PREFIX (PREFIX, CLASS, WIDTH);
146a2dc1f3fSmrg	Like VECTOR_MODES, but start the mode names with PREFIX instead
147a2dc1f3fSmrg	of the usual "V".
148a2dc1f3fSmrg
149a2dc1f3fSmrg     VECTOR_BOOL_MODE (NAME, COUNT, BYTESIZE)
150a2dc1f3fSmrg        Create a vector mode called NAME that contains COUNT boolean
151a2dc1f3fSmrg        elements and occupies BYTESIZE bytes in total.  Each boolean
152a2dc1f3fSmrg        element occupies (COUNT * BITS_PER_UNIT) / BYTESIZE bits, with
153a2dc1f3fSmrg        the element at index 0 occupying the lsb of the first byte in
154a2dc1f3fSmrg        memory.  Only the lowest bit of each element is significant.
155a2dc1f3fSmrg
1561debfc3dSmrg     COMPLEX_MODES (CLASS);
1571debfc3dSmrg        For all modes presently declared in class CLASS, construct
1581debfc3dSmrg	corresponding complex modes.  Modes smaller than one byte
1591debfc3dSmrg	are ignored.  For FLOAT modes, the names are derived by
1601debfc3dSmrg	replacing the 'F' in the mode name with a 'C'.  (It is an
1611debfc3dSmrg	error if there is no 'F'.  For INT modes, the names are
1621debfc3dSmrg	derived by prefixing a C to the name.
1631debfc3dSmrg
1641debfc3dSmrg     ADJUST_BYTESIZE (MODE, EXPR);
1651debfc3dSmrg     ADJUST_ALIGNMENT (MODE, EXPR);
1661debfc3dSmrg     ADJUST_FLOAT_FORMAT (MODE, EXPR);
1671debfc3dSmrg     ADJUST_IBIT (MODE, EXPR);
1681debfc3dSmrg     ADJUST_FBIT (MODE, EXPR);
1691debfc3dSmrg	Arrange for the byte size, alignment, floating point format, ibit,
1701debfc3dSmrg	or fbit of MODE to be adjustable at run time.  EXPR will be executed
1711debfc3dSmrg	once after processing all command line options, and should
1721debfc3dSmrg	evaluate to the desired byte size, alignment, format, ibit or fbit.
1731debfc3dSmrg
1741debfc3dSmrg	Unlike a FORMAT argument, if you are adjusting a float format
1751debfc3dSmrg	you must put an & in front of the name of each format structure.
1761debfc3dSmrg
177a2dc1f3fSmrg     ADJUST_NUNITS (MODE, EXPR);
178a2dc1f3fSmrg	Like the above, but set the number of nunits of MODE to EXPR.
179a2dc1f3fSmrg	This changes the size and precision of the mode in proportion
180a2dc1f3fSmrg	to the change in the number of units; for example, doubling
181a2dc1f3fSmrg	the number of units doubles the size and precision as well.
182a2dc1f3fSmrg
1831debfc3dSmrg   Note: If a mode is ever made which is more than 255 bytes wide,
1841debfc3dSmrg   machmode.h and genmodes.c will have to be changed to allocate
1851debfc3dSmrg   more space for the mode_size and mode_alignment arrays.  */
1861debfc3dSmrg
1871debfc3dSmrg/* VOIDmode is used when no mode needs to be specified,
1881debfc3dSmrg   as for example on CONST_INT RTL expressions.  */
1891debfc3dSmrgRANDOM_MODE (VOID);
1901debfc3dSmrg
1911debfc3dSmrg/* BLKmode is used for structures, arrays, etc.
1921debfc3dSmrg   that fit no more specific mode.  */
1931debfc3dSmrgRANDOM_MODE (BLK);
1941debfc3dSmrg
1951debfc3dSmrg/* Single bit mode used for booleans.  */
1961debfc3dSmrgFRACTIONAL_INT_MODE (BI, 1, 1);
1971debfc3dSmrg
1981debfc3dSmrg/* Basic integer modes.  We go up to TI in generic code (128 bits).
1991debfc3dSmrg   TImode is needed here because the some front ends now genericly
2001debfc3dSmrg   support __int128.  If the front ends decide to generically support
2011debfc3dSmrg   larger types, then corresponding modes must be added here.  The
2021debfc3dSmrg   name OI is reserved for a 256-bit type (needed by some back ends).
2031debfc3dSmrg    */
2041debfc3dSmrgINT_MODE (QI, 1);
2051debfc3dSmrgINT_MODE (HI, 2);
2061debfc3dSmrgINT_MODE (SI, 4);
2071debfc3dSmrgINT_MODE (DI, 8);
2081debfc3dSmrgINT_MODE (TI, 16);
2091debfc3dSmrg
2101debfc3dSmrg/* No partial integer modes are defined by default.  */
2111debfc3dSmrg
2121debfc3dSmrg/* The target normally defines any target-specific __intN types and
2131debfc3dSmrg   their modes, but __int128 for TImode is fairly common so define it
2141debfc3dSmrg   here.  The type will not be created unless the target supports
2151debfc3dSmrg   TImode.  */
2161debfc3dSmrg
2171debfc3dSmrgINT_N (TI, 128);
2181debfc3dSmrg
2191debfc3dSmrg/* Basic floating point modes.  SF and DF are the only modes provided
2201debfc3dSmrg   by default.  The names QF, HF, XF, and TF are reserved for targets
2211debfc3dSmrg   that need 1-word, 2-word, 80-bit, or 128-bit float types respectively.
2221debfc3dSmrg
2231debfc3dSmrg   These are the IEEE mappings.  They can be overridden with
2241debfc3dSmrg   RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
2251debfc3dSmrg
2261debfc3dSmrgFLOAT_MODE (SF, 4, ieee_single_format);
2271debfc3dSmrgFLOAT_MODE (DF, 8, ieee_double_format);
2281debfc3dSmrg
2291debfc3dSmrg/* Basic CC modes.
2301debfc3dSmrg   FIXME define this only for targets that need it.  */
2311debfc3dSmrgCC_MODE (CC);
2321debfc3dSmrg
2331debfc3dSmrg/* Fixed-point modes.  */
2341debfc3dSmrgFRACT_MODE (QQ, 1, 7); /* s.7 */
2351debfc3dSmrgFRACT_MODE (HQ, 2, 15); /* s.15 */
2361debfc3dSmrgFRACT_MODE (SQ, 4, 31); /* s.31 */
2371debfc3dSmrgFRACT_MODE (DQ, 8, 63); /* s.63 */
2381debfc3dSmrgFRACT_MODE (TQ, 16, 127); /* s.127 */
2391debfc3dSmrg
2401debfc3dSmrgUFRACT_MODE (UQQ, 1, 8); /* .8 */
2411debfc3dSmrgUFRACT_MODE (UHQ, 2, 16); /* .16 */
2421debfc3dSmrgUFRACT_MODE (USQ, 4, 32); /* .32 */
2431debfc3dSmrgUFRACT_MODE (UDQ, 8, 64); /* .64 */
2441debfc3dSmrgUFRACT_MODE (UTQ, 16, 128); /* .128 */
2451debfc3dSmrg
2461debfc3dSmrgACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
2471debfc3dSmrgACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
2481debfc3dSmrgACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
2491debfc3dSmrgACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
2501debfc3dSmrg
2511debfc3dSmrgUACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
2521debfc3dSmrgUACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
2531debfc3dSmrgUACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
2541debfc3dSmrgUACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
2551debfc3dSmrg
2561debfc3dSmrg/* Allow the target to specify additional modes of various kinds.  */
2571debfc3dSmrg#if HAVE_EXTRA_MODES
2581debfc3dSmrg# include EXTRA_MODES_FILE
2591debfc3dSmrg#endif
2601debfc3dSmrg
2611debfc3dSmrg/* Complex modes.  */
2621debfc3dSmrgCOMPLEX_MODES (INT);
2631debfc3dSmrgCOMPLEX_MODES (PARTIAL_INT);
2641debfc3dSmrgCOMPLEX_MODES (FLOAT);
2651debfc3dSmrg
2661debfc3dSmrg/* Decimal floating point modes.  */
2671debfc3dSmrgDECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
2681debfc3dSmrgDECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
2691debfc3dSmrgDECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
2701debfc3dSmrg
2711debfc3dSmrg/* The symbol Pmode stands for one of the above machine modes (usually SImode).
2721debfc3dSmrg   The tm.h file specifies which one.  It is not a distinct mode.  */
2731debfc3dSmrg
2741debfc3dSmrg/*
2751debfc3dSmrgLocal variables:
2761debfc3dSmrgmode:c
2771debfc3dSmrgversion-control: t
2781debfc3dSmrgEnd:
2791debfc3dSmrg*/
280