This is the mail archive of the
mailing list for the GCC project.
Re: fenv.h builtins
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 26 Jun 2017 12:03:07 +0200
- Subject: Re: fenv.h builtins
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.firstname.lastname@example.org>
On Fri, Jun 23, 2017 at 5:12 PM, Marc Glisse <email@example.com> wrote:
> this is now the complete list of C99 fenv.h functions. I tried to be rather
> conservative, only fegetround is pure, and functions that "raise an
> exception" (in the fenv sense, not the C++ one) do not get nothrow,leaf. We
> can always change that afterwards.
> I am not convinced there is much we will be able to do with those, but at
> least they are available now...
Well, the most obvious thing is to compute (at IPA/LTO WPA analysis) whether
a function accesses the environment or not. Not sure if that somehow helps
optimization ;) Likewise if we can find regions that have guaranteed nearest
rounding mode that would help (IPA-CPing, eventually even cloning for
For anything else we'd need explicit fenv state on each stmt I guess...
> Trying to declare those functions with wrong prototypes now gives the
> expected error.
> Bootstrap + testsuite on powerpc64le-unknown-linux-gnu.
> 2017-06-23 Marc Glisse <firstname.lastname@example.org>
> * builtin-types.def (BT_FENV_T_PTR, BT_CONST_FENV_T_PTR,
> BT_FEXCEPT_T_PTR, BT_CONST_FEXCEPT_T_PTR): New primitive types.
> (BT_FN_INT_FENV_T_PTR, BT_FN_INT_CONST_FENV_T_PTR,
> BT_FN_INT_FEXCEPT_T_PTR_INT, BT_FN_INT_CONST_FEXCEPT_T_PTR_INT):
> New function types.
> * builtins.def (BUILT_IN_FECLEAREXCEPT, BUILT_IN_FEGETENV,
> BUILT_IN_FEGETEXCEPTFLAG, BUILT_IN_FEGETROUND,
> BUILT_IN_FEHOLDEXCEPT, BUILT_IN_FERAISEEXCEPT,
> BUILT_IN_FESETENV, BUILT_IN_FESETEXCEPTFLAG,
> BUILT_IN_FESETROUND, BUILT_IN_FETESTEXCEPT,
> BUILT_IN_FEUPDATEENV): New builtins.
> * tree-core.h (TI_FENV_T_PTR_TYPE, TI_CONST_FENV_T_PTR_TYPE,
> TI_FEXCEPT_T_PTR_TYPE, TI_CONST_FEXCEPT_T_PTR_TYPE): New entries.
> * tree.h (fenv_t_ptr_type_node, const_fenv_t_ptr_type_node,
> fexcept_t_ptr_type_node, const_fexcept_t_ptr_type_node): New
> (builtin_structptr_types): Adjust size.
> * tree.c (builtin_structptr_types): Add four entries.
> Marc Glisse