From: Aldy Hernandez <aldyh@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC patches <gcc-patches@gcc.gnu.org>,
Richard Biener <richard.guenther@gmail.com>,
Andrew MacLeod <amacleod@redhat.com>
Subject: Re: [PATCH] Handle > INF and < INF correctly in range-op-float.cc
Date: Tue, 6 Sep 2022 09:40:59 +0200 [thread overview]
Message-ID: <CAGm3qMW=36UTV7473_at7AbmXbqy8J7UdzJP9s=ARVkRBrxcLg@mail.gmail.com> (raw)
In-Reply-To: <Yxb4VcSp1La/sm74@tucnak>
On Tue, Sep 6, 2022 at 9:35 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Tue, Sep 06, 2022 at 09:29:01AM +0200, Aldy Hernandez wrote:
> > The gfortran.dg/minlocval*.f90 tests are generating conditionals past
> > the infinities. For example:
> >
> > if (x <= +Inf)
> > foo (x);
> > else
> > bar (x);
> >
> > It seems to me that the only possible value for x on the false side is
> > either NAN or undefined (for !HONOR_NANS).
>
> No, none of the ==, <, <=, >, >= comparisons are ever true if one
> or both operands are NaN (only != will be true in those cases from the
> standard comparisons, when not counting UNORDERED_EXPR and the likes).
> So, x < -Inf or x > +Inf are always false, we just can't optimize those
> away without -ffast-math because they could raise an exception on sNaN.
> But I think not optimizing such operations away if we care about exceptions
> is the duty of DCE etc.
No, no. I'm not talking about optimizing them away. I'm talking about
representing what is going on in the IL.
For example, for:
if (x > 5.0)
foo (x); // {5.0, +Inf] !NAN
else
bar (x); // [-Inf, 5.0] ?NAN
So on the true side we know x is in the {5.0, +Inf] range, plus we
know it can't be a NAN. On the false side we know x is either [-Inf,
5.0] or a NAN.
What I'm trying to do is represent the possible ranges for the false side of:
if (x <= Inf)
...
Aldy
next prev parent reply other threads:[~2022-09-06 7:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 7:29 Aldy Hernandez
2022-09-06 7:35 ` Jakub Jelinek
2022-09-06 7:40 ` Aldy Hernandez [this message]
2022-09-06 7:44 ` Jakub Jelinek
2022-09-06 7:49 ` Aldy Hernandez
2022-09-06 7:59 ` Jakub Jelinek
2022-09-06 11:47 ` Aldy Hernandez
2022-09-06 12:06 ` Jakub Jelinek
2022-09-06 12:17 ` Richard Biener
2022-09-06 12:32 ` Aldy Hernandez
2022-09-06 12:38 ` Koning, Paul
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='CAGm3qMW=36UTV7473_at7AbmXbqy8J7UdzJP9s=ARVkRBrxcLg@mail.gmail.com' \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=richard.guenther@gmail.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).