https://gcc.gnu.org/g:557e809455a886e8f59f57e5c7b0a940e028d130
commit r15-8683-g557e809455a886e8f59f57e5c7b0a940e028d130 Author: Sandra Loosemore <sloosem...@baylibre.com> Date: Thu Mar 13 03:43:04 2025 +0000 Doc: Add "Additional Numeric Types" sectioning to extend.texi [PR42270] This is part of an incremental effort to make the chapter on GCC extensions better organized by grouping/rearranging sections by topic. gcc/ChangeLog PR other/42270 * doc/extend.texi (Additional Numeric Types): New section. (__int128): Make it a subsection of the above. (Long Long): Likewise. (Complex): Likewise. (Floating Types): Likewise. (Half-Precision): Likewise. (Decimal Float): Likewise. (Fixed-Point): Likewise. Diff: --- gcc/doc/extend.texi | 94 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 41 deletions(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index b919df914648..92ab031fc904 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -31,14 +31,8 @@ extensions, accepted by GCC in C90 mode and in C++. * Constructing Calls:: Dispatching a call to another function. * Typeof:: @code{typeof}: referring to the type of an expression. * Conditionals:: Omitting the middle operand of a @samp{?:} expression. -* __int128:: 128-bit integers---@code{__int128}. -* Long Long:: Double-word integers---@code{long long int}. -* Complex:: Data types for complex numbers. -* Floating Types:: Additional Floating Types. -* Half-Precision:: Half-Precision Floating Point. -* Decimal Float:: Decimal Floating Types. +* Additional Numeric Types:: Additional sizes and formats, plus complex numbers. * Hex Floats:: Hexadecimal floating-point constants. -* Fixed-Point:: Fixed-Point Types. * Named Address Spaces::Named address spaces. * Zero Length:: Zero-length arrays. * Empty Structures:: Structures with no members. @@ -928,8 +922,26 @@ the operand in the middle would perform the side effect twice. Omitting the middle operand uses the value already computed without the undesirable effects of recomputing it. +@node Additional Numeric Types +@section Additional Numeric Types + +GCC supports additional numeric types, including larger integer types, +integer and floating-point complex types, +additional floating-point sizes and formats, decimal floating types, +and fixed-point types. + +@menu +* __int128:: 128-bit integers---@code{__int128}. +* Long Long:: Double-word integers---@code{long long int}. +* Complex:: Data types for complex numbers. +* Floating Types:: Additional Floating Types. +* Half-Precision:: Half-Precision Floating Point. +* Decimal Float:: Decimal Floating Types. +* Fixed-Point:: Fixed-Point Types. +@end menu + @node __int128 -@section 128-bit Integers +@subsection 128-bit Integers @cindex @code{__int128} data types As an extension the integer scalar type @code{__int128} is supported for @@ -940,7 +952,7 @@ support in GCC for expressing an integer constant of type @code{__int128} for targets with @code{long long} integer less than 128 bits wide. @node Long Long -@section Double-Word Integers +@subsection Double-Word Integers @cindex @code{long long} data types @cindex double-word arithmetic @cindex multiprecision arithmetic @@ -972,7 +984,7 @@ Likewise, if the function expects @code{long long int} and you pass @code{int}. The best way to avoid such problems is to use prototypes. @node Complex -@section Complex Numbers +@subsection Complex Numbers @cindex complex numbers @cindex @code{_Complex} keyword @cindex @code{__complex__} keyword @@ -1083,7 +1095,7 @@ infinities, NaNs and negative zeros are involved. @enddefbuiltin @node Floating Types -@section Additional Floating Types +@subsection Additional Floating Types @cindex additional floating types @cindex @code{_Float@var{n}} data types @cindex @code{_Float@var{n}x} data types @@ -1169,7 +1181,7 @@ typedef _Complex float __attribute__((mode(IC))) _Complex_ibm128; @end smallexample @node Half-Precision -@section Half-Precision Floating Point +@subsection Half-Precision Floating Point @cindex half-precision floating point @cindex @code{__fp16} data type @cindex @code{__Float16} data type @@ -1240,7 +1252,7 @@ It is useful for code that does not have @code{_Float16} and runs on the x87 FPU. @node Decimal Float -@section Decimal Floating Types +@subsection Decimal Floating Types @cindex decimal floating types @cindex @code{_Decimal32} data type @cindex @code{_Decimal64} data type @@ -1292,35 +1304,8 @@ the technical report. Types @code{_Decimal32}, @code{_Decimal64}, and @code{_Decimal128} are supported by the DWARF debug information format. -@node Hex Floats -@section Hex Floats -@cindex hex floats - -ISO C99 and ISO C++17 support floating-point numbers written not only in -the usual decimal notation, such as @code{1.55e1}, but also numbers such as -@code{0x1.fp3} written in hexadecimal format. As a GNU extension, GCC -supports this in C90 mode (except in some cases when strictly -conforming) and in C++98, C++11 and C++14 modes. In that format the -@samp{0x} hex introducer and the @samp{p} or @samp{P} exponent field are -mandatory. The exponent is a decimal number that indicates the power of -2 by which the significant part is multiplied. Thus @samp{0x1.f} is -@tex -$1 {15\over16}$, -@end tex -@ifnottex -1 15/16, -@end ifnottex -@samp{p3} multiplies it by 8, and the value of @code{0x1.fp3} -is the same as @code{1.55e1}. - -Unlike for floating-point numbers in the decimal notation the exponent -is always required in the hexadecimal notation. Otherwise the compiler -would not be able to resolve the ambiguity of, e.g., @code{0x1.f}. This -could mean @code{1.0f} or @code{1.9375} since @samp{f} is also the -extension for floating-point constants of type @code{float}. - @node Fixed-Point -@section Fixed-Point Types +@subsection Fixed-Point Types @cindex fixed-point types @cindex @code{_Fract} data type @cindex @code{_Accum} data type @@ -1466,6 +1451,33 @@ Pragmas to control overflow and rounding behaviors are not implemented. Fixed-point types are supported by the DWARF debug information format. +@node Hex Floats +@section Hex Floats +@cindex hex floats + +ISO C99 and ISO C++17 support floating-point numbers written not only in +the usual decimal notation, such as @code{1.55e1}, but also numbers such as +@code{0x1.fp3} written in hexadecimal format. As a GNU extension, GCC +supports this in C90 mode (except in some cases when strictly +conforming) and in C++98, C++11 and C++14 modes. In that format the +@samp{0x} hex introducer and the @samp{p} or @samp{P} exponent field are +mandatory. The exponent is a decimal number that indicates the power of +2 by which the significant part is multiplied. Thus @samp{0x1.f} is +@tex +$1 {15\over16}$, +@end tex +@ifnottex +1 15/16, +@end ifnottex +@samp{p3} multiplies it by 8, and the value of @code{0x1.fp3} +is the same as @code{1.55e1}. + +Unlike for floating-point numbers in the decimal notation the exponent +is always required in the hexadecimal notation. Otherwise the compiler +would not be able to resolve the ambiguity of, e.g., @code{0x1.f}. This +could mean @code{1.0f} or @code{1.9375} since @samp{f} is also the +extension for floating-point constants of type @code{float}. + @node Named Address Spaces @section Named Address Spaces @cindex Named Address Spaces