[COMMITTED,frange] Avoid testing signed zero test for -fno-signed-zeros.

Message ID 20221112102859.302600-1-aldyh@redhat.com
State Committed
Commit f232715d15618e91c90eb210e23de10909590944
Headers
Series [COMMITTED,frange] Avoid testing signed zero test for -fno-signed-zeros. |

Commit Message

Aldy Hernandez Nov. 12, 2022, 10:28 a.m. UTC
  This patch moves a test that is meant to only work for signed zeros
into range_tests_signed_zeros.

I am not aware of any architectures where this is failing, but it is
annoying to see selftests failing when -fno-signed-zeros is used.

gcc/ChangeLog:

	* value-range.cc (range_tests_signbit): Move to set from here...
	(range_tests_signed_zeros): ...to here.
---
 gcc/value-range.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index d55d85846c1..34fac636cad 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -3928,6 +3928,11 @@  range_tests_signed_zeros ()
   r0.set_nonnegative (float_type_node);
   if (HONOR_NANS (float_type_node))
     ASSERT_TRUE (r0.maybe_isnan ());
+
+  // Numbers containing zero should have an unknown SIGNBIT.
+  r0 = frange_float ("0", "10");
+  r0.clear_nan ();
+  ASSERT_TRUE (r0.signbit_p (signbit) && !signbit);
 }
 
 static void
@@ -3944,10 +3949,6 @@  range_tests_signbit ()
   r0 = frange_float ("1", "10");
   r0.clear_nan ();
   ASSERT_TRUE (r0.signbit_p (signbit) && !signbit);
-  // Numbers containing zero should have an unknown SIGNBIT.
-  r0 = frange_float ("0", "10");
-  r0.clear_nan ();
-  ASSERT_TRUE (r0.signbit_p (signbit) && !signbit);
   // Numbers spanning both positive and negative should have an
   // unknown SIGNBIT.
   r0 = frange_float ("-10", "10");