118334Speter/* This file contains the definitions and documentation for the 250397Sobrien machine modes used in the GNU compiler. 3169689Skan Copyright (C) 1987, 1992, 1994, 1997, 1998, 2000, 2003, 2004, 2005 4132718Skan Free Software Foundation, Inc. 518334Speter 690075SobrienThis file is part of GCC. 718334Speter 890075SobrienGCC is free software; you can redistribute it and/or modify it under 990075Sobrienthe terms of the GNU General Public License as published by the Free 1090075SobrienSoftware Foundation; either version 2, or (at your option) any later 1190075Sobrienversion. 1218334Speter 1390075SobrienGCC is distributed in the hope that it will be useful, but WITHOUT ANY 1490075SobrienWARRANTY; without even the implied warranty of MERCHANTABILITY or 1590075SobrienFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1690075Sobrienfor more details. 1718334Speter 1818334SpeterYou should have received a copy of the GNU General Public License 1990075Sobrienalong with GCC; see the file COPYING. If not, write to the Free 20169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 21169689Skan02110-1301, USA. */ 2218334Speter 2318334Speter 2490075Sobrien/* This file defines all the MACHINE MODES used by GCC. 2518334Speter 2618334Speter A machine mode specifies a size and format of data 2718334Speter at the machine level. 2818334Speter 2918334Speter Each RTL expression has a machine mode. 3018334Speter 3118334Speter At the syntax tree level, each ..._TYPE and each ..._DECL node 3218334Speter has a machine mode which describes data of that type or the 3318334Speter data of the variable declared. */ 3418334Speter 35132718Skan/* This file is included by the genmodes program. Its text is the 36132718Skan body of a function. Do not rely on this, it will change in the 37132718Skan future. 3818334Speter 39132718Skan The following statements can be used in this file -- all have 40132718Skan the form of a C macro call. In their arguments: 4118334Speter 42132718Skan A CLASS argument must be one of the constants defined in 43132718Skan mode-classes.def, less the leading MODE_ prefix; some statements 44169689Skan that take CLASS arguments have restrictions on which classes are 45132718Skan acceptable. For instance, INT. 4618334Speter 47132718Skan A MODE argument must be the printable name of a machine mode, 48132718Skan without quotation marks or trailing "mode". For instance, SI. 4990075Sobrien 50132718Skan A PRECISION, BYTESIZE, or COUNT argument must be a positive integer 51132718Skan constant. 5218334Speter 53132718Skan A FORMAT argument must be one of the real_mode_format structures 54132718Skan declared in real.h, or else a literal 0. Do not put a leading & 55132718Skan on the argument. 5618334Speter 57132718Skan An EXPR argument must be a syntactically valid C expression. 58132718Skan If an EXPR contains commas, you may need to write an extra pair of 59132718Skan parentheses around it, so it appears to be a single argument to the 60132718Skan statement. 6118334Speter 62132718Skan This file defines only those modes which are of use on almost all 63132718Skan machines. Other modes can be defined in the target-specific 64132718Skan mode definition file, config/ARCH/ARCH-modes.def. 6596263Sobrien 66132718Skan Order matters in this file in so far as statements which refer to 67132718Skan other modes must appear after the modes they refer to. However, 68132718Skan statements which do not refer to other modes may appear in any 69132718Skan order. 7018334Speter 71132718Skan RANDOM_MODE (MODE); 72132718Skan declares MODE to be of class RANDOM. 7318334Speter 74132718Skan CC_MODE (MODE); 75132718Skan declares MODE to be of class CC. 7618334Speter 77132718Skan INT_MODE (MODE, BYTESIZE); 78132718Skan declares MODE to be of class INT and BYTESIZE bytes wide. 79132718Skan All of the bits of its representation are significant. 8090075Sobrien 81132718Skan FRACTIONAL_INT_MODE (MODE, PRECISION, BYTESIZE); 82132718Skan declares MODE to be of class INT, BYTESIZE bytes wide in 83132718Skan storage, but with only PRECISION significant bits. 8418334Speter 85132718Skan FLOAT_MODE (MODE, BYTESIZE, FORMAT); 86132718Skan declares MODE to be of class FLOAT and BYTESIZE bytes wide, 87132718Skan using floating point format FORMAT. 88132718Skan All of the bits of its representation are significant. 8918334Speter 90169689Skan DECIMAL FLOAT_MODE (MODE, BYTESIZE); 91169689Skan declares MODE to be of class DECIMAL_FLOAT and BYTESIZE bytes 92169689Skan wide. All of the bits of its representation are significant. 93169689Skan 94132718Skan FRACTIONAL_FLOAT_MODE (MODE, PRECISION, BYTESIZE, FORMAT); 95132718Skan declares MODE to be of class FLOAT, BYTESIZE bytes wide in 96132718Skan storage, but with only PRECISION significant bits, using 97132718Skan floating point format FORMAT. 9890075Sobrien 99132718Skan RESET_FLOAT_FORMAT (MODE, FORMAT); 100132718Skan changes the format of MODE, which must be class FLOAT, 101132718Skan to FORMAT. Use in an ARCH-modes.def to reset the format 102132718Skan of one of the float modes defined in this file. 10390075Sobrien 104132718Skan PARTIAL_INT_MODE (MODE); 105132718Skan declares a mode of class PARTIAL_INT with the same size as 106132718Skan MODE (which must be an INT mode). The name of the new mode 107132718Skan is made by prefixing a P to the name MODE. This statement 108132718Skan may grow a PRECISION argument in the future. 10990075Sobrien 110132718Skan VECTOR_MODE (CLASS, MODE, COUNT); 111132718Skan Declare a vector mode whose component mode is MODE (of class 112132718Skan CLASS) with COUNT components. CLASS must be INT or FLOAT. 113132718Skan The name of the vector mode takes the form VnX where n is 114132718Skan COUNT in decimal and X is MODE. 11590075Sobrien 116132718Skan VECTOR_MODES (CLASS, WIDTH); 117132718Skan For all modes presently declared in class CLASS, construct 118132718Skan corresponding vector modes having width WIDTH. Modes whose 119132718Skan byte sizes do not evenly divide WIDTH are ignored, as are 120132718Skan modes that would produce vector modes with only one component, 121132718Skan and modes smaller than one byte (if CLASS is INT) or smaller 122132718Skan than two bytes (if CLASS is FLOAT). CLASS must be INT or 123132718Skan FLOAT. The names follow the same rule as VECTOR_MODE uses. 12490075Sobrien 125132718Skan COMPLEX_MODES (CLASS); 126132718Skan For all modes presently declared in class CLASS, construct 127132718Skan corresponding complex modes. Modes smaller than one byte 128132718Skan are ignored. For FLOAT modes, the names are derived by 129132718Skan replacing the 'F' in the mode name with a 'C'. (It is an 130132718Skan error if there is no 'F'. For INT modes, the names are 131132718Skan derived by prefixing a C to the name. 13290075Sobrien 133132718Skan ADJUST_BYTESIZE (MODE, EXPR); 134132718Skan ADJUST_ALIGNMENT (MODE, EXPR); 135132718Skan ADJUST_FLOAT_FORMAT (MODE, EXPR); 136132718Skan Arrange for the byte size, alignment, or floating point format 137132718Skan of MODE to be adjustable at run time. EXPR will be executed 138132718Skan once after processing all command line options, and should 139132718Skan evaluate to the desired byte size, alignment, or format. 14090075Sobrien 141132718Skan Unlike a FORMAT argument, if you are adjusting a float format 142132718Skan you must put an & in front of the name of each format structure. 143132718Skan 144132718Skan Note: If a mode is ever made which is more than 255 bytes wide, 145132718Skan machmode.h and genmodes.c will have to be changed to allocate 146132718Skan more space for the mode_size and mode_alignment arrays. */ 147132718Skan 148132718Skan/* VOIDmode is used when no mode needs to be specified, 149132718Skan as for example on CONST_INT RTL expressions. */ 150132718SkanRANDOM_MODE (VOID); 151132718Skan 15218334Speter/* BLKmode is used for structures, arrays, etc. 15318334Speter that fit no more specific mode. */ 154132718SkanRANDOM_MODE (BLK); 15518334Speter 156132718Skan/* Single bit mode used for booleans. */ 157132718SkanFRACTIONAL_INT_MODE (BI, 1, 1); 15818334Speter 159132718Skan/* Basic integer modes. We go up to TI in generic code (128 bits). 160132718Skan The name OI is reserved for a 256-bit type (needed by some back ends). 161132718Skan FIXME TI shouldn't be generically available either. */ 162132718SkanINT_MODE (QI, 1); 163132718SkanINT_MODE (HI, 2); 164132718SkanINT_MODE (SI, 4); 165132718SkanINT_MODE (DI, 8); 166132718SkanINT_MODE (TI, 16); 16718334Speter 168132718Skan/* No partial integer modes are defined by default. */ 169132718Skan 170132718Skan/* Basic floating point modes. SF and DF are the only modes provided 171132718Skan by default. The names QF, HF, XF, and TF are reserved for targets 172132718Skan that need 1-word, 2-word, 80-bit, or 128-bit float types respectively. 173132718Skan 174132718Skan These are the IEEE mappings. They can be overridden with 175132718Skan RESET_FLOAT_FORMAT or at runtime (in OVERRIDE_OPTIONS). */ 176132718Skan 177132718SkanFLOAT_MODE (SF, 4, ieee_single_format); 178132718SkanFLOAT_MODE (DF, 8, ieee_double_format); 179132718Skan 180132718Skan/* Basic CC modes. 181132718Skan FIXME define this only for targets that need it. */ 182132718SkanCC_MODE (CC); 183132718Skan 184132718Skan/* Allow the target to specify additional modes of various kinds. */ 185132718Skan#if HAVE_EXTRA_MODES 186132718Skan# include EXTRA_MODES_FILE 18790075Sobrien#endif 18890075Sobrien 189132718Skan/* Complex modes. */ 190132718SkanCOMPLEX_MODES (INT); 191132718SkanCOMPLEX_MODES (FLOAT); 192132718Skan 193169689Skan/* Decimal floating point modes. */ 194169689SkanDECIMAL_FLOAT_MODE (SD, 4, decimal_single_format); 195169689SkanDECIMAL_FLOAT_MODE (DD, 8, decimal_double_format); 196169689SkanDECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format); 197132718Skan 19818334Speter/* The symbol Pmode stands for one of the above machine modes (usually SImode). 199132718Skan The tm.h file specifies which one. It is not a distinct mode. */ 20018334Speter 20118334Speter/* 20218334SpeterLocal variables: 20318334Spetermode:c 20418334Speterversion-control: t 20518334SpeterEnd: 20618334Speter*/ 207