On Mon, Aug 02, 2021 at 02:31:12PM +0800, liuhongt via Gcc-patches wrote:
> * doc/extend.texi (Half-Precision Floating Point): Documemt
> _Float16 for x86.
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -1102,6 +1102,7 @@ typedef _Complex float __attribute__((mode(IC)))
> _Complex_ibm128;
> @section Half-Precision Floating Point
> @cindex half-precision floating point
> @cindex @code{__fp16} data type
> +@cindex @code{__Float16} data type
>
> On ARM and AArch64 targets, GCC supports half-precision (16-bit) floating
> point via the @code{__fp16} type defined in the ARM C Language Extensions.
> @@ -1150,6 +1151,18 @@ calls.
> It is recommended that portable code use the @code{_Float16} type defined
> by ISO/IEC TS 18661-3:2015. @xref{Floating Types}.
>
> +On x86 targets with @code{target("sse2")} and above, GCC supports
> half-precision
> +(16-bit) floating point via the @code{_Float16} type which is defined by
> +18661-3:2015. For C++, x86 provide a builtin type named @code{_Float16}
> +which contains same data format as C.
> +
> +Without @option{-mavx512fp16}, @code{_Float16} type is storage only, all
> +operations will be emulated by software emulation and the @code{float}
> +instructions. The default behavior for @code{FLT_EVAL_METHOD} is to keep
> +the intermediate result of the operation as 32-bit precision. This may lead
> +to inconsistent behavior between software emulation and AVX512-FP16
> +instructions.
> +
> @node Decimal Float
> @section Decimal Floating Types
> @cindex decimal floating types
Shouldn't there be more changes for this in doc/extend.texi?
I'd say that x86 with -msse2 should be mentioned in
The @code{_Float16} type is supported on AArch64
systems by default, and on ARM systems when the IEEE format for 16-bit
floating-point types is selected with @option{-mfp16-format=ieee}.
and in
@node Half-Precision
I'd say that one sentence about the x86 support should go already in the
first paragraph, perhaps after:
On ARM and AArch64 targets, GCC supports half-precision (16-bit) floating
point via the @code{__fp16} type defined in the ARM C Language Extensions.
On ARM systems, you must enable this type explicitly with the
@option{-mfp16-format} command-line option in order to use it.
because users just won't scroll down to immediately find out that in the
10th/11th paragraph it talks about x86.
Just mention there that on all 3 arches it is available using the _Float16 type
in C, on x86 in C++ too and then on ARM/AArch64 using __fp16.
Jakub