[PATCH] [frange] Guard sign-zero self test with HONOR_SIGNED_ZEROS [PR126714]

Aldy Hernandez <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
frange_add_zeros's multi-range conversion added a self-test that
assumes signed zeros exist, which is not the case on VAX.  Guard such
test with HONOR_SIGNED_ZEROS.

Pushed.

gcc/ChangeLog:

	PR tree-optimization/126714
	* range-op-float.cc (range_op_float_tests): Guard the signed-zero
	== op1_range self-test with HONOR_SIGNED_ZEROS.
---
 gcc/range-op-float.cc | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 14810bd858e..30d22a98ae5 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -3227,15 +3227,18 @@ range_op_float_tests ()
 
   // op1_range for "op1 == op2" where op2 = [-1.0,-0.0][1.0,1.0] holds -0.0 but
   // not +0.0 must still admit +0.0 for op1, since -0.0 == +0.0.
-  r0 = frange_float ("-1.0", "-0.0");
-  r1 = frange_float ("1.0", "1.0");
-  r0.union_ (r1);
-  r0.clear_nan ();
-  ASSERT_FALSE (r0.contains_p (dconst0));
-  ASSERT_TRUE (r0.contains_p (dconstm0));
-  int_range<2> bool_true = range_true ();
-  range_op_handler (EQ_EXPR).op1_range (r, float_type_node, bool_true, r0);
-  ASSERT_TRUE (r.contains_p (dconst0));
+  if (HONOR_SIGNED_ZEROS (float_type_node))
+    {
+      r0 = frange_float ("-1.0", "-0.0");
+      r1 = frange_float ("1.0", "1.0");
+      r0.union_ (r1);
+      r0.clear_nan ();
+      ASSERT_FALSE (r0.contains_p (dconst0));
+      ASSERT_TRUE (r0.contains_p (dconstm0));
+      int_range<2> bool_true = range_true ();
+      range_op_handler (EQ_EXPR).op1_range (r, float_type_node, bool_true, r0);
+      ASSERT_TRUE (r.contains_p (dconst0));
+    }
 
   // negate([1, 2] U [10, 11]) => [-11, -10] U [-2, -1], keeping the gap.
   r0 = frange_float ("1.0", "2.0");
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.