]> 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 00:14:37 +0000 (02:14 +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 3fe18478975dded500b4f77cf08e15e771338e56..825968df32784a77e1d8a095d4e57f1cc44886c6 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 4ccb7e7e2364ac70b4e8fff22acd55136e4352fc..21669f4af8ba8c64fcb08acf887debababee0d5e 100644 (file)
@@ -63,7 +63,7 @@ totalorderl (long double const *x, long double const *y)
 
   unsigned long long extended_sign = -!!xs;
   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 51012b8503d21578c765f12a6776365abaa02fbc..72921d63576af54d9f9a99ce2a29cf7fbc780919 100644 (file)
@@ -1,5 +1,5 @@
 # totalorder.m4
-# serial 2
+# serial 3
 dnl Copyright 2023-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -39,6 +39,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])
 ])
@@ -77,6 +79,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])
 ])
@@ -125,6 +129,7 @@ AC_DEFUN([gl_FUNC_TOTALORDERL],
     fi
     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 d153f4c8ccb85bbd6a803f29f0f73b1792d723a6..46452842af522631ff692b13e5dfeca35ab40047 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: