public inbox for
 help / color / mirror / Atom feed
From: Marc Glisse <>
To: Richard Biener <>
Cc: GCC Patches <>
Subject: Re: builtin fenv functions
Date: Fri, 26 May 2017 10:49:00 -0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, 26 May 2017, Richard Biener wrote:

> On Fri, May 26, 2017 at 11:52 AM, Marc Glisse <> wrote:
>> Hello,
>> coming back to ,
>> Richard wanted a complete set of fenv functions instead of just the 2 I was
>> interested in. However, most functions in fenv.h handle a struch fenv_t or
>> fexcept_t, which makes them inconvenient to handle as builtins.
> We do have stdio functions having FILE * arguments.  There's 'fileptr_type_node'
> (pointer to incomplete struct) to handle that.  I suppose rth was looking for
> sth similar for fenv_t * and fexcept_t *.  I guess it's hard to implement a
> dependency scheme other than "memory" without seeing the full set of
> functions.

I'll see how hard it is to imitate FILE*...

>> Similarly, I
>> don't see div as a builtin in that file, only FILE* has special code, but
>> that doesn't seem worth the trouble here. So I am only declaring the 5
>> "simple" functions, with minimal properties: leaf, nothrow, and for
>> fegetround pure (glibc already declares it that way). We can then discuss
>> the safety of future optimizations on a case by case basis.
> +DEF_C99_BUILTIN        (BUILT_IN_FERAISEEXCEPT, "feraiseexcept",
> I think feraiseexcept shouldn't be nothrow?

glibc marks it as nothrow. I can remove the nothrow flag for now, for 
safety. It may trap, but it does not throw a C++ exception AFAIU.

> But it may be pure?

It writes to the exception register (aka memory for now), so I would 
hardly call it pure.

> Likewise fetestexcept may be pure?

Too unsafe for now, since any FP operation can write to the memory that 
fetestexcept reads.

Marc Glisse

  reply	other threads:[~2017-05-26 10:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 10:27 Marc Glisse
2017-05-26 10:39 ` Richard Biener
2017-05-26 10:49   ` Marc Glisse [this message]
2017-05-26 10:58     ` Richard Biener
2017-05-28 22:26       ` Marc Glisse
2017-05-29  8:46         ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).