From: Aldy Hernandez <aldyh@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC patches <gcc-patches@gcc.gnu.org>,
Andrew MacLeod <amacleod@redhat.com>,
Andrew Pinski <pinskia@gmail.com>
Subject: Re: [PATCH] Add support for floating point endpoints to frange.
Date: Mon, 29 Aug 2022 16:08:58 +0200 [thread overview]
Message-ID: <CAGm3qMW0WM9sbfturaG7kc03Hj9A9XwOpEX5L7QtyGopJSsbNQ@mail.gmail.com> (raw)
In-Reply-To: <YwzFLYacJF3UOsy4@tucnak>
On Mon, Aug 29, 2022 at 3:55 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote:
> > For convenience, singleton_p() returns false for a NAN. IMO, it makes
> > the implementation cleaner, but I'm not wed to the idea if someone
> > objects.
>
> If singleton_p() is used to decide whether one can just replace a variable
> with singleton range with a constant, then certainly.
> If MODE_HAS_SIGNED_ZEROS, zero has 2 representations (-0.0 and 0.0) and
> NaNs have lots of different representations (the sign bit is ignored
> except for stuff like copysign/signbit, there are qNaNs and sNaNs and
> except for the single case how Inf is represented, all other values of the
> mantissa mean different representations of NaN). So, unless we track which
> exact form of NaN can appear, NaN or any [x, x] range with NaN property
Ok that was more or less what I was thinking. And no, we don't keep
track of the type of NANs.
How does this look?
bool
frange::singleton_p (tree *result) const
{
if (m_kind == VR_RANGE && real_identical (&m_min, &m_max))
{
// If we're honoring signed zeros, fail because we don't know
// which zero we have. This avoids propagating the wrong zero.
if (HONOR_SIGNED_ZEROS (m_type) && zero_p ())
return false;
// Return false for any singleton that may be a NAN.
if (!get_nan ().no_p ())
return false;
if (result)
*result = build_real (m_type, m_min);
return true;
}
return false;
}
Thanks.
Aldy
> set can't be a singleton. There could be programs that propagate something
> important in NaN mantissa and would be upset if frange kills that.
> Of course, one needs to take into account that when a FPU creates NaN, it
> will create the canonical qNaN.
>
> Jakub
>
next prev parent reply other threads:[~2022-08-29 14:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 11:42 Aldy Hernandez
2022-08-26 15:55 ` Aldy Hernandez
2022-08-26 17:40 ` Andrew Pinski
2022-08-26 18:11 ` Aldy Hernandez
2022-08-26 18:11 ` Aldy Hernandez
2022-08-26 19:16 ` Aldy Hernandez
2022-08-26 19:44 ` Andrew Pinski
2022-08-29 13:45 ` Aldy Hernandez
2022-08-29 13:54 ` Jakub Jelinek
2022-08-29 14:07 ` Toon Moene
2022-08-29 14:15 ` Aldy Hernandez
2022-08-29 14:30 ` Toon Moene
2022-08-29 14:36 ` Aldy Hernandez
2022-08-29 14:42 ` Toon Moene
2022-08-30 9:27 ` Aldy Hernandez
2022-08-31 15:22 ` Jeff Law
2022-08-31 15:19 ` Jeff Law
2022-08-29 14:08 ` Aldy Hernandez [this message]
2022-08-29 14:17 ` Jakub Jelinek
2022-08-29 14:20 ` Aldy Hernandez
2022-08-29 14:27 ` Jakub Jelinek
2022-08-29 14:30 ` Aldy Hernandez
2022-08-31 15:24 ` Jeff Law
2022-08-30 22:32 ` Joseph Myers
2022-08-31 15:16 ` Jeff Law
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=CAGm3qMW0WM9sbfturaG7kc03Hj9A9XwOpEX5L7QtyGopJSsbNQ@mail.gmail.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=pinskia@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).