]> Savannah Git Hosting - gnulib.git/commitdiff
totalorder*: Fix test failures on SH4.
authorBruno Haible <bruno@clisp.org>
Sat, 14 Oct 2023 19:50:49 +0000 (21:50 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 14 Oct 2023 19:50:49 +0000 (21:50 +0200)
* lib/snan.h: Update comment.
* lib/totalorderf.c (totalorderf): On sh4, invert bit 22 before
comparing two NaNs.
* lib/totalorder.c (totalorder): On sh4, invert bit 51 before comparing
two NaNs.
* lib/totalorderl.c (totalorderl): On sh4, invert bit 51 or 47 of the
xhi, yhi parts before comparing two NaNs.

ChangeLog
lib/snan.h
lib/totalorder.c
lib/totalorderf.c
lib/totalorderl.c

index 60f9cbd63a3629e4cca7cb20f95876d7593260ef..2bb7e48799e7d38f1ded0354250df2db88d5db74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2023-10-14  Bruno Haible  <bruno@clisp.org>
 
+       totalorder*: Fix test failures on SH4.
+       * lib/snan.h: Update comment.
+       * lib/totalorderf.c (totalorderf): On sh4, invert bit 22 before
+       comparing two NaNs.
+       * lib/totalorder.c (totalorder): On sh4, invert bit 51 before comparing
+       two NaNs.
+       * lib/totalorderl.c (totalorderl): On sh4, invert bit 51 or 47 of the
+       xhi, yhi parts before comparing two NaNs.
+
        totalorder*: Fix test failures on PA-RISC and MIPS CPUs.
        * lib/totalorderf.c (totalorderf): On hppa and mips, invert bit 22
        before comparing two NaNs.
index ebf88ab0c533c50c144c3cd4e063b230b71e07d8..abd95318d703d8682378b8193a410f3c8097ac57 100644 (file)
@@ -32,7 +32,7 @@
    This bit is
      *  == 0 to indicate a quiet NaN or Infinity,
         == 1 to indicate a signalling NaN,
-        on these CPUs: hppa, mips.
+        on these CPUs: hppa, mips, sh4.
      *  == 1 to indicate a quiet NaN,
         == 0 to indicate a signalling NaN or Infinity,
         on all other CPUs.
index edbcd6998b2d4fe6469bae3c90f4681fc2a65be9..ee90ebb1f96f03d2ac18a7af75a757bed02fa7d9 100644 (file)
@@ -46,7 +46,7 @@ totalorder (double const *x, double const *y)
   /* At this point, *X and *Y are NaNs with the same sign bit.  */
 
   unsigned long long extended_sign = -!!xs;
-#if defined __hppa || defined __mips__
+#if defined __hppa || defined __mips__ || defined __sh__
   /* Invert the most significant bit of the mantissa field.  Cf. snan.h.  */
   extended_sign ^= (1ULL << 51);
 #endif
index 4cbfa06ffd7275132435b25f44b91b5536f07777..fa2a1245de47ffb7b5cf9d8012c19b018693bb6d 100644 (file)
@@ -46,7 +46,7 @@ totalorderf (float const *x, float const *y)
   /* At this point, *X and *Y are NaNs with the same sign bit.  */
 
   unsigned int extended_sign = -!!xs;
-#if defined __hppa || defined __mips__
+#if defined __hppa || defined __mips__ || defined __sh__
   /* Invert the most significant bit of the mantissa field.  Cf. snan.h.  */
   extended_sign ^= (1U << 22);
 #endif
index 6982762a0f634191eb7ff2a74509f75bedeca3db..a06e70d55f519f56a4576240c879565b65479b18 100644 (file)
@@ -55,7 +55,7 @@ totalorderl (long double const *x, long double const *y)
 
   if (sizeof (long double) <= sizeof (unsigned long long))
     {
-#if defined __hppa || defined __mips__
+#if defined __hppa || defined __mips__ || defined __sh__
       /* Invert the most significant bit of the mantissa field.  Cf. snan.h.  */
       extended_sign ^= (1ULL << 51);
 #endif
@@ -67,7 +67,7 @@ totalorderl (long double const *x, long double const *y)
     }
 
   unsigned long long extended_sign_hi = extended_sign;
-#if defined __hppa || defined __mips__
+#if defined __hppa || defined __mips__ || defined __sh__
   /* Invert the most significant bit of the mantissa field.  Cf. snan.h.  */
   extended_sign_hi ^=
     (1ULL << (LDBL_MANT_DIG == 106