>From dbc692b76b57f7441261cf702709380349455175 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 19 Apr 2024 02:14:41 +0200 Subject: [PATCH 2/3] setpayload*: Support newer MIPS CPUs. * lib/setpayload.c (setpayload): On MIPS CPUs with MIPS_NAN2008_DOUBLE, accept a zero payload. * lib/setpayloadf.c (setpayloadf): On MIPS CPUs with MIPS_NAN2008_FLOAT, accept a zero payload. * lib/setpayloadl.c (setpayloadl): On MIPS CPUs with MIPS_NAN2008_LONG_DOUBLE, accept a zero payload. * m4/setpayload.m4 (gl_FUNC_SETPAYLOADF, gl_FUNC_SETPAYLOAD, gl_FUNC_SETPAYLOADL): Invoke gl_NAN_MIPS. * modules/setpayload (Files): Add m4/nan-mips.m4. * modules/setpayloadf (Files): Likewise. * modules/setpayloadl (Files): Likewise. --- ChangeLog | 15 +++++++++++++++ lib/setpayload.c | 2 +- lib/setpayloadf.c | 2 +- lib/setpayloadl.c | 2 +- m4/setpayload.m4 | 7 ++++++- modules/setpayload | 1 + modules/setpayloadf | 1 + modules/setpayloadl | 1 + 8 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 825968df32..b3c806d91c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2024-04-18 Bruno Haible + + setpayload*: Support newer MIPS CPUs. + * lib/setpayload.c (setpayload): On MIPS CPUs with MIPS_NAN2008_DOUBLE, + accept a zero payload. + * lib/setpayloadf.c (setpayloadf): On MIPS CPUs with MIPS_NAN2008_FLOAT, + accept a zero payload. + * lib/setpayloadl.c (setpayloadl): On MIPS CPUs with + MIPS_NAN2008_LONG_DOUBLE, accept a zero payload. + * m4/setpayload.m4 (gl_FUNC_SETPAYLOADF, gl_FUNC_SETPAYLOAD, + gl_FUNC_SETPAYLOADL): Invoke gl_NAN_MIPS. + * modules/setpayload (Files): Add m4/nan-mips.m4. + * modules/setpayloadf (Files): Likewise. + * modules/setpayloadl (Files): Likewise. + 2024-04-18 Bruno Haible totalorder*: Support newer MIPS CPUs. diff --git a/lib/setpayload.c b/lib/setpayload.c index fa5c7ad866..d4744ee827 100644 --- a/lib/setpayload.c +++ b/lib/setpayload.c @@ -31,7 +31,7 @@ setpayload (double *result, double payload) { #if DBL_MANT_DIG == 53 if ( -# if defined __hppa || defined __mips__ || defined __sh__ +# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_DOUBLE) || defined __sh__ /* A zero payload is not allowed, because that would denote Infinity. Cf. snan.h. */ payload > 0.0 diff --git a/lib/setpayloadf.c b/lib/setpayloadf.c index 1f02bc4593..40b66dfa9b 100644 --- a/lib/setpayloadf.c +++ b/lib/setpayloadf.c @@ -31,7 +31,7 @@ setpayloadf (float *result, float payload) { #if FLT_MANT_DIG == 24 if ( -# if defined __hppa || defined __mips__ || defined __sh__ +# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__ /* A zero payload is not allowed, because that would denote Infinity. Cf. snan.h. */ payload > 0.0f diff --git a/lib/setpayloadl.c b/lib/setpayloadl.c index 6b5a1e24df..d7d0469e38 100644 --- a/lib/setpayloadl.c +++ b/lib/setpayloadl.c @@ -50,7 +50,7 @@ setpayloadl (long double *result, long double payload) # if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 113) \ && defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT if ( -# if defined __hppa || defined __mips__ || defined __sh__ +# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_LONG_DOUBLE) || defined __sh__ /* A zero payload is not allowed, because that would denote Infinity. Cf. snan.h. */ payload > 0.0L diff --git a/m4/setpayload.m4 b/m4/setpayload.m4 index 5238dd0de5..c1d6ec9244 100644 --- a/m4/setpayload.m4 +++ b/m4/setpayload.m4 @@ -1,5 +1,5 @@ # setpayload.m4 -# serial 1 +# serial 2 dnl Copyright 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, @@ -17,6 +17,8 @@ AC_DEFUN([gl_FUNC_SETPAYLOADF] fi if test $HAVE_SETPAYLOADF = 0; then SETPAYLOADF_LIBM= + dnl Prerequisite of lib/setpayloadf.c. + gl_NAN_MIPS fi AC_SUBST([SETPAYLOADF_LIBM]) ]) @@ -33,6 +35,8 @@ AC_DEFUN_ONCE([gl_FUNC_SETPAYLOAD] fi if test $HAVE_SETPAYLOAD = 0; then SETPAYLOAD_LIBM= + dnl Prerequisite of lib/setpayload.c. + gl_NAN_MIPS fi AC_SUBST([SETPAYLOAD_LIBM]) ]) @@ -58,6 +62,7 @@ AC_DEFUN([gl_FUNC_SETPAYLOADL] fi dnl Prerequisite of lib/setpayloadl.c. gl_LONG_DOUBLE_EXPONENT_LOCATION + gl_NAN_MIPS fi AC_SUBST([SETPAYLOADL_LIBM]) ]) diff --git a/modules/setpayload b/modules/setpayload index 677335a3ae..0a5cda2eb8 100644 --- a/modules/setpayload +++ b/modules/setpayload @@ -5,6 +5,7 @@ Files: lib/setpayload.c m4/mathfunc.m4 m4/setpayload.m4 +m4/nan-mips.m4 Depends-on: math diff --git a/modules/setpayloadf b/modules/setpayloadf index 05856e62da..e26f1f8be2 100644 --- a/modules/setpayloadf +++ b/modules/setpayloadf @@ -5,6 +5,7 @@ Files: lib/setpayloadf.c m4/mathfunc.m4 m4/setpayload.m4 +m4/nan-mips.m4 Depends-on: math diff --git a/modules/setpayloadl b/modules/setpayloadl index 0a94431d5d..2d058f672b 100644 --- a/modules/setpayloadl +++ b/modules/setpayloadl @@ -6,6 +6,7 @@ lib/setpayloadl.c m4/mathfunc.m4 m4/setpayload.m4 m4/exponentl.m4 +m4/nan-mips.m4 Depends-on: math -- 2.34.1