]> Savannah Git Hosting - gnulib.git/commitdiff
totalorder*: Support newer MIPS CPUs.
authorBruno Haible <bruno@clisp.org>
Fri, 19 Apr 2024 00:14:37 +0000 (02:14 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 19 Apr 2024 12:54:05 +0000 (14:54 +0200)
* lib/totalorder.c (totalorder): On MIPS CPUs with MIPS_NAN2008_DOUBLE,
don't invert the most significant bit of the mantissa field.
* lib/totalorderf.c (totalorderf): On MIPS CPUs with MIPS_NAN2008_FLOAT,
don't invert the most significant bit of the mantissa field.
* lib/totalorderl.c (totalorderl): On MIPS CPUs with
MIPS_NAN2008_LONG_DOUBLE, don't invert the most significant bit of the
mantissa field.
* m4/totalorder.m4 (gl_FUNC_TOTALORDERF, gl_FUNC_TOTALORDER,
gl_FUNC_TOTALORDERL): Invoke gl_NAN_MIPS.
* modules/totalorder (Files): Add m4/nan-mips.m4.
* modules/totalorderf (Files): Likewise.
* modules/totalorderl (Files): Likewise.

ChangeLog
lib/totalorder.c
lib/totalorderf.c
lib/totalorderl.c
m4/totalorder.m4
modules/totalorder
modules/totalorderf
modules/totalorderl

index 740a170c432ed206a0b1deae717587853a74211c..86f04d2fe69023a638a3de0e881019ba089bdabd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-04-18  Bruno Haible  <bruno@clisp.org>
+
+       totalorder*: Support newer MIPS CPUs.
+       * lib/totalorder.c (totalorder): On MIPS CPUs with MIPS_NAN2008_DOUBLE,
+       don't invert the most significant bit of the mantissa field.
+       * lib/totalorderf.c (totalorderf): On MIPS CPUs with MIPS_NAN2008_FLOAT,
+       don't invert the most significant bit of the mantissa field.
+       * lib/totalorderl.c (totalorderl): On MIPS CPUs with
+       MIPS_NAN2008_LONG_DOUBLE, don't invert the most significant bit of the
+       mantissa field.
+       * m4/totalorder.m4 (gl_FUNC_TOTALORDERF, gl_FUNC_TOTALORDER,
+       gl_FUNC_TOTALORDERL): Invoke gl_NAN_MIPS.
+       * modules/totalorder (Files): Add m4/nan-mips.m4.
+       * modules/totalorderf (Files): Likewise.
+       * modules/totalorderl (Files): Likewise.
+
 2024-04-18  Bruno Haible  <bruno@clisp.org>
 
        snan: Add support for m68k.
index 445b8f84d6b26bef6ad8eb2aadcf7fda143e0e2b..6d1b2c44443ac8a92743bbab23b4029c1a854248 100644 (file)
@@ -48,7 +48,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__ || defined __sh__
+#if defined __hppa || (defined __mips__ && !MIPS_NAN2008_DOUBLE) || defined __sh__
   /* Invert the most significant bit of the mantissa field.  Cf. snan.h.  */
   extended_sign ^= (1ULL << 51);
 #endif
index 70bc02cd90e68967dcd2ffd5889b21fee391df16..f8af4b0241cfb9ed22becaae5d96297c20585a32 100644 (file)
@@ -48,7 +48,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__ || defined __sh__
+#if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__
   /* Invert the most significant bit of the mantissa field.  Cf. snan.h.  */
   extended_sign ^= (1U << 22);
 #endif
index 1532a84c10b43e88925d260c6761d4b0de0ee7b4..a94169b760cf1bd62a42af9539a66ad6fef77a22 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__ || defined __sh__
+#if defined __hppa || (defined __mips__ && !MIPS_NAN2008_DOUBLE) || 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__ || defined __sh__
+#if defined __hppa || (defined __mips__ && !MIPS_NAN2008_LONG_DOUBLE) || defined __sh__
   /* Invert the most significant bit of the mantissa field.  Cf. snan.h.  */
   extended_sign_hi ^=
     (1ULL << (LDBL_MANT_DIG == 106
index 6be25cb312f6b400207d82ad3a3b067ab6541ad8..49c45d539461cb1e63b8fae1d6dea9344df27a34 100644 (file)
@@ -38,6 +38,8 @@ AC_DEFUN([gl_FUNC_TOTALORDERF],
   fi
   if test $HAVE_TOTALORDERF = 0 || test $REPLACE_TOTALORDERF = 1; then
     TOTALORDERF_LIBM='$(ISNANF_LIBM)'
+    dnl Prerequisite of lib/totalorderf.c.
+    gl_NAN_MIPS
   fi
   AC_SUBST([TOTALORDERF_LIBM])
 ])
@@ -76,6 +78,8 @@ AC_DEFUN([gl_FUNC_TOTALORDER],
   fi
   if test $HAVE_TOTALORDER = 0 || test $REPLACE_TOTALORDER = 1; then
     TOTALORDER_LIBM='$(ISNAND_LIBM)'
+    dnl Prerequisite of lib/totalorder.c.
+    gl_NAN_MIPS
   fi
   AC_SUBST([TOTALORDER_LIBM])
 ])
@@ -117,6 +121,7 @@ AC_DEFUN([gl_FUNC_TOTALORDERL],
     TOTALORDERL_LIBM='$(ISNANL_LIBM)'
     dnl Prerequisite of lib/totalorderl.c.
     gl_LONG_DOUBLE_SIGN_LOCATION
+    gl_NAN_MIPS
   fi
   AC_SUBST([TOTALORDERL_LIBM])
 ])
index 00f190c42ef78dfa800981d547e97606c4a147f5..d21708e44e742814cc543f8db53e8c7907e1bfe4 100644 (file)
@@ -5,6 +5,7 @@ Files:
 lib/totalorder.c
 m4/mathfunc.m4
 m4/totalorder.m4
+m4/nan-mips.m4
 
 Depends-on:
 math
index ab1569c9ccde4c635cf033886f10f6bbff126f1b..7125c8a57c01638bf9b43c1c3c444da955736b6a 100644 (file)
@@ -5,6 +5,7 @@ Files:
 lib/totalorderf.c
 m4/mathfunc.m4
 m4/totalorder.m4
+m4/nan-mips.m4
 
 Depends-on:
 math
index 76dafb8ecd021b443e0eca6bb16c7c942b58a163..07d9cebabcaa59342bdb66cd180fc7e3f63443db 100644 (file)
@@ -5,6 +5,7 @@ Files:
 lib/totalorderl.c
 m4/mathfunc.m4
 m4/totalorder.m4
+m4/nan-mips.m4
 m4/signbit.m4
 
 Depends-on: