about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-08-25 16:48:03 -0500
committerPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-09-01 09:31:05 -0500
commit847c9161c7745b7e15f841a1ec40fe11d5aae515 (patch)
tree0dc92bd8c4cc8ea41d44583ccddba4fda037c0d7
parentee8a49071cba845b2ee5060b0d4238f9534b5ee3 (diff)
downloadglibc-847c9161c7745b7e15f841a1ec40fe11d5aae515.tar.gz
glibc-847c9161c7745b7e15f841a1ec40fe11d5aae515.tar.xz
glibc-847c9161c7745b7e15f841a1ec40fe11d5aae515.zip
Make common fmax implementation generic.
Also update aarch64 to ensure the correct s_fmin.c is included.
The include order favors including the generated copy.
-rw-r--r--ChangeLog21
-rw-r--r--math/Makefile4
-rw-r--r--math/s_fmax_template.c (renamed from math/s_fmax.c)14
-rw-r--r--math/s_fmaxf.c28
-rw-r--r--math/s_fmaxl.c28
-rw-r--r--sysdeps/aarch64/fpu/s_fmax.c2
-rw-r--r--sysdeps/aarch64/fpu/s_fmaxf.c2
-rw-r--r--sysdeps/aarch64/fpu/s_fminf.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/math-type-macros-double.h1
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmax.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmaxl.c5
11 files changed, 34 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index 1fa70e57a0..b719fd643c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
 2016-09-01  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
+	* math/Makefile: (gen-libm-calls): Add s_fmax.
+	(libm-calls): Remove above.
+
+	* math/s_fmax.c: Refactor into ...
+	* math/s_fmax_template.c: New file.
+	* math/s_fmaxf.c: Removed.
+	* math/s_fmaxl.c: Removed.
+
+	* sysdeps/ieee754/ldbl-opt/math-type-macros-double.h:
+	(LDOUBLE_fmaxl_libm_version): New macro.
+
+	* sysdeps/ieee754/ldbl-opt/s_fmax.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_fmaxl.c: Removed.
+
+	* sysdeps/aarch64/fpu/s_fmax.c: Append fpu/ to include of
+	s_fmin.c to pick the aarch64 version of the file.
+	* sysdeps/aarch64/fpu/s_fmaxf.c: Likewise.
+	* sysdeps/aarch64/fpu/s_fminf.c: Likewise.
+
+2016-09-01  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
 	* math/Makefile: (gen-libm-calls): Add s_nextdown.
 	(libm-calls): Remove above.
 
diff --git a/math/Makefile b/math/Makefile
index be6b8acf87..09c4c5659c 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -49,7 +49,7 @@ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF		  \
 	         s_cacoshF s_ccosF s_ccoshF s_casinF s_csinF s_casinhF	  \
 		 k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \
 		 s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF	  \
-		 s_cpowF s_clog10F s_fdimF s_nextdownF
+		 s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF
 
 libm-calls =								  \
 	e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
@@ -65,7 +65,7 @@ libm-calls =								  \
 	w_tgammaF w_hypotF w_j0F w_j1F w_jnF w_lgammaF w_lgammaF_r	  \
 	w_logF w_log10F w_powF w_remainderF w_scalbF w_sinhF w_sqrtF	  \
 	w_ilogbF							  \
-	s_fpclassifyF s_fmaxF s_fminF s_nanF s_truncF		  	  \
+	s_fpclassifyF s_fminF s_nanF s_truncF		  	  	  \
 	s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF	  \
 	s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F	  \
 	s_issignalingF $(calls:s_%=m_%) x2y2m1F				  \
diff --git a/math/s_fmax.c b/math/s_fmax_template.c
index 9a8efce87f..dea53d45f0 100644
--- a/math/s_fmax.c
+++ b/math/s_fmax_template.c
@@ -19,14 +19,14 @@
 
 #include <math.h>
 
-
-double
-__fmax (double x, double y)
+FLOAT
+M_DECL_FUNC (__fmax) (FLOAT x, FLOAT y)
 {
   return (isgreaterequal (x, y) || isnan (y)) ? x : y;
 }
-weak_alias (__fmax, fmax)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fmax, __fmaxl)
-weak_alias (__fmax, fmaxl)
+
+declare_mgen_alias (__fmax, fmax);
+
+#if M_LIBM_NEED_COMPAT (fmax)
+declare_mgen_libm_compat (__fmax, fmax)
 #endif
diff --git a/math/s_fmaxf.c b/math/s_fmaxf.c
deleted file mode 100644
index c241963bd1..0000000000
--- a/math/s_fmaxf.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Return maximum numeric value of X and Y.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-
-float
-__fmaxf (float x, float y)
-{
-  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fmaxf, fmaxf)
diff --git a/math/s_fmaxl.c b/math/s_fmaxl.c
deleted file mode 100644
index 3b2273548a..0000000000
--- a/math/s_fmaxl.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Return maximum numeric value of X and Y.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-
-long double
-__fmaxl (long double x, long double y)
-{
-  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fmaxl, fmaxl)
diff --git a/sysdeps/aarch64/fpu/s_fmax.c b/sysdeps/aarch64/fpu/s_fmax.c
index bc41ec44f6..c90de34e90 100644
--- a/sysdeps/aarch64/fpu/s_fmax.c
+++ b/sysdeps/aarch64/fpu/s_fmax.c
@@ -18,4 +18,4 @@
 
 #define FUNC fmax
 #define INSN "fmaxnm"
-#include <s_fmin.c>
+#include <fpu/s_fmin.c>
diff --git a/sysdeps/aarch64/fpu/s_fmaxf.c b/sysdeps/aarch64/fpu/s_fmaxf.c
index 6a234bbeaf..fe9d4f35ba 100644
--- a/sysdeps/aarch64/fpu/s_fmaxf.c
+++ b/sysdeps/aarch64/fpu/s_fmaxf.c
@@ -20,4 +20,4 @@
 #define INSN "fmaxnm"
 #define TYPE float
 #define REGS "s"
-#include <s_fmin.c>
+#include <fpu/s_fmin.c>
diff --git a/sysdeps/aarch64/fpu/s_fminf.c b/sysdeps/aarch64/fpu/s_fminf.c
index 78609575bb..97c9839595 100644
--- a/sysdeps/aarch64/fpu/s_fminf.c
+++ b/sysdeps/aarch64/fpu/s_fminf.c
@@ -19,4 +19,4 @@
 #define FUNC fminf
 #define TYPE float
 #define REGS "s"
-#include <s_fmin.c>
+#include <fpu/s_fmin.c>
diff --git a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
index e78a5e3589..808d2c5122 100644
--- a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
+++ b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
@@ -45,6 +45,7 @@
 #define LDOUBLE_clog10l_libm_version GLIBC_2_1
 #define LDOUBLE___clog10l_libm_version GLIBC_2_1
 #define LDOUBLE_fdiml_libm_version GLIBC_2_1
+#define LDOUBLE_fmaxl_libm_version GLIBC_2_1
 
 /* Define compat symbols for long double on platforms
    where it was not always a distinct type.  */
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmax.c b/sysdeps/ieee754/ldbl-opt/s_fmax.c
deleted file mode 100644
index 11e759121f..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_fmax.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <math_ldbl_opt.h>
-#include <math/s_fmax.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmaxl.c b/sysdeps/ieee754/ldbl-opt/s_fmaxl.c
deleted file mode 100644
index 98221b2cdc..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_fmaxl.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_fmaxl.c>
-long_double_symbol (libm, __fmaxl, fmaxl);