public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch 0/11] Add support for _Float16 to AArch64
@ 2016-09-30 16:58 James Greenhalgh
  2016-09-30 16:58 ` [Patch 8/11] Make _Float16 available if HFmode is available James Greenhalgh
                   ` (11 more replies)
  0 siblings, 12 replies; 95+ messages in thread
From: James Greenhalgh @ 2016-09-30 16:58 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 7671 bytes --]

Hi,

This patch set enables the _Float16 type specified in ISO/IEC TS 18661-3
for AArch64.

To do this, we first need to update the excess precision logic to support
possibly computing _Float16 values in 16-bit range and precision, and to
set the FLT_EVAL_METHOD macro to "16" as appropriate. That requires some
more expressiveness than we currently get with TARGET_FLT_EVAL_METHOD, so
we first need a new target hook - TARGET_C_EXCESS_PRECISION (patch 1/11),
which we implement in the i386, s390 and m68k back-ends in patches 2-4/11.

However, the meaning of the new value "16" for FLT_EVAL_METHOD is not
specified under C99/C11, and conforming code may have been written assuming
that the only possible values for FLT_EVAL_METHOD were negative values and
{ 0, 1, 2 }. In [patch 5/11] we work around that with a new option -
-fpermitted-flt-eval-methods=[c11|ts-18661-3]. This option will restrict
the compiler to only using the C99/C11 values for FLT_EVAL_METHOD, and is
set to -fpermitted-flt-eval-methods=c11 by default when in a standards
compliant mode like -std=c11.

Patch 6/11 does the work of rewriting the excess precision logic along
the guidelines given in https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00410.html

Patch 7/11 finishes the hookization of TARGET_FLT_EVAL_METHOD by poisoning
the old macro.

Patch 8/11 removes the restriction in targhooks.c:default_floatn_mode that
currently disables HFmode support. This patch is not strictly necessary,
and an alternative route to the same goal would override TARGET_FLOATN_MODE
in AArch64. However, now we've cleaned up the excess precision logic,
I don't believe there is any reason this patch would not be correct.

Patch 9/11 imports the soft-fp changes from
https://sourceware.org/ml/libc-alpha/2016-09/msg00310.html to libgcc.

Patch 10/11 enables these conversion routines for AArch64.

And finally patch 11/11 adds support for the various hooks that the AArch64
back-end requires to turn _Float16 support on.

The patch series as a whole passes a bootstrap and test cycle on x86_64
and AArch64. I've bootstrapped and tested each patch individually on x86_64.
All new tests added and enabled pass as appropriate.

The AArch64 enablement requires
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00268.html

OK?

Thanks,
James

ChangeLogs:

[Patch 1/11] Add a new target hook for describing excess precision intentions

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* target.def (excess_precision): New hook.
	* target.h (flt_eval_method): New.
	(excess_precision_type): Likewise.
	* targhooks.c (default_excess_precision): New.
	* targhooks.h (default_excess_precision): New.
	* doc/tm.texi.in (TARGET_EXCESS_PRECISION): New.
	* doc/tm.texi: Regenerate.

[Patch 2/11] Implement TARGET_C_EXCESS_PRECISION for i386

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/i386/i386.c (ix86_excess_precision): New.
	(TARGET_C_EXCESS_PRECISION): Define.

[Patch 3/11] Implement TARGET_C_EXCESS_PRECISION for s390

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/s390/s390.c (s390_excess_precision): New.
	(TARGET_C_EXCESS_PRECISION): Define.

[Patch 4/11] Implement TARGET_C_EXCESS_PRECISION for m68k

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/m68k/m68k.c (m68k_excess_precision): New.
	(TARGET_C_EXCESS_PRECISION): Define.

[Patch 5/11] Add -fpermitted-flt-eval-methods=[c11|ts-18661-3]

  gcc/c-family/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* c-opts.c (c_common_post_options): Add logic to handle the default
	case for -fpermitted-flt-eval-methods.

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* common.opt (fpermitted-flt-eval-methods): New.
	* doc/invoke.texi (-fpermitted-flt-eval-methods): Document it.
	* flag_types.h (permitted_flt_eval_methods): New.

  gcc/testsuite/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* gcc.dg/fpermitted-flt-eval-methods_1.c: New.
	* gcc.dg/fpermitted-flt-eval-methods_2.c: New.

[Patch 6/11] Migrate excess precision logic to use TARGET_EXCESS_PRECISION

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* toplev.c (init_excess_precision): Delete most logic.
	* tree.c (excess_precision_type): Rewrite to use
	TARGET_EXCESS_PRECISION.
	* doc/invoke.texi (-fexcess-precision): Document behaviour in a
	more generic fashion.

  gcc/c-family/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* c-common.c (excess_precision_mode_join): New.
	(c_ts18661_flt_eval_method): New.
	(c_c11_flt_eval_method): Likewise.
	(c_flt_eval_method): Likewise.
	* c-common.h (excess_precision_mode_join): New.
	(c_flt_eval_method): Likewise.
	* c-cppbuiltin.c (c_cpp_flt_eval_method_iec_559): New.
	(cpp_iec_559_value): Call it.
	(c_cpp_builtins): Modify logic for __LIBGCC_*_EXCESS_PRECISION__,
	call c_flt_eval_method to set __FLT_EVAL_METHOD__ and
	__FLT_EVAL_METHOD_C99__.

[Patch 7/11] Delete TARGET_FLT_EVAL_METHOD and poison it.

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/s390/s390.h (TARGET_FLT_EVAL_METHOD): Delete.
	* config/m68k/m68k.h (TARGET_FLT_EVAL_METHOD): Delete.
	* config/i386/i386.h (TARGET_FLT_EVAL_METHOD): Delete.
	* defaults.h (TARGET_FLT_EVAL_METHOD): Delete.
	* doc/tm.texi.in (TARGET_FLT_EVAL_METHOD): Delete.
	* doc/tm.texi: Regenerate.
	* system.h (TARGET_FLT_EVAL_METHOD): Poison.

[Patch 8/11] Make _Float16 available if HFmode is available

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* targhooks.c (default_floatn_mode): Enable _Float16 if a target
	provides HFmode.

[Patch libgcc 9/11] Update soft-fp from glibc

  libgcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* soft-fp/extendhftf2.c: New.
	* soft-fp/fixhfti.c: Likewise.
	* soft-fp/fixunshfti.c: Likewise.
	* soft-fp/floattihf.c: Likewise.
	* soft-fp/floatuntihf.c: Likewise.
	* soft-fp/half.h: Likewise.
	* soft-fp/trunctfhf2.c: Likewise.

[Patch libgcc AArch64 10/11] Enable hfmode soft-float conversions and truncations

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/aarch64/aarch64-c.c (aarch64_scalar_mode_supported_p): New.
	(TARGET_SCALAR_MODE_SUPPORTED_P): Define.

  libgcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/aarch64/sfp-machine.h (_FP_NANFRAC_H): Define.
	(_FP_NANSIGN_H): Likewise.
	* config/aarch64/t-softfp (softfp_extensions): Add hftf.
	(softfp_truncations): Add tfhf.
	(softfp_extras): Add required conversion functions.

