machmode.def 9.5 KB

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