public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] Drop -0.0 in frange::set() for !HONOR_SIGNED_ZEROS.
@ 2022-10-14 14:26 Aldy Hernandez
  2022-10-14 14:26 ` [COMMITTED] Normalize ranges over the range for both bounds when -ffinite-math-only Aldy Hernandez
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Aldy Hernandez @ 2022-10-14 14:26 UTC (permalink / raw)
  To: GCC patches; +Cc: Andrew MacLeod, Aldy Hernandez

Similar to what we do for NANs when !HONOR_NANS and Inf when
flag_finite_math_only, we can remove -0.0 from the range at creation
time.

We were kinda sorta doing this because there is a bug in
real_isdenormal that is causing flush_denormals_to_zero to saturate
[x, -0.0] to [x, +0.0] when !HONOR_SIGNED_ZEROS.  Fixing this bug
(upcoming), causes us to leave -0.0 in places where we aren't
expecting it (the intersection code).

gcc/ChangeLog:

	* value-range.cc (frange::set): Drop -0.0 for !HONOR_SIGNED_ZEROS.
---
 gcc/value-range.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 26a2b782e2c..86550f158b8 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -324,6 +324,14 @@ frange::set (tree type,
       m_neg_nan = false;
     }
 
+  if (!HONOR_SIGNED_ZEROS (m_type))
+    {
+      if (real_iszero (&m_min, 1))
+	m_min.sign = 0;
+      if (real_iszero (&m_max, 1))
+	m_max.sign = 0;
+    }
+
   // For -ffinite-math-only we can drop ranges outside the
   // representable numbers to min/max for the type.
   if (flag_finite_math_only)
-- 
2.37.3


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-14 15:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14 14:26 [COMMITTED] Drop -0.0 in frange::set() for !HONOR_SIGNED_ZEROS Aldy Hernandez
2022-10-14 14:26 ` [COMMITTED] Normalize ranges over the range for both bounds when -ffinite-math-only Aldy Hernandez
2022-10-14 14:26 ` [COMMITTED] Replace CFN_BUILTIN_SIGNBIT* cases with CASE_FLT_FN Aldy Hernandez
2022-10-14 14:32 ` [COMMITTED] Drop -0.0 in frange::set() for !HONOR_SIGNED_ZEROS Jakub Jelinek
2022-10-14 14:53   ` Aldy Hernandez
2022-10-14 15:00     ` Jakub Jelinek
2022-10-14 15:06       ` Aldy Hernandez

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).