From: Aldy Hernandez <aldyh@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
GCC patches <gcc-patches@gcc.gnu.org>,
Andrew MacLeod <amacleod@redhat.com>
Subject: Re: [PATCH] [range-ops] Implement sqrt.
Date: Thu, 17 Nov 2022 18:42:25 +0100 [thread overview]
Message-ID: <CAGm3qMUL5=und8U_8hHaycMtTOqeany5T3Mk46eNMFLSQ5aqDw@mail.gmail.com> (raw)
In-Reply-To: <29dcbe58-7400-472f-ef22-d416dc18b8a3@redhat.com>
This may be DCE.
DOM uses ranger through simplify_using_ranges::fold_cond() to fold the
following conditional to false, because we know x_185 is a NAN:
x_185 = __builtin_sqrtf (-1.0e+0);
if (x_185 ord x_185)
I believe we can do that, because there are no user observable
effects. But DCE removes the sqrt which could trap:
Eliminating unnecessary statements:
Deleting : x_185 = __builtin_sqrtf (-1.0e+0);
Is DCE allowed to remove that sqrtf call?
Thanks.
Aldy
On Thu, Nov 17, 2022 at 5:48 PM Aldy Hernandez <aldyh@redhat.com> wrote:
>
>
>
> On 11/17/22 17:40, Aldy Hernandez wrote:
> > To go along with whatever magic we're gonna tack along to the
> > range-ops sqrt implementation, here is another revision addressing the
> > VARYING issue you pointed out.
> >
> > A few things...
> >
> > Instead of going through trees, I decided to call do_mpfr_arg1
> > directly. Let's not go the wide int <-> tree rat hole in this one.
> >
> > The function do_mpfr_arg1 bails on +INF, so I had to handle it manually.
> >
> > There's a regression in gfortran.dg/ieee/ieee_6.f90, which I'm not
> > sure how to handle. We are failing because we are calculating
> > sqrt(-1) and expecting certain IEEE flags set. These flags aren't
> > set, presumably because we folded sqrt(-1) into a NAN directly:
> >
> > // All negatives.
> > if (real_compare (LT_EXPR, &lh_ub, &dconst0))
> > {
> > real_nan (&lb, "", 0, TYPE_MODE (type));
> > ub = lb;
> > maybe_nan = true;
> > return;
> > }
>
> FWIW, we could return [-0.0, +INF] +-NAN which would keep us from
> eliding the sqrt, but it'd be a pity to keep the sqrt unless it's
> mandated by some IEEE canon.
>
> Aldy
next prev parent reply other threads:[~2022-11-17 17:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-13 20:05 Aldy Hernandez
2022-11-13 20:39 ` Jakub Jelinek
2022-11-14 7:45 ` Aldy Hernandez
2022-11-14 14:30 ` Jeff Law
2022-11-14 14:35 ` Jakub Jelinek
2022-11-14 14:48 ` Jeff Law
2022-11-14 15:01 ` Aldy Hernandez
2022-11-14 21:55 ` Joseph Myers
2022-11-16 20:32 ` Jakub Jelinek
2022-11-17 16:40 ` Aldy Hernandez
2022-11-17 16:48 ` Aldy Hernandez
2022-11-17 17:42 ` Aldy Hernandez [this message]
2022-11-17 18:59 ` Joseph Myers
2022-11-17 19:37 ` Jakub Jelinek
2022-11-17 20:43 ` Joseph Myers
2022-11-18 8:39 ` Richard Biener
2022-11-18 10:37 ` Aldy Hernandez
2022-11-18 10:44 ` Jakub Jelinek
2022-11-18 11:20 ` Aldy Hernandez
2022-11-18 11:57 ` Aldy Hernandez
2022-11-18 12:14 ` 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='CAGm3qMUL5=und8U_8hHaycMtTOqeany5T3Mk46eNMFLSQ5aqDw@mail.gmail.com' \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
/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).