diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-04-01 09:32:20 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-04-01 09:32:20 +0200 |
commit | 69044e11ac52e93622c3d368ae2fd9ef8c3ec015 (patch) | |
tree | 9c8e75621985527097bb25d9accb65258d3fa2a7 /gcc/range-op-float.cc | |
parent | 5fe05ffefd21c4fa6a71e0c570a05d7c0e7e892c (diff) | |
download | gcc-69044e11ac52e93622c3d368ae2fd9ef8c3ec015.zip gcc-69044e11ac52e93622c3d368ae2fd9ef8c3ec015.tar.gz gcc-69044e11ac52e93622c3d368ae2fd9ef8c3ec015.tar.bz2 |
range-op-float: Further foperator_{,not_}equal::fold_range fix
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.
2023-04-01 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].
Diffstat (limited to 'gcc/range-op-float.cc')
-rw-r--r-- | gcc/range-op-float.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 0e0fd92..41d497e 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -616,6 +616,13 @@ foperator_equal::fold_range (irange &r, tree type, 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 &r, tree type, 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, |