[Patch AArch64 11/11] Enable _Float16

  gcc/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Update
	__FLT_EVAL_METHOD__ and __FLT_EVAL_METHOD_C99__ when we switch
	architecture levels.
	* config/aarch64/aarch64.c (aarch64_promoted_type): Only promote
	the aarch64_fp16_type_node, not all HFmode types.
	(aarch64_libgcc_floating_mode_supported_p): Support HFmode.
	(aarch64_scalar_mode_supported_p): Likewise.
	(aarch64_excess_precision): New.
	(TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Define.
	(TARGET_SCALAR_MODE_SUPPORTED_P): Likewise.
	(TARGET_C_EXCESS_PRECISION): Likewise.

  gcc/testsuite/

  2016-09-30  James Greenhalgh  <james.greenhalgh@arm.com>

	* gcc.target/aarch64/_Float16_1.c: New.
	* gcc.target/aarch64/_Float16_2.c: Likewise.
	* gcc.target/aarch64/_Float16_3.c: Likewise.


^ permalink raw reply	[flat|nested] 95+ messages in thread

end of thread, other threads:[~2016-11-25  8:55 UTC | newest]

Thread overview: 95+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30 16:58 [Patch 0/11] Add support for _Float16 to AArch64 James Greenhalgh
2016-09-30 16:58 ` [Patch 8/11] Make _Float16 available if HFmode is available James Greenhalgh
2016-09-30 17:34   ` Jeff Law
2016-09-30 16:59 ` [Patch 2/11] Implement TARGET_C_EXCESS_PRECISION for i386 James Greenhalgh
2016-10-01 11:55   ` Uros Bizjak
2016-09-30 16:59 ` [Patch 6/11] Migrate excess precision logic to use TARGET_EXCESS_PRECISION James Greenhalgh
2016-09-30 17:34   ` Joseph Myers
2016-10-14 16:56     ` James Greenhalgh
2016-10-28 21:10       ` Joseph Myers
2016-11-02 17:38         ` James Greenhalgh
2016-11-09  2:47           ` Joseph Myers
2016-09-30 16:59 ` [Patch 7/11] Delete TARGET_FLT_EVAL_METHOD and poison it James Greenhalgh
2016-09-30 17:29   ` Jeff Law
2016-09-30 17:01 ` [Patch 1/11] Add a new target hook for describing excess precision intentions James Greenhalgh
2016-10-14 16:50   ` James Greenhalgh
2016-10-28 21:12     ` Joseph Myers
2016-11-02 17:36       ` James Greenhalgh
2016-11-09  2:34         ` Joseph Myers
2016-09-30 17:01 ` [Patch 5/11] Add -fpermitted-flt-eval-methods=[c11|ts-18661-3] James Greenhalgh
2016-09-30 17:40   ` Jeff Law
2016-09-30 22:07     ` Mike Stump
2016-10-05 23:00   ` Joseph Myers
2016-09-30 17:03 ` [Patch 3/11] Implement TARGET_C_EXCESS_PRECISION for s390 James Greenhalgh
2016-09-30 17:41   ` Joseph Myers
2016-09-30 17:54     ` Jeff Law
2016-09-30 18:10       ` Joseph Myers
2016-10-03  8:31         ` James Greenhalgh
2016-10-04 13:40         ` Andreas Krebbel
2016-10-04 13:43           ` Joseph Myers
2016-10-07  8:34             ` Andreas Krebbel
2016-10-07 13:11               ` Joseph Myers
2016-10-12  8:40                 ` Andreas Krebbel
2016-10-12 10:14                   ` Joseph Myers
2016-10-14 16:53               ` James Greenhalgh
2016-10-17 19:30                 ` Andreas Krebbel1
2016-10-19 15:20                   ` Andreas Krebbel
2016-09-30 17:04 ` [Patch libgcc 9/11] Update soft-fp from glibc James Greenhalgh
2016-09-30 17:04 ` [Patch 4/11] Implement TARGET_C_EXCESS_PRECISION for m68k James Greenhalgh
2016-09-30 17:32   ` Jeff Law
2016-09-30 18:25   ` Andreas Schwab
2016-10-14 16:55     ` James Greenhalgh
2016-09-30 17:05 ` [Patch libgcc 9/11] Update soft-fp from glibc James Greenhalgh
2016-09-30 17:04   ` [Patch libgcc AArch64 10/11] Enable hfmode soft-float conversions and truncations James Greenhalgh
2016-09-30 17:14   ` [Patch AArch64 11/11] Enable _Float16 James Greenhalgh
2016-10-14 17:02     ` James Greenhalgh
2016-10-24 13:45 ` [Patch 0/4] [ARM] Enable _Float16 on ARM James Greenhalgh
2016-10-24 13:45   ` [Patch 3/4] Half to double precision conversions James Greenhalgh
2016-10-24 13:45   ` [Patch ARM 4/4] Enable _Float16 James Greenhalgh
2016-10-24 22:29     ` Joseph Myers
2016-11-02 17:43       ` James Greenhalgh
2016-11-02 18:42         ` Joseph Myers
2016-10-24 13:45   ` [Patch 1/4] [libgcc, ARM] Generalise float-to-half conversion function James Greenhalgh
2016-11-08 11:58     ` James Greenhalgh
2016-10-24 13:45   ` [Patch 2/4] [libgcc] Add double to half conversions James Greenhalgh
2016-10-24 22:24     ` Joseph Myers
2016-11-02 17:41       ` [Patch 3/4] Half to double precision conversions James Greenhalgh
2016-11-11 15:38 ` [Patch v4 0/17] Add support for _Float16 to AArch64 and ARM James Greenhalgh
2016-11-11 15:38   ` [Patch 7/17] Delete TARGET_FLT_EVAL_METHOD and poison it James Greenhalgh
2016-11-11 15:38   ` [Patch 3/17] Implement TARGET_C_EXCESS_PRECISION for s390 James Greenhalgh
2016-11-11 15:38   ` [Patch 2/17] Implement TARGET_C_EXCESS_PRECISION for i386 James Greenhalgh
2016-11-11 15:38   ` [Patch 1/17] Add a new target hook for describing excess precision intentions James Greenhalgh
2016-11-11 15:38   ` [Patch 5/17] Add -fpermitted-flt-eval-methods=[c11|ts-18661-3] James Greenhalgh
2016-11-12  4:42     ` Sandra Loosemore
2016-11-14  9:56       ` James Greenhalgh
2016-11-14 23:43         ` Sandra Loosemore
2016-11-11 15:38   ` [Patch 4/17] Implement TARGET_C_EXCESS_PRECISION for m68k James Greenhalgh
2016-11-11 15:38   ` [Patch 6/17] Migrate excess precision logic to use TARGET_EXCESS_PRECISION James Greenhalgh
2016-11-11 15:39   ` [Patch libgcc 9/17] Update soft-fp from glibc James Greenhalgh
2016-11-11 15:39   ` [Patch 8/17] Make _Float16 available if HFmode is available James Greenhalgh
2016-11-11 15:39   ` [Patch testsuite patch 10/17] Add options for floatN when checking effective target for support James Greenhalgh
2016-11-11 15:59     ` Joseph Myers
2016-11-11 15:41   ` [Patch AArch64 11/17] Add floatdihf2 and floatunsdihf2 patterns James Greenhalgh
2016-11-11 15:41     ` [Patch AArch64 13/17] Enable _Float16 for AArch64 James Greenhalgh
2016-11-11 16:33       ` Joseph Myers
2016-11-24  9:47       ` James Greenhalgh
2016-11-24 14:40       ` Richard Earnshaw (lists)
2016-11-11 15:41     ` [Patch libgcc AArch64 12/17] Enable hfmode soft-float conversions and truncations James Greenhalgh
2016-11-24  9:47       ` James Greenhalgh
2016-11-24 13:23       ` Richard Earnshaw (lists)
2016-11-24  9:46     ` Ping^8 Re: [Patch AArch64 11/17] Add floatdihf2 and floatunsdihf2 patterns James Greenhalgh
2016-11-24 13:20     ` Richard Earnshaw (lists)
2016-11-11 15:43   ` [Patch 14/17] [libgcc, ARM] Generalise float-to-half conversion function James Greenhalgh
2016-11-11 15:43     ` [Patch 15/17 libgcc ARM] Add double to half conversions James Greenhalgh
2016-11-16 14:46       ` Kyrill Tkachov
2016-11-11 15:43     ` [Patch ARM 17/17] Enable _Float16 for ARM James Greenhalgh
2016-11-16 14:15       ` Kyrill Tkachov
2016-11-25  8:55         ` Christophe Lyon
2016-11-11 15:43     ` [Patch 16/17 libgcc ARM] Half to double precision conversions James Greenhalgh
2016-11-16 16:00       ` Kyrill Tkachov
2016-11-23 18:20         ` James Greenhalgh
2016-11-16 16:38     ` [Patch 14/17] [libgcc, ARM] Generalise float-to-half conversion function Kyrill Tkachov
2016-11-23 18:18       ` James Greenhalgh
2016-11-18 18:19   ` [Patch v4 0/17] Add support for _Float16 to AArch64 and ARM James Greenhalgh
2016-11-21  9:19     ` Kyrill Tkachov
2016-11-23 17:05       ` James Greenhalgh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).