diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2009-06-18 08:24:10 -0400 |
---|---|---|
committer | Sandra Loosemore <sandra@gcc.gnu.org> | 2009-06-18 08:24:10 -0400 |
commit | 0fd8c3ad1ef97e592cb302d764b9e69f85cb7d6f (patch) | |
tree | c59b4303d74346dd274c9504a6302946ba670574 /gcc/doc | |
parent | 2c2f70e1f266b6582398248096feccaceb2dd70c (diff) | |
download | gcc-0fd8c3ad1ef97e592cb302d764b9e69f85cb7d6f.zip gcc-0fd8c3ad1ef97e592cb302d764b9e69f85cb7d6f.tar.gz gcc-0fd8c3ad1ef97e592cb302d764b9e69f85cb7d6f.tar.bz2 |
extend.texi (Half-Precision): New section.
2009-06-18 Sandra Loosemore <sandra@codesourcery.com>
gcc/
* doc/extend.texi (Half-Precision): New section.
* doc/invoke.texi (Option Summary): List -mfp16-format.
(ARM Options): List neon-fp16 as -mfpu value. Document -mfp16-format.
* config/arm/arm.opt (mfp16-format=): New.
* config/arm/arm.c: Include intl.h.
(TARGET_INVALID_PARAMETER_TYPE): Redefine.
(TARGET_INVALID_RETURN_TYPE): Redefine.
(TARGET_PROMOTED_TYPE): Redefine.
(TARGET_CONVERT_TO_TYPE): Redefine.
(arm_fp16_format): Define.
(all_fpus): Add entry for neon-fp16.
(fp_model_for_fpu): Likewise.
(struct fp16_format): Declare.
(all_fp16_formats): Define.
(arm_init_libfuncs): Add entries for HFmode conversions and arithmetic
functions.
(arm_override_options): Set arm_fp16_format. Call sorry for fp16
and no ldrh.
(arm_legitimate_index_p): Treat HFmode like HImode.
(thumb1_legitimate_address_p): Make it recognize HFmode constants.
(coproc_secondary_reload_class): Special-case HFmode.
(arm_print_operand): Add 'z' specifier for vld1.16/vst1.16.
(arm_hard_regno_mode_ok): Allow HFmode values in VFP registers.
(arm_init_fp16_builtins): New.
(arm_init_builtins): Call it.
(arm_invalid_parameter_type): New.
(arm_invalid_return_type): New.
(arm_promoted_type): New.
(arm_convert_to_type).
(arm_file_start): Deal with neon-fp16 as fpu_name. Emit tag for fp16
format.
(arm_emit_fp16_const): New function.
(arm_mangle_type): Mangle __fp16 as "Dh".
* config/arm/arm.h (TARGET_VFPD32): Make it know about
FPUTYPE_NEON_FP16.
(TARGET_NEON_FP16): New.
(TARGET_NEON): Make it know about FPUTYPE_NEON_FP16.
(enum fputype): Add FPUTYPE_NEON_FP16.
(enum arm_fp16_format_type): Declare.
(arm_fp16_format): Declare.
(LARGEST_EXPONENT_IS_NORMAL): Define.
* config/arm/arm-protos.h (arm_emit_fp16_const): Declare.
* config/arm/arm-modes.def (HFmode): Define.
* config/arm/vfp.md: (*movhf_vfp): New.
(extendhfsf2): New.
(truncsfhf2): New.
* config/arm/arm.md: (fpu): Add neon_fp16.
(floatsihf2, floatdihf2): New.
(fix_trunchfsi2, fix_trunchfdi2): New.
(truncdfhf2): New.
(extendhfdf2): New.
(movhf): New.
(*arm32_movhf): New.
(*thumb1_movhf): New.
(consttable_2): Add check for HFmode constants.
(consttable_4): Handle HFmode constants.
From-SVN: r148654
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 50 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 12 |
2 files changed, 60 insertions, 2 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 6817af5..1cf6e76 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -35,6 +35,7 @@ extensions, accepted by GCC in C89 mode and in C++. * 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. * Hex Floats:: Hexadecimal floating-point constants. * Fixed-Point:: Fixed-Point Types. @@ -921,6 +922,55 @@ Not all targets support additional floating point types. @code{__float80} is supported on i386, x86_64 and ia64 targets and target @code{__float128} is supported on x86_64 and ia64 targets. +@node Half-Precision +@section Half-Precision Floating Point +@cindex half-precision floating point +@cindex @code{__fp16} data type + +On ARM targets, GCC supports half-precision (16-bit) floating point via +the @code{__fp16} type. 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 +floating-point values. You must choose one of the representations and +use it consistently in your program. + +Specifying @option{-mfp16-format=ieee} selects the IEEE 754-2008 format. +This format can represent normalized values in the range of @math{2^{-14}} to 65504. +There are 11 bits of significand precision, approximately 3 +decimal digits. + +Specifying @option{-mfp16-format=alternative} selects the ARM +alternative format. This representation is similar to the IEEE +format, but does not support infinities or NaNs. Instead, the range +of exponents is extended, so that this format can represent normalized +values in the range of @math{2^{-14}} to 131008. + +The @code{__fp16} type is a storage format only. For purposes +of arithmetic and other operations, @code{__fp16} values in C or C++ +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} +involve an intermediate conversion to @code{float}. Because +of rounding, this can sometimes produce a different result than a +direct conversion. + +ARM provides hardware support for conversions between +@code{__fp16} and @code{float} values +as an extension to VFP and NEON (Advanced SIMD). GCC generates +code using the instructions provided by this extension if you compile +with the options @option{-mfpu=neon-fp16 -mfloat-abi=softfp}, +in addition to the @option{-mfp16-format} option to select +a half-precision format. + +Language-level support for the @code{__fp16} data type is +independent of whether GCC generates code using hardware floating-point +instructions. In cases where hardware support is not specified, GCC +implements conversions between @code{__fp16} and @code{float} values +as library calls. + @node Decimal Float @section Decimal Floating Types @cindex decimal floating types diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4d28e9d..2324960 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -443,6 +443,7 @@ Objective-C and Objective-C++ Dialects}. -msched-prolog -mno-sched-prolog @gol -mlittle-endian -mbig-endian -mwords-little-endian @gol -mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol +-mfp16-format=@var{name} -mthumb-interwork -mno-thumb-interwork @gol -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol -mstructure-size-boundary=@var{n} @gol @@ -9301,14 +9302,21 @@ of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, @opindex mfp This specifies what floating point hardware (or hardware emulation) is available on the target. Permissible names are: @samp{fpa}, @samp{fpe2}, -@samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-d16} and -@samp{neon}. @option{-mfp} and @option{-mfpe} +@samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-d16}, +@samp{neon}, and @samp{neon-fp16}. @option{-mfp} and @option{-mfpe} are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility with older versions of GCC@. If @option{-msoft-float} is specified this specifies the format of floating point values. +@item -mfp16-format=@var{name} +@opindex mfp16-format +Specify the format of the @code{__fp16} half-precision floating-point type. +Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; +the default is @samp{none}, in which case the @code{__fp16} type is not +defined. @xref{Half-Precision}, for more information. + @item -mstructure-size-boundary=@var{n} @opindex mstructure-size-boundary The size of all structures and unions will be rounded up to a multiple |