Commit 3ffead77 by James Greenhalgh Committed by James Greenhalgh

[Patch Doc] Update documentation for __fp16 type

gcc/

	* doc/extend.texi (Half-Precision): Update to document current
	compiler behaviour.

From-SVN: r243602
parent 87d5619e
2016-12-13 James Greenhalgh <james.greenhalgh@arm.com> 2016-12-13 James Greenhalgh <james.greenhalgh@arm.com>
* doc/extend.texi (Half-Precision): Update to document current
compiler behaviour.
2016-12-13 James Greenhalgh <james.greenhalgh@arm.com>
* doc/extend.texi (Floating Types): Document availability of * doc/extend.texi (Floating Types): Document availability of
_Float16 on ARM/AArch64. _Float16 on ARM/AArch64.
...@@ -1012,11 +1012,12 @@ that handle conversions if/when long double is changed to be IEEE ...@@ -1012,11 +1012,12 @@ that handle conversions if/when long double is changed to be IEEE
@cindex half-precision floating point @cindex half-precision floating point
@cindex @code{__fp16} data type @cindex @code{__fp16} data type
On ARM targets, GCC supports half-precision (16-bit) floating point via On ARM and AArch64 targets, GCC supports half-precision (16-bit) floating
the @code{__fp16} type. You must enable this type explicitly point via the @code{__fp16} type defined in the ARM C Language Extensions.
with the @option{-mfp16-format} command-line option in order to use it. On ARM systems, you must enable this type explicitly with the
@option{-mfp16-format} command-line option in order to use it.
ARM supports two incompatible representations for half-precision ARM targets support two incompatible representations for half-precision
floating-point values. You must choose one of the representations and floating-point values. You must choose one of the representations and
use it consistently in your program. use it consistently in your program.
...@@ -1031,22 +1032,20 @@ format, but does not support infinities or NaNs. Instead, the range ...@@ -1031,22 +1032,20 @@ format, but does not support infinities or NaNs. Instead, the range
of exponents is extended, so that this format can represent normalized of exponents is extended, so that this format can represent normalized
values in the range of @math{2^{-14}} to 131008. values in the range of @math{2^{-14}} to 131008.
The @code{__fp16} type is a storage format only. For purposes The GCC port for AArch64 only supports the IEEE 754-2008 format, and does
of arithmetic and other operations, @code{__fp16} values in C or C++ not require use of the @option{-mfp16-format} command-line option.
expressions are automatically promoted to @code{float}. In addition,
you cannot declare a function with a return value or parameters
of type @code{__fp16}.
Note that conversions from @code{double} to @code{__fp16} The @code{__fp16} type may only be used as an argument to intrinsics defined
involve an intermediate conversion to @code{float}. Because in @code{<arm_fp16.h>}, or as a storage format. For purposes of
of rounding, this can sometimes produce a different result than a arithmetic and other operations, @code{__fp16} values in C or C++
direct conversion. expressions are automatically promoted to @code{float}.
ARM provides hardware support for conversions between The ARM target provides hardware support for conversions between
@code{__fp16} and @code{float} values @code{__fp16} and @code{float} values
as an extension to VFP and NEON (Advanced SIMD). GCC generates as an extension to VFP and NEON (Advanced SIMD), and from ARMv8 provides
code using these hardware instructions if you compile with hardware support for conversions between @code{__fp16} and @code{double}
options to select an FPU that provides them; values. GCC generates code using these hardware instructions if you
compile with options to select an FPU that provides them;
for example, @option{-mfpu=neon-fp16 -mfloat-abi=softfp}, for example, @option{-mfpu=neon-fp16 -mfloat-abi=softfp},
in addition to the @option{-mfp16-format} option to select in addition to the @option{-mfp16-format} option to select
a half-precision format. a half-precision format.
...@@ -1054,8 +1053,11 @@ a half-precision format. ...@@ -1054,8 +1053,11 @@ a half-precision format.
Language-level support for the @code{__fp16} data type is Language-level support for the @code{__fp16} data type is
independent of whether GCC generates code using hardware floating-point independent of whether GCC generates code using hardware floating-point
instructions. In cases where hardware support is not specified, GCC instructions. In cases where hardware support is not specified, GCC
implements conversions between @code{__fp16} and @code{float} values implements conversions between @code{__fp16} and other types as library
as library calls. calls.
It is recommended that portable code use the @code{_Float16} type defined
by ISO/IEC TS 18661-3:2015 (@xref{Floating Types}).
@node Decimal Float @node Decimal Float
@section Decimal Floating Types @section Decimal Floating Types
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment