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