This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fenv.h builtins


On Fri, Jun 23, 2017 at 5:12 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Hello,
>
> 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
this case).

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.

Ok.

Thanks,
Richard.

> 2017-06-23  Marc Glisse  <marc.glisse@inria.fr>
>
>         * 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
>         macros.
>         (builtin_structptr_types): Adjust size.
>         * tree.c (builtin_structptr_types): Add four entries.
>
>
> --
> Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]