[4/5] Make common fmin implementation generic.

Message ID 5bab985bb0c6156137f3925101b15bbb89c947ca.1472599898.git.murphyp@linux.vnet.ibm.com
State Committed
Delegated to: Joseph Myers
Headers

Commit Message

Paul E. Murphy Aug. 30, 2016, 11:39 p.m. UTC
  * math/Makefile (gen-libm-calls): Add s_fmin
	 (libm-calls): Remove above.

	 * math/s_fmin.c: Refactor into ...
	 * math/s_fmin_template.c: New file.

	 * math/s_fminf.c: Removed.
	 * math/s_fminl.c: Removed.
	 * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h:
	 (LDOUBLE_fmin_libm_version): New macro.

	 * sysdeps/ieee754/ldbl-opt/s_fmin.c: Removed.
	 * sysdeps/ieee754/ldbl-opt/s_fminl.c: Removed.
---
 math/Makefile                                      |  4 +--
 math/s_fmin.c                                      | 32 ----------------------
 math/s_fmin_template.c                             | 32 ++++++++++++++++++++++
 math/s_fminf.c                                     | 28 -------------------
 math/s_fminl.c                                     | 28 -------------------
 sysdeps/ieee754/ldbl-opt/math-type-macros-double.h |  1 +
 sysdeps/ieee754/ldbl-opt/s_fmin.c                  |  5 ----
 sysdeps/ieee754/ldbl-opt/s_fminl.c                 |  5 ----
 8 files changed, 35 insertions(+), 100 deletions(-)
 delete mode 100644 math/s_fmin.c
 create mode 100644 math/s_fmin_template.c
 delete mode 100644 math/s_fminf.c
 delete mode 100644 math/s_fminl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_fmin.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_fminl.c
  

Comments

Joseph Myers Aug. 31, 2016, 4:55 p.m. UTC | #1
On Tue, 30 Aug 2016, Paul E. Murphy wrote:

> 	 * math/Makefile (gen-libm-calls): Add s_fmin
> 	 (libm-calls): Remove above.
> 
> 	 * math/s_fmin.c: Refactor into ...
> 	 * math/s_fmin_template.c: New file.
> 
> 	 * math/s_fminf.c: Removed.
> 	 * math/s_fminl.c: Removed.
> 	 * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h:
> 	 (LDOUBLE_fmin_libm_version): New macro.
> 
> 	 * sysdeps/ieee754/ldbl-opt/s_fmin.c: Removed.
> 	 * sysdeps/ieee754/ldbl-opt/s_fminl.c: Removed.

OK.
  
Paul E. Murphy Sept. 1, 2016, 3:34 p.m. UTC | #2
On 08/31/2016 11:55 AM, Joseph Myers wrote:
> On Tue, 30 Aug 2016, Paul E. Murphy wrote:
> 
>> 	 * math/Makefile (gen-libm-calls): Add s_fmin
>> 	 (libm-calls): Remove above.
>>
>> 	 * math/s_fmin.c: Refactor into ...
>> 	 * math/s_fmin_template.c: New file.
>>
>> 	 * math/s_fminf.c: Removed.
>> 	 * math/s_fminl.c: Removed.
>> 	 * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h:
>> 	 (LDOUBLE_fmin_libm_version): New macro.
>>
>> 	 * sysdeps/ieee754/ldbl-opt/s_fmin.c: Removed.
>> 	 * sysdeps/ieee754/ldbl-opt/s_fminl.c: Removed.
> 
> OK.
> 

Committed as f306ea1.
  

Patch

diff --git a/math/Makefile b/math/Makefile
index 09c4c56..c0d7ff0 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_fmaxF
+		 s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF s_fminF
 
 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_fminF s_nanF s_truncF		  	  	  \
+	s_fpclassifyF 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_fmin.c b/math/s_fmin.c
deleted file mode 100644
index d22b916..0000000
--- a/math/s_fmin.c
+++ /dev/null
@@ -1,32 +0,0 @@ 
-/* Return minimum 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>
-
-
-double
-__fmin (double x, double y)
-{
-  return (islessequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fmin, fmin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fmin, __fminl)
-weak_alias (__fmin, fminl)
-#endif
diff --git a/math/s_fmin_template.c b/math/s_fmin_template.c
new file mode 100644
index 0000000..b70989a
--- /dev/null
+++ b/math/s_fmin_template.c
@@ -0,0 +1,32 @@ 
+/* Return minimum 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
+M_DECL_FUNC (__fmin) (FLOAT x, FLOAT y)
+{
+  return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+declare_mgen_alias (__fmin, fmin);
+
+#if M_LIBM_NEED_COMPAT (fmin)
+declare_mgen_libm_compat (__fmin, fmin)
+#endif
diff --git a/math/s_fminf.c b/math/s_fminf.c
deleted file mode 100644
index 968373a..0000000
--- a/math/s_fminf.c
+++ /dev/null
@@ -1,28 +0,0 @@ 
-/* Return minimum 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
-__fminf (float x, float y)
-{
-  return (islessequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fminf, fminf)
diff --git a/math/s_fminl.c b/math/s_fminl.c
deleted file mode 100644
index 84e9e51..0000000
--- a/math/s_fminl.c
+++ /dev/null
@@ -1,28 +0,0 @@ 
-/* Return minimum 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
-__fminl (long double x, long double y)
-{
-  return (islessequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fminl, fminl)
diff --git a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
index 5644df0..b5136b7 100644
--- a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
+++ b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
@@ -46,6 +46,7 @@ 
 #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 LDOUBLE_fminl_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_fmin.c b/sysdeps/ieee754/ldbl-opt/s_fmin.c
deleted file mode 100644
index c3fe44d..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_fmin.c
+++ /dev/null
@@ -1,5 +0,0 @@ 
-#include <math_ldbl_opt.h>
-#include <math/s_fmin.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __fmin, fminl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fminl.c b/sysdeps/ieee754/ldbl-opt/s_fminl.c
deleted file mode 100644
index 9bfdc7a..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_fminl.c
+++ /dev/null
@@ -1,5 +0,0 @@ 
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_fminl.c>
-long_double_symbol (libm, __fminl, fminl);