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