public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: "Hurugalawadi, Naveen" <Naveen.Hurugalawadi@caviumnetworks.com>
Subject: Re: Move some flag_unsafe_math_optimizations using simplify and match
Date: Thu, 20 Aug 2015 08:22:00 -0000	[thread overview]
Message-ID: <CAFiYyc1TTP9xixrB3Aw3eGYN+kYue+r3MH1dUQUmuWXRsHtRdw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1508200726580.1547@laptop-mg.saclay.inria.fr>

On Thu, Aug 20, 2015 at 7:38 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Thu, 20 Aug 2015, Hurugalawadi, Naveen wrote:
>
>> The following testcase does not generate "x" as needed.
>> ====================
>> double t (double x)
>> {
>> x = sqrt (x) * sqrt (x);
>> return x;
>> }
>> ====================
>
>
> With -fno-math-errno, we CSE the calls to sqrt, so I would expect this to
> match:
>
>   (mult (SQRT@1 @0) @1)
>
> Without the flag, I expect that one will apply
>
>  (simplify
>   (mult (SQRT:s @0) (SQRT:s @1))
>   (SQRT (mult @0 @1)))
>
> and then maybe we have something converting sqrt(x*x) to abs(x) or maybe
> not.

ICK.  I'd rather have CSE still CSE the two calls by adding some
tricks regarding
to errno ...

> I wonder if all the unsafe math optimizations are really ok without
> -fno-math-errno...

Well, on GIMPLE they will preserve the original calls because of their
side-effects
setting errno...  on GENERIC probably not.

Richard.

> --
> Marc Glisse

  reply	other threads:[~2015-08-20  8:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17  5:29 Hurugalawadi, Naveen
2015-08-18 10:24 ` Richard Biener
2015-08-19  6:47   ` Hurugalawadi, Naveen
2015-08-19 10:06     ` Richard Biener
2015-08-20  5:38       ` Hurugalawadi, Naveen
2015-08-20  6:20         ` Marc Glisse
2015-08-20  8:22           ` Richard Biener [this message]
2015-08-20  9:18             ` Marc Glisse
2015-08-20  8:17         ` Richard Biener
2015-08-20  9:24           ` Hurugalawadi, Naveen
2015-08-20 11:00             ` Richard Biener
2015-08-21  8:51               ` 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=CAFiYyc1TTP9xixrB3Aw3eGYN+kYue+r3MH1dUQUmuWXRsHtRdw@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=Naveen.Hurugalawadi@caviumnetworks.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).