From: Jakub Jelinek <jakub@redhat.com>
To: Aldy Hernandez <aldyh@redhat.com>, Andrew MacLeod <amacleod@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] range-op-float: Further foperator_{,not_}equal::fold_range fix
Date: Fri, 31 Mar 2023 12:57:33 +0200 [thread overview]
Message-ID: <ZCa8nVSkandaSH2N@tucnak> (raw)
In-Reply-To: <ZCa5thrjuM3EhXO8@tucnak>
On Fri, Mar 31, 2023 at 12:45:10PM +0200, Jakub Jelinek via Gcc-patches wrote:
> - there is a missing case (not handled in this patch) where both operands
> are known to be zeros, but not singleton zeros
This patch adds those cases.
Ok for trunk if it passes bootstrap/regtest?
2023-03-31 Jakub Jelinek <jakub@redhat.com>
* range-op-float.cc (foperator_equal::fold_range): If at least
one of the op ranges is not singleton and neither is NaN and all
4 bounds are zero, return [1, 1].
(foperator_not_equal::fold_range): In the same case return [0, 0].
--- gcc/range-op-float.cc.jj 2023-03-31 11:23:04.817876083 +0200
+++ gcc/range-op-float.cc 2023-03-31 12:51:34.757480162 +0200
@@ -616,6 +616,13 @@ foperator_equal::fold_range (irange &r,
else
r = range_false (type);
}
+ else if (real_iszero (&op1.lower_bound ())
+ && real_iszero (&op1.upper_bound ())
+ && real_iszero (&op2.lower_bound ())
+ && real_iszero (&op2.upper_bound ())
+ && !maybe_isnan (op1, op2))
+ // [-0.0, 0.0] == [-0.0, 0.0] or similar.
+ r = range_true (type);
else
{
// If ranges do not intersect, we know the range is not equal,
@@ -732,6 +739,13 @@ foperator_not_equal::fold_range (irange
else
r = range_true (type);
}
+ else if (real_iszero (&op1.lower_bound ())
+ && real_iszero (&op1.upper_bound ())
+ && real_iszero (&op2.lower_bound ())
+ && real_iszero (&op2.upper_bound ())
+ && !maybe_isnan (op1, op2))
+ // [-0.0, 0.0] != [-0.0, 0.0] or similar.
+ r = range_false (type);
else
{
// If ranges do not intersect, we know the range is not equal,
Jakub
next prev parent reply other threads:[~2023-03-31 10:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-31 7:57 [PATCH] range-op-float, value-range: Fix up handling of UN{LT,LE,GT,GE,EQ}_EXPR and handle comparisons in get_tree_range [PR91645] Jakub Jelinek
2023-03-31 10:45 ` [PATCH] range-op-float: Further comparison fixes Jakub Jelinek
2023-03-31 10:57 ` Jakub Jelinek [this message]
2023-03-31 11:28 ` [PATCH] range-op-float: Further foperator_{,not_}equal::fold_range fix Aldy Hernandez
2023-03-31 11:28 ` [PATCH] range-op-float: Further comparison fixes Aldy Hernandez
2023-04-01 7:39 ` Jakub Jelinek
2023-04-01 18:32 ` Aldy Hernandez
2023-03-31 11:28 ` [PATCH] range-op-float, value-range: Fix up handling of UN{LT,LE,GT,GE,EQ}_EXPR and handle comparisons in get_tree_range [PR91645] Aldy Hernandez
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=ZCa8nVSkandaSH2N@tucnak \
--to=jakub@redhat.com \
--cc=aldyh@redhat.com \
--cc=amacleod@redhat.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).