about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog58
-rw-r--r--math/Makefile5
-rw-r--r--math/s_cexp.c157
-rw-r--r--math/s_cexp_template.c64
-rw-r--r--math/s_cexpf.c155
-rw-r--r--math/s_cexpl.c153
-rw-r--r--math/s_clog.c118
-rw-r--r--math/s_clog10.c124
-rw-r--r--math/s_clog10_template.c90
-rw-r--r--math/s_clog10f.c122
-rw-r--r--math/s_clog10l.c127
-rw-r--r--math/s_clog_template.c83
-rw-r--r--math/s_clogf.c116
-rw-r--r--math/s_clogl.c121
-rw-r--r--math/s_cpow.c33
-rw-r--r--math/s_cpow_template.c18
-rw-r--r--math/s_cpowf.c31
-rw-r--r--math/s_cpowl.c29
-rw-r--r--math/s_cproj.c44
-rw-r--r--math/s_cproj_template.c19
-rw-r--r--math/s_cprojf.c42
-rw-r--r--math/s_cprojl.c40
-rw-r--r--math/s_csqrt.c165
-rw-r--r--math/s_csqrt_template.c105
-rw-r--r--math/s_csqrtf.c163
-rw-r--r--math/s_csqrtl.c161
-rw-r--r--sysdeps/alpha/fpu/s_cexpf.c12
-rw-r--r--sysdeps/alpha/fpu/s_clog10f.c12
-rw-r--r--sysdeps/alpha/fpu/s_clogf.c12
-rw-r--r--sysdeps/alpha/fpu/s_cpowf.c12
-rw-r--r--sysdeps/alpha/fpu/s_cprojf.c12
-rw-r--r--sysdeps/alpha/fpu/s_csqrtf.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cexp.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cexpl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog10.c7
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog10l.c35
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clogl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cpow.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cpowl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cproj.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cprojl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csqrt.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csqrtl.c6
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_cexp_template.c (renamed from sysdeps/m68k/m680x0/fpu/s_cexp.c)15
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_cexpf.c3
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_cexpl.c3
47 files changed, 332 insertions, 2206 deletions
diff --git a/ChangeLog b/ChangeLog
index 6932deb11a..73b2ed0e5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,63 @@
 2016-08-29  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
+	* math/Makefile (libm-gen-calls): Add cpow, clog, clog10, cexp, cproj.
+	(libm-calls): Remove the above.
+
+	* math/s_cexp_template.c: Update using type-generic macros.
+	* math/s_clog10_template.c: Likewise.
+	* math/s_cpow_template.c: Likewise.
+	* math/s_clog_template.c: Likewise.
+	* math/s_cproj_template.c: Likewise.
+	* math/s_csqrt_template.c: Likewise.
+
+	* math/s_cexp.c: Removed.
+	* math/s_cexpf.c: Removed.
+	* math/s_cexpl.c: Removed.
+	* math/s_clog10.c: Removed.
+	* math/s_clog10f.c: Removed.
+	* math/s_clog10l.c: Removed.
+	* math/s_cpow.c: Removed.
+	* math/s_cpowf.c: Removed.
+	* math/s_cpowl.c: Removed.
+	* math/s_clog.c: Removed.
+	* math/s_clogf.c: Removed.
+	* math/s_clogl.c: Removed.
+	* math/s_cproj.c: Removed.
+	* math/s_cprojf.c: Removed.
+	* math/s_cprojl.c: Removed.
+	* math/s_csqrt.c: Removed.
+	* math/s_csqrtf.c: Removed.
+	* math/s_csqrtl.c: Removed.
+
+	* sysdeps/alpha/fpu/s_cexpf.c: Update using templated version.
+	* sysdeps/alpha/fpu/s_clog10f.c: Update using templated version.
+	* sysdeps/alpha/fpu/s_clogf.c: Update using templated version.
+	* sysdeps/alpha/fpu/s_cpowf.c: Update using templated version.
+	* sysdeps/alpha/fpu/s_cprojf.c: Update using templated version.
+	* sysdeps/alpha/fpu/s_csqrtf.c: Update using templated version.
+
+	* sysdeps/ieee754/ldbl-opt/s_cexp.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_cexpl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_clog.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_clog10.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_clog10l.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_cpow.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_cpowl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_cproj.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_cprojl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_csqrt.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_csqrtl.c: Removed.
+
+	* sysdeps/ieee754/ldbl-opt/s_clogl.c: Update using templated
+	version.
+
+	* sysdeps/m68k/m680x0/fpu/s_cexp.c: Refactor into.
+	* sysdeps/m68k/m680x0/fpu/s_cexp_template.c: New file.
+	* sysdeps/m68k/m680x0/fpu/s_cexpf.c: Removed.
+	* sysdeps/m68k/m680x0/fpu/s_cexpl.c: Removed.
+
+2016-08-29  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
 	* s_cexp_template.c: Copy of s_cexp.c.
 	* s_clog_template.c: Copy of s_clog.c.
 	* s_clog10_template.c: Copy of s_clog10.c.
diff --git a/math/Makefile b/math/Makefile
index dbc2a179dc..f1b7937c98 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -48,7 +48,8 @@ libm-support = s_lib_version s_matherr s_signgam			\
 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_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF	  \
+		 s_cpowF s_clog10F
 
 libm-calls =								  \
 	e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
@@ -66,8 +67,6 @@ libm-calls =								  \
 	w_ilogbF							  \
 	s_fpclassifyF s_fmaxF s_fminF s_fdimF s_nanF s_truncF		  \
 	s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF	  \
-	s_cexpF s_clogF							  \
-	s_csqrtF s_cpowF s_cprojF s_clog10F				  \
 	s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F	  \
 	s_issignalingF $(calls:s_%=m_%) x2y2m1F				  \
 	gamma_productF lgamma_negF lgamma_productF			  \
diff --git a/math/s_cexp.c b/math/s_cexp.c
deleted file mode 100644
index 3a476bde3c..0000000000
--- a/math/s_cexp.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Return value of complex exponential function for double complex value.
-   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 <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__cexp (__complex__ double x)
-{
-  __complex__ double retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_likely (rcls >= FP_ZERO))
-    {
-      /* Real part is finite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
-	  double sinix, cosix;
-
-	  if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
-	    {
-	      __sincos (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0;
-	    }
-
-	  if (__real__ x > t)
-	    {
-	      double exp_t = __ieee754_exp (t);
-	      __real__ x -= t;
-	      sinix *= exp_t;
-	      cosix *= exp_t;
-	      if (__real__ x > t)
-		{
-		  __real__ x -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	    }
-	  if (__real__ x > t)
-	    {
-	      /* Overflow (original real part of x > 3t).  */
-	      __real__ retval = DBL_MAX * cosix;
-	      __imag__ retval = DBL_MAX * sinix;
-	    }
-	  else
-	    {
-	      double exp_val = __ieee754_exp (__real__ x);
-	      __real__ retval = exp_val * cosix;
-	      __imag__ retval = exp_val * sinix;
-	    }
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  /* If the imaginary part is +-inf or NaN and the real part
-	     is not +-inf the result is NaN + iNaN.  */
-	  __real__ retval = __nan ("");
-	  __imag__ retval = __nan ("");
-
-	  feraiseexcept (FE_INVALID);
-	}
-    }
-  else if (__glibc_likely (rcls == FP_INFINITE))
-    {
-      /* Real part is infinite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
-
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = value;
-	      __imag__ retval = __imag__ x;
-	    }
-	  else
-	    {
-	      double sinix, cosix;
-
-	      if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
-		{
-		  __sincos (__imag__ x, &sinix, &cosix);
-		}
-	      else
-		{
-		  sinix = __imag__ x;
-		  cosix = 1.0;
-		}
-
-	      __real__ retval = __copysign (value, cosix);
-	      __imag__ retval = __copysign (value, sinix);
-	    }
-	}
-      else if (signbit (__real__ x) == 0)
-	{
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __nan ("");
-
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-      else
-	{
-	  __real__ retval = 0.0;
-	  __imag__ retval = __copysign (0.0, __imag__ x);
-	}
-    }
-  else
-    {
-      /* If the real part is NaN the result is NaN + iNaN unless the
-	 imaginary part is zero.  */
-      __real__ retval = __nan ("");
-      if (icls == FP_ZERO)
-	__imag__ retval = __imag__ x;
-      else
-	{
-	  __imag__ retval = __nan ("");
-
-	  if (rcls != FP_NAN || icls != FP_NAN)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-
-  return retval;
-}
-weak_alias (__cexp, cexp)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cexp, __cexpl)
-weak_alias (__cexp, cexpl)
-#endif
diff --git a/math/s_cexp_template.c b/math/s_cexp_template.c
index 3a476bde3c..a60afe0cac 100644
--- a/math/s_cexp_template.c
+++ b/math/s_cexp_template.c
@@ -1,4 +1,4 @@
-/* Return value of complex exponential function for double complex value.
+/* Return value of complex exponential function for a float type.
    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.
@@ -23,10 +23,10 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__cexp (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__cexp) (CFLOAT x)
 {
-  __complex__ double retval;
+  CFLOAT retval;
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
@@ -36,22 +36,22 @@ __cexp (__complex__ double x)
       if (__glibc_likely (icls >= FP_ZERO))
 	{
 	  /* Imaginary part is finite.  */
-	  const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
-	  double sinix, cosix;
+	  const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2));
+	  FLOAT sinix, cosix;
 
-	  if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+	  if (__glibc_likely (M_FABS (__imag__ x) > M_MIN))
 	    {
-	      __sincos (__imag__ x, &sinix, &cosix);
+	      M_SINCOS (__imag__ x, &sinix, &cosix);
 	    }
 	  else
 	    {
 	      sinix = __imag__ x;
-	      cosix = 1.0;
+	      cosix = 1;
 	    }
 
 	  if (__real__ x > t)
 	    {
-	      double exp_t = __ieee754_exp (t);
+	      FLOAT exp_t = M_EXP (t);
 	      __real__ x -= t;
 	      sinix *= exp_t;
 	      cosix *= exp_t;
@@ -65,12 +65,12 @@ __cexp (__complex__ double x)
 	  if (__real__ x > t)
 	    {
 	      /* Overflow (original real part of x > 3t).  */
-	      __real__ retval = DBL_MAX * cosix;
-	      __imag__ retval = DBL_MAX * sinix;
+	      __real__ retval = M_MAX * cosix;
+	      __imag__ retval = M_MAX * sinix;
 	    }
 	  else
 	    {
-	      double exp_val = __ieee754_exp (__real__ x);
+	      FLOAT exp_val = M_EXP (__real__ x);
 	      __real__ retval = exp_val * cosix;
 	      __imag__ retval = exp_val * sinix;
 	    }
@@ -80,8 +80,8 @@ __cexp (__complex__ double x)
 	{
 	  /* If the imaginary part is +-inf or NaN and the real part
 	     is not +-inf the result is NaN + iNaN.  */
-	  __real__ retval = __nan ("");
-	  __imag__ retval = __nan ("");
+	  __real__ retval = M_NAN;
+	  __imag__ retval = M_NAN;
 
 	  feraiseexcept (FE_INVALID);
 	}
@@ -92,7 +92,7 @@ __cexp (__complex__ double x)
       if (__glibc_likely (icls >= FP_ZERO))
 	{
 	  /* Imaginary part is finite.  */
-	  double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
+	  FLOAT value = signbit (__real__ x) ? 0 : M_HUGE_VAL;
 
 	  if (icls == FP_ZERO)
 	    {
@@ -102,46 +102,46 @@ __cexp (__complex__ double x)
 	    }
 	  else
 	    {
-	      double sinix, cosix;
+	      FLOAT sinix, cosix;
 
-	      if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+	      if (__glibc_likely (M_FABS (__imag__ x) > M_MIN))
 		{
-		  __sincos (__imag__ x, &sinix, &cosix);
+		  M_SINCOS (__imag__ x, &sinix, &cosix);
 		}
 	      else
 		{
 		  sinix = __imag__ x;
-		  cosix = 1.0;
+		  cosix = 1;
 		}
 
-	      __real__ retval = __copysign (value, cosix);
-	      __imag__ retval = __copysign (value, sinix);
+	      __real__ retval = M_COPYSIGN (value, cosix);
+	      __imag__ retval = M_COPYSIGN (value, sinix);
 	    }
 	}
       else if (signbit (__real__ x) == 0)
 	{
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __nan ("");
+	  __real__ retval = M_HUGE_VAL;
+	  __imag__ retval = M_NAN;
 
 	  if (icls == FP_INFINITE)
 	    feraiseexcept (FE_INVALID);
 	}
       else
 	{
-	  __real__ retval = 0.0;
-	  __imag__ retval = __copysign (0.0, __imag__ x);
+	  __real__ retval = 0;
+	  __imag__ retval = M_COPYSIGN (0, __imag__ x);
 	}
     }
   else
     {
       /* If the real part is NaN the result is NaN + iNaN unless the
 	 imaginary part is zero.  */
-      __real__ retval = __nan ("");
+      __real__ retval = M_NAN;
       if (icls == FP_ZERO)
 	__imag__ retval = __imag__ x;
       else
 	{
-	  __imag__ retval = __nan ("");
+	  __imag__ retval = M_NAN;
 
 	  if (rcls != FP_NAN || icls != FP_NAN)
 	    feraiseexcept (FE_INVALID);
@@ -150,8 +150,8 @@ __cexp (__complex__ double x)
 
   return retval;
 }
-weak_alias (__cexp, cexp)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cexp, __cexpl)
-weak_alias (__cexp, cexpl)
+declare_mgen_alias (__cexp, cexp)
+
+#if M_LIBM_NEED_COMPAT (cexp)
+declare_mgen_libm_compat (__cexp, cexp)
 #endif
diff --git a/math/s_cexpf.c b/math/s_cexpf.c
deleted file mode 100644
index 001fec2492..0000000000
--- a/math/s_cexpf.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Return value of complex exponential function for float complex value.
-   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 <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__cexpf (__complex__ float x)
-{
-  __complex__ float retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_likely (rcls >= FP_ZERO))
-    {
-      /* Real part is finite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
-	  float sinix, cosix;
-
-	  if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN))
-	    {
-	      __sincosf (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0f;
-	    }
-
-	  if (__real__ x > t)
-	    {
-	      float exp_t = __ieee754_expf (t);
-	      __real__ x -= t;
-	      sinix *= exp_t;
-	      cosix *= exp_t;
-	      if (__real__ x > t)
-		{
-		  __real__ x -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	    }
-	  if (__real__ x > t)
-	    {
-	      /* Overflow (original real part of x > 3t).  */
-	      __real__ retval = FLT_MAX * cosix;
-	      __imag__ retval = FLT_MAX * sinix;
-	    }
-	  else
-	    {
-	      float exp_val = __ieee754_expf (__real__ x);
-	      __real__ retval = exp_val * cosix;
-	      __imag__ retval = exp_val * sinix;
-	    }
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  /* If the imaginary part is +-inf or NaN and the real part
-	     is not +-inf the result is NaN + iNaN.  */
-	  __real__ retval = __nanf ("");
-	  __imag__ retval = __nanf ("");
-
-	  feraiseexcept (FE_INVALID);
-	}
-    }
-  else if (__glibc_likely (rcls == FP_INFINITE))
-    {
-      /* Real part is infinite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
-
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = value;
-	      __imag__ retval = __imag__ x;
-	    }
-	  else
-	    {
-	      float sinix, cosix;
-
-	      if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN))
-		{
-		  __sincosf (__imag__ x, &sinix, &cosix);
-		}
-	      else
-		{
-		  sinix = __imag__ x;
-		  cosix = 1.0f;
-		}
-
-	      __real__ retval = __copysignf (value, cosix);
-	      __imag__ retval = __copysignf (value, sinix);
-	    }
-	}
-      else if (signbit (__real__ x) == 0)
-	{
-	  __real__ retval = HUGE_VALF;
-	  __imag__ retval = __nanf ("");
-
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-      else
-	{
-	  __real__ retval = 0.0;
-	  __imag__ retval = __copysignf (0.0, __imag__ x);
-	}
-    }
-  else
-    {
-      /* If the real part is NaN the result is NaN + iNaN unless the
-	 imaginary part is zero.  */
-      __real__ retval = __nanf ("");
-      if (icls == FP_ZERO)
-	__imag__ retval = __imag__ x;
-      else
-	{
-	  __imag__ retval = __nanf ("");
-
-	  if (rcls != FP_NAN || icls != FP_NAN)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-
-  return retval;
-}
-#ifndef __cexpf
-weak_alias (__cexpf, cexpf)
-#endif
diff --git a/math/s_cexpl.c b/math/s_cexpl.c
deleted file mode 100644
index 9ab566c0c1..0000000000
--- a/math/s_cexpl.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Return value of complex exponential function for long double complex value.
-   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 <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ long double
-__cexpl (__complex__ long double x)
-{
-  __complex__ long double retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_likely (rcls >= FP_ZERO))
-    {
-      /* Real part is finite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
-	  long double sinix, cosix;
-
-	  if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
-	    {
-	      __sincosl (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0;
-	    }
-
-	  if (__real__ x > t)
-	    {
-	      long double exp_t = __ieee754_expl (t);
-	      __real__ x -= t;
-	      sinix *= exp_t;
-	      cosix *= exp_t;
-	      if (__real__ x > t)
-		{
-		  __real__ x -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	    }
-	  if (__real__ x > t)
-	    {
-	      /* Overflow (original real part of x > 3t).  */
-	      __real__ retval = LDBL_MAX * cosix;
-	      __imag__ retval = LDBL_MAX * sinix;
-	    }
-	  else
-	    {
-	      long double exp_val = __ieee754_expl (__real__ x);
-	      __real__ retval = exp_val * cosix;
-	      __imag__ retval = exp_val * sinix;
-	    }
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  /* If the imaginary part is +-inf or NaN and the real part
-	     is not +-inf the result is NaN + iNaN.  */
-	  __real__ retval = __nanl ("");
-	  __imag__ retval = __nanl ("");
-
-	  feraiseexcept (FE_INVALID);
-	}
-    }
-  else if (__glibc_likely (rcls == FP_INFINITE))
-    {
-      /* Real part is infinite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
-
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = value;
-	      __imag__ retval = __imag__ x;
-	    }
-	  else
-	    {
-	      long double sinix, cosix;
-
-	      if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
-	        {
-		  __sincosl (__imag__ x, &sinix, &cosix);
-	        }
-	      else
-		{
-		  sinix = __imag__ x;
-		  cosix = 1.0;
-		}
-
-	      __real__ retval = __copysignl (value, cosix);
-	      __imag__ retval = __copysignl (value, sinix);
-	    }
-	}
-      else if (signbit (__real__ x) == 0)
-	{
-	  __real__ retval = HUGE_VALL;
-	  __imag__ retval = __nanl ("");
-
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-      else
-	{
-	  __real__ retval = 0.0;
-	  __imag__ retval = __copysignl (0.0, __imag__ x);
-	}
-    }
-  else
-    {
-      /* If the real part is NaN the result is NaN + iNaN unless the
-	 imaginary part is zero.  */
-      __real__ retval = __nanl ("");
-      if (icls == FP_ZERO)
-	__imag__ retval = __imag__ x;
-      else
-	{
-	  __imag__ retval = __nanl ("");
-
-	  if (rcls != FP_NAN || icls != FP_NAN)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-
-  return retval;
-}
-weak_alias (__cexpl, cexpl)
diff --git a/math/s_clog.c b/math/s_clog.c
deleted file mode 100644
index b546030313..0000000000
--- a/math/s_clog.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Compute complex natural logarithm.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__clog (__complex__ double x)
-{
-  __complex__ double result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
-      __imag__ result = __copysign (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabs (__real__ x);
-    }
-  else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      double absx = fabs (__real__ x), absy = fabs (__imag__ x);
-      int scale = 0;
-
-      if (absx < absy)
-	{
-	  double t = absx;
-	  absx = absy;
-	  absy = t;
-	}
-
-      if (absx > DBL_MAX / 2.0)
-	{
-	  scale = -1;
-	  absx = __scalbn (absx, scale);
-	  absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0);
-	}
-      else if (absx < DBL_MIN && absy < DBL_MIN)
-	{
-	  scale = DBL_MANT_DIG;
-	  absx = __scalbn (absx, scale);
-	  absy = __scalbn (absy, scale);
-	}
-
-      if (absx == 1.0 && scale == 0)
-	{
-	  __real__ result = __log1p (absy * absy) / 2.0;
-	  math_check_force_underflow_nonneg (__real__ result);
-	}
-      else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0)
-	{
-	  double d2m1 = (absx - 1.0) * (absx + 1.0);
-	  if (absy >= DBL_EPSILON)
-	    d2m1 += absy * absy;
-	  __real__ result = __log1p (d2m1) / 2.0;
-	}
-      else if (absx < 1.0
-	       && absx >= 0.5
-	       && absy < DBL_EPSILON / 2.0
-	       && scale == 0)
-	{
-	  double d2m1 = (absx - 1.0) * (absx + 1.0);
-	  __real__ result = __log1p (d2m1) / 2.0;
-	}
-      else if (absx < 1.0
-	       && absx >= 0.5
-	       && scale == 0
-	       && absx * absx + absy * absy >= 0.5)
-	{
-	  double d2m1 = __x2y2m1 (absx, absy);
-	  __real__ result = __log1p (d2m1) / 2.0;
-	}
-      else
-	{
-	  double d = __ieee754_hypot (absx, absy);
-	  __real__ result = __ieee754_log (d) - scale * M_LN2;
-	}
-
-      __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nan ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VAL;
-      else
-	__real__ result = __nan ("");
-    }
-
-  return result;
-}
-weak_alias (__clog, clog)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__clog, __clogl)
-weak_alias (__clog, clogl)
-#endif
diff --git a/math/s_clog10.c b/math/s_clog10.c
deleted file mode 100644
index 8d9245bac6..0000000000
--- a/math/s_clog10.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Compute complex base 10 logarithm.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* log_10 (2).  */
-#define M_LOG10_2 0.3010299956639811952137388947244930267682
-
-/* pi * log10 (e).  */
-#define M_PI_LOG10E 1.364376353841841347485783625431355770210
-
-__complex__ double
-__clog10 (__complex__ double x)
-{
-  __complex__ double result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI_LOG10E : 0.0;
-      __imag__ result = __copysign (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabs (__real__ x);
-    }
-  else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      double absx = fabs (__real__ x), absy = fabs (__imag__ x);
-      int scale = 0;
-
-      if (absx < absy)
-	{
-	  double t = absx;
-	  absx = absy;
-	  absy = t;
-	}
-
-      if (absx > DBL_MAX / 2.0)
-	{
-	  scale = -1;
-	  absx = __scalbn (absx, scale);
-	  absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0);
-	}
-      else if (absx < DBL_MIN && absy < DBL_MIN)
-	{
-	  scale = DBL_MANT_DIG;
-	  absx = __scalbn (absx, scale);
-	  absy = __scalbn (absy, scale);
-	}
-
-      if (absx == 1.0 && scale == 0)
-	{
-	  __real__ result = __log1p (absy * absy) * (M_LOG10E / 2.0);
-	  math_check_force_underflow_nonneg (__real__ result);
-	}
-      else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0)
-	{
-	  double d2m1 = (absx - 1.0) * (absx + 1.0);
-	  if (absy >= DBL_EPSILON)
-	    d2m1 += absy * absy;
-	  __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
-	}
-      else if (absx < 1.0
-	       && absx >= 0.5
-	       && absy < DBL_EPSILON / 2.0
-	       && scale == 0)
-	{
-	  double d2m1 = (absx - 1.0) * (absx + 1.0);
-	  __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
-	}
-      else if (absx < 1.0
-	       && absx >= 0.5
-	       && scale == 0
-	       && absx * absx + absy * absy >= 0.5)
-	{
-	  double d2m1 = __x2y2m1 (absx, absy);
-	  __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
-	}
-      else
-	{
-	  double d = __ieee754_hypot (absx, absy);
-	  __real__ result = __ieee754_log10 (d) - scale * M_LOG10_2;
-	}
-
-      __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nan ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VAL;
-      else
-	__real__ result = __nan ("");
-    }
-
-  return result;
-}
-weak_alias (__clog10, clog10)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__clog10, __clog10l)
-weak_alias (__clog10, clog10l)
-#endif
diff --git a/math/s_clog10_template.c b/math/s_clog10_template.c
index 8d9245bac6..82624e38be 100644
--- a/math/s_clog10_template.c
+++ b/math/s_clog10_template.c
@@ -23,102 +23,106 @@
 #include <float.h>
 
 /* log_10 (2).  */
-#define M_LOG10_2 0.3010299956639811952137388947244930267682
+#define LOG10_2 M_LIT (0.3010299956639811952137388947244930267682)
 
 /* pi * log10 (e).  */
-#define M_PI_LOG10E 1.364376353841841347485783625431355770210
+#define PI_LOG10E M_LIT (1.364376353841841347485783625431355770210)
 
-__complex__ double
-__clog10 (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__clog10) (CFLOAT x)
 {
-  __complex__ double result;
+  CFLOAT result;
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
   if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
     {
       /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI_LOG10E : 0.0;
-      __imag__ result = __copysign (__imag__ result, __imag__ x);
+      __imag__ result = signbit (__real__ x) ? PI_LOG10E : 0;
+      __imag__ result = M_COPYSIGN (__imag__ result, __imag__ x);
       /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabs (__real__ x);
+      __real__ result = -1 / M_FABS (__real__ x);
     }
   else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
     {
       /* Neither real nor imaginary part is NaN.  */
-      double absx = fabs (__real__ x), absy = fabs (__imag__ x);
+      FLOAT absx = M_FABS (__real__ x), absy = M_FABS (__imag__ x);
       int scale = 0;
 
       if (absx < absy)
 	{
-	  double t = absx;
+	  FLOAT t = absx;
 	  absx = absy;
 	  absy = t;
 	}
 
-      if (absx > DBL_MAX / 2.0)
+      if (absx > M_MAX / 2)
 	{
 	  scale = -1;
-	  absx = __scalbn (absx, scale);
-	  absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0);
+	  absx = M_SCALBN (absx, scale);
+	  absy = (absy >= M_MIN * 2 ? M_SCALBN (absy, scale) : 0);
 	}
-      else if (absx < DBL_MIN && absy < DBL_MIN)
+      else if (absx < M_MIN && absy < M_MIN)
 	{
-	  scale = DBL_MANT_DIG;
-	  absx = __scalbn (absx, scale);
-	  absy = __scalbn (absy, scale);
+	  scale = M_MANT_DIG;
+	  absx = M_SCALBN (absx, scale);
+	  absy = M_SCALBN (absy, scale);
 	}
 
-      if (absx == 1.0 && scale == 0)
+      if (absx == 1 && scale == 0)
 	{
-	  __real__ result = __log1p (absy * absy) * (M_LOG10E / 2.0);
+	  __real__ result = (M_LOG1P (absy * absy)
+			     * ((FLOAT) M_MLIT (M_LOG10E) / 2));
 	  math_check_force_underflow_nonneg (__real__ result);
 	}
-      else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0)
+      else if (absx > 1 && absx < 2 && absy < 1 && scale == 0)
 	{
-	  double d2m1 = (absx - 1.0) * (absx + 1.0);
-	  if (absy >= DBL_EPSILON)
+	  FLOAT d2m1 = (absx - 1) * (absx + 1);
+	  if (absy >= M_EPSILON)
 	    d2m1 += absy * absy;
-	  __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
+	  __real__ result = M_LOG1P (d2m1) * ((FLOAT) M_MLIT (M_LOG10E) / 2);
 	}
-      else if (absx < 1.0
-	       && absx >= 0.5
-	       && absy < DBL_EPSILON / 2.0
+      else if (absx < 1
+	       && absx >= M_LIT (0.5)
+	       && absy < M_EPSILON / 2
 	       && scale == 0)
 	{
-	  double d2m1 = (absx - 1.0) * (absx + 1.0);
-	  __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
+	  FLOAT d2m1 = (absx - 1) * (absx + 1);
+	  __real__ result = M_LOG1P (d2m1) * ((FLOAT) M_MLIT (M_LOG10E) / 2);
 	}
-      else if (absx < 1.0
-	       && absx >= 0.5
+      else if (absx < 1
+	       && absx >= M_LIT (0.5)
 	       && scale == 0
-	       && absx * absx + absy * absy >= 0.5)
+	       && absx * absx + absy * absy >= M_LIT (0.5))
 	{
-	  double d2m1 = __x2y2m1 (absx, absy);
-	  __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
+	  FLOAT d2m1 = M_SUF (__x2y2m1) (absx, absy);
+	  __real__ result = M_LOG1P (d2m1) * ((FLOAT) M_MLIT (M_LOG10E) / 2);
 	}
       else
 	{
-	  double d = __ieee754_hypot (absx, absy);
-	  __real__ result = __ieee754_log10 (d) - scale * M_LOG10_2;
+	  FLOAT d = M_HYPOT (absx, absy);
+	  __real__ result = M_SUF (__ieee754_log10) (d) - scale * LOG10_2;
 	}
 
-      __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
+      __imag__ result = M_MLIT (M_LOG10E) * M_ATAN2 (__imag__ x, __real__ x);
     }
   else
     {
-      __imag__ result = __nan ("");
+      __imag__ result = M_NAN;
       if (rcls == FP_INFINITE || icls == FP_INFINITE)
 	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VAL;
+	__real__ result = M_HUGE_VAL;
       else
-	__real__ result = __nan ("");
+	__real__ result = M_NAN;
     }
 
   return result;
 }
-weak_alias (__clog10, clog10)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__clog10, __clog10l)
-weak_alias (__clog10, clog10l)
+
+declare_mgen_alias (__clog10, clog10)
+
+#if M_LIBM_NEED_COMPAT (clog10)
+/* __clog10 is also a public symbol.  */
+declare_mgen_libm_compat (__clog10, __clog10)
+declare_mgen_libm_compat (clog10, clog10)
 #endif
diff --git a/math/s_clog10f.c b/math/s_clog10f.c
deleted file mode 100644
index 485625e2bb..0000000000
--- a/math/s_clog10f.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Compute complex base 10 logarithm.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* log_10 (2).  */
-#define M_LOG10_2f 0.3010299956639811952137388947244930267682f
-
-/* pi * log10 (e).  */
-#define M_PI_LOG10Ef 1.364376353841841347485783625431355770210f
-
-__complex__ float
-__clog10f (__complex__ float x)
-{
-  __complex__ float result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI_LOG10Ef : 0.0;
-      __imag__ result = __copysignf (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabsf (__real__ x);
-    }
-  else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      float absx = fabsf (__real__ x), absy = fabsf (__imag__ x);
-      int scale = 0;
-
-      if (absx < absy)
-	{
-	  float t = absx;
-	  absx = absy;
-	  absy = t;
-	}
-
-      if (absx > FLT_MAX / 2.0f)
-	{
-	  scale = -1;
-	  absx = __scalbnf (absx, scale);
-	  absy = (absy >= FLT_MIN * 2.0f ? __scalbnf (absy, scale) : 0.0f);
-	}
-      else if (absx < FLT_MIN && absy < FLT_MIN)
-	{
-	  scale = FLT_MANT_DIG;
-	  absx = __scalbnf (absx, scale);
-	  absy = __scalbnf (absy, scale);
-	}
-
-      if (absx == 1.0f && scale == 0)
-	{
-	  __real__ result = __log1pf (absy * absy) * ((float) M_LOG10E / 2.0f);
-	  math_check_force_underflow_nonneg (__real__ result);
-	}
-      else if (absx > 1.0f && absx < 2.0f && absy < 1.0f && scale == 0)
-	{
-	  float d2m1 = (absx - 1.0f) * (absx + 1.0f);
-	  if (absy >= FLT_EPSILON)
-	    d2m1 += absy * absy;
-	  __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f);
-	}
-      else if (absx < 1.0f
-	       && absx >= 0.5f
-	       && absy < FLT_EPSILON / 2.0f
-	       && scale == 0)
-	{
-	  float d2m1 = (absx - 1.0f) * (absx + 1.0f);
-	  __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f);
-	}
-      else if (absx < 1.0f
-	       && absx >= 0.5f
-	       && scale == 0
-	       && absx * absx + absy * absy >= 0.5f)
-	{
-	  float d2m1 = __x2y2m1f (absx, absy);
-	  __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f);
-	}
-      else
-	{
-	  float d = __ieee754_hypotf (absx, absy);
-	  __real__ result = __ieee754_log10f (d) - scale * M_LOG10_2f;
-	}
-
-      __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nanf ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VALF;
-      else
-	__real__ result = __nanf ("");
-    }
-
-  return result;
-}
-#ifndef __clog10f
-weak_alias (__clog10f, clog10f)
-#endif
diff --git a/math/s_clog10l.c b/math/s_clog10l.c
deleted file mode 100644
index da40477a80..0000000000
--- a/math/s_clog10l.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Compute complex base 10 logarithm.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious underflows, use this definition to treat IBM long
-   double as approximating an IEEE-style format.  */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
-
-/* log_10 (2).  */
-#define M_LOG10_2l 0.3010299956639811952137388947244930267682L
-
-/* pi * log10 (e).  */
-#define M_PI_LOG10El 1.364376353841841347485783625431355770210L
-
-__complex__ long double
-__clog10l (__complex__ long double x)
-{
-  __complex__ long double result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI_LOG10El : 0.0;
-      __imag__ result = __copysignl (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabsl (__real__ x);
-    }
-  else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x);
-      int scale = 0;
-
-      if (absx < absy)
-	{
-	  long double t = absx;
-	  absx = absy;
-	  absy = t;
-	}
-
-      if (absx > LDBL_MAX / 2.0L)
-	{
-	  scale = -1;
-	  absx = __scalbnl (absx, scale);
-	  absy = (absy >= LDBL_MIN * 2.0L ? __scalbnl (absy, scale) : 0.0L);
-	}
-      else if (absx < LDBL_MIN && absy < LDBL_MIN)
-	{
-	  scale = LDBL_MANT_DIG;
-	  absx = __scalbnl (absx, scale);
-	  absy = __scalbnl (absy, scale);
-	}
-
-      if (absx == 1.0L && scale == 0)
-	{
-	  __real__ result = __log1pl (absy * absy) * (M_LOG10El / 2.0L);
-	  math_check_force_underflow_nonneg (__real__ result);
-	}
-      else if (absx > 1.0L && absx < 2.0L && absy < 1.0L && scale == 0)
-	{
-	  long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
-	  if (absy >= LDBL_EPSILON)
-	    d2m1 += absy * absy;
-	  __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L);
-	}
-      else if (absx < 1.0L
-	       && absx >= 0.5L
-	       && absy < LDBL_EPSILON / 2.0L
-	       && scale == 0)
-	{
-	  long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
-	  __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L);
-	}
-      else if (absx < 1.0L
-	       && absx >= 0.5L
-	       && scale == 0
-	       && absx * absx + absy * absy >= 0.5L)
-	{
-	  long double d2m1 = __x2y2m1l (absx, absy);
-	  __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L);
-	}
-      else
-	{
-	  long double d = __ieee754_hypotl (absx, absy);
-	  __real__ result = __ieee754_log10l (d) - scale * M_LOG10_2l;
-	}
-
-      __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nanl ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VALL;
-      else
-	__real__ result = __nanl ("");
-    }
-
-  return result;
-}
-weak_alias (__clog10l, clog10l)
diff --git a/math/s_clog_template.c b/math/s_clog_template.c
index b546030313..047ac03cd9 100644
--- a/math/s_clog_template.c
+++ b/math/s_clog_template.c
@@ -22,97 +22,98 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__clog (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__clog) (CFLOAT x)
 {
-  __complex__ double result;
+  CFLOAT result;
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
   if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
     {
       /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
-      __imag__ result = __copysign (__imag__ result, __imag__ x);
+      __imag__ result = signbit (__real__ x) ? (FLOAT) M_MLIT (M_PI) : 0;
+      __imag__ result = M_COPYSIGN (__imag__ result, __imag__ x);
       /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabs (__real__ x);
+      __real__ result = -1 / M_FABS (__real__ x);
     }
   else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
     {
       /* Neither real nor imaginary part is NaN.  */
-      double absx = fabs (__real__ x), absy = fabs (__imag__ x);
+      FLOAT absx = M_FABS (__real__ x), absy = M_FABS (__imag__ x);
       int scale = 0;
 
       if (absx < absy)
 	{
-	  double t = absx;
+	  FLOAT t = absx;
 	  absx = absy;
 	  absy = t;
 	}
 
-      if (absx > DBL_MAX / 2.0)
+      if (absx > M_MAX / 2)
 	{
 	  scale = -1;
-	  absx = __scalbn (absx, scale);
-	  absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0);
+	  absx = M_SCALBN (absx, scale);
+	  absy = (absy >= M_MIN * 2 ? M_SCALBN (absy, scale) : 0);
 	}
-      else if (absx < DBL_MIN && absy < DBL_MIN)
+      else if (absx < M_MIN && absy < M_MIN)
 	{
-	  scale = DBL_MANT_DIG;
-	  absx = __scalbn (absx, scale);
-	  absy = __scalbn (absy, scale);
+	  scale = M_MANT_DIG;
+	  absx = M_SCALBN (absx, scale);
+	  absy = M_SCALBN (absy, scale);
 	}
 
-      if (absx == 1.0 && scale == 0)
+      if (absx == 1 && scale == 0)
 	{
-	  __real__ result = __log1p (absy * absy) / 2.0;
+	  __real__ result = M_LOG1P (absy * absy) / 2;
 	  math_check_force_underflow_nonneg (__real__ result);
 	}
-      else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0)
+      else if (absx > 1 && absx < 2 && absy < 1 && scale == 0)
 	{
-	  double d2m1 = (absx - 1.0) * (absx + 1.0);
-	  if (absy >= DBL_EPSILON)
+	  FLOAT d2m1 = (absx - 1) * (absx + 1);
+	  if (absy >= M_EPSILON)
 	    d2m1 += absy * absy;
-	  __real__ result = __log1p (d2m1) / 2.0;
+	  __real__ result = M_LOG1P (d2m1) / 2;
 	}
-      else if (absx < 1.0
-	       && absx >= 0.5
-	       && absy < DBL_EPSILON / 2.0
+      else if (absx < 1
+	       && absx >= M_LIT (0.5)
+	       && absy < M_EPSILON / 2
 	       && scale == 0)
 	{
-	  double d2m1 = (absx - 1.0) * (absx + 1.0);
-	  __real__ result = __log1p (d2m1) / 2.0;
+	  FLOAT d2m1 = (absx - 1) * (absx + 1);
+	  __real__ result = M_LOG1P (d2m1) / 2;
 	}
-      else if (absx < 1.0
-	       && absx >= 0.5
+      else if (absx < 1
+	       && absx >= M_LIT (0.5)
 	       && scale == 0
-	       && absx * absx + absy * absy >= 0.5)
+	       && absx * absx + absy * absy >= M_LIT (0.5))
 	{
-	  double d2m1 = __x2y2m1 (absx, absy);
-	  __real__ result = __log1p (d2m1) / 2.0;
+	  FLOAT d2m1 = M_SUF (__x2y2m1) (absx, absy);
+	  __real__ result = M_LOG1P (d2m1) / 2;
 	}
       else
 	{
-	  double d = __ieee754_hypot (absx, absy);
-	  __real__ result = __ieee754_log (d) - scale * M_LN2;
+	  FLOAT d = M_HYPOT (absx, absy);
+	  __real__ result = M_LOG (d) - scale * (FLOAT) M_MLIT (M_LN2);
 	}
 
-      __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
+      __imag__ result = M_ATAN2 (__imag__ x, __real__ x);
     }
   else
     {
-      __imag__ result = __nan ("");
+      __imag__ result = M_NAN;
       if (rcls == FP_INFINITE || icls == FP_INFINITE)
 	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VAL;
+	__real__ result = M_HUGE_VAL;
       else
-	__real__ result = __nan ("");
+	__real__ result = M_NAN;
     }
 
   return result;
 }
-weak_alias (__clog, clog)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__clog, __clogl)
-weak_alias (__clog, clogl)
+
+declare_mgen_alias (__clog, clog)
+
+#if M_LIBM_NEED_COMPAT (clog)
+declare_mgen_libm_compat (__clog, clog)
 #endif
diff --git a/math/s_clogf.c b/math/s_clogf.c
deleted file mode 100644
index cc565398e6..0000000000
--- a/math/s_clogf.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Compute complex natural logarithm.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__clogf (__complex__ float x)
-{
-  __complex__ float result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
-      __imag__ result = __copysignf (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabsf (__real__ x);
-    }
-  else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      float absx = fabsf (__real__ x), absy = fabsf (__imag__ x);
-      int scale = 0;
-
-      if (absx < absy)
-	{
-	  float t = absx;
-	  absx = absy;
-	  absy = t;
-	}
-
-      if (absx > FLT_MAX / 2.0f)
-	{
-	  scale = -1;
-	  absx = __scalbnf (absx, scale);
-	  absy = (absy >= FLT_MIN * 2.0f ? __scalbnf (absy, scale) : 0.0f);
-	}
-      else if (absx < FLT_MIN && absy < FLT_MIN)
-	{
-	  scale = FLT_MANT_DIG;
-	  absx = __scalbnf (absx, scale);
-	  absy = __scalbnf (absy, scale);
-	}
-
-      if (absx == 1.0f && scale == 0)
-	{
-	  __real__ result = __log1pf (absy * absy) / 2.0f;
-	  math_check_force_underflow_nonneg (__real__ result);
-	}
-      else if (absx > 1.0f && absx < 2.0f && absy < 1.0f && scale == 0)
-	{
-	  float d2m1 = (absx - 1.0f) * (absx + 1.0f);
-	  if (absy >= FLT_EPSILON)
-	    d2m1 += absy * absy;
-	  __real__ result = __log1pf (d2m1) / 2.0f;
-	}
-      else if (absx < 1.0f
-	       && absx >= 0.5f
-	       && absy < FLT_EPSILON / 2.0f
-	       && scale == 0)
-	{
-	  float d2m1 = (absx - 1.0f) * (absx + 1.0f);
-	  __real__ result = __log1pf (d2m1) / 2.0f;
-	}
-      else if (absx < 1.0f
-	       && absx >= 0.5f
-	       && scale == 0
-	       && absx * absx + absy * absy >= 0.5f)
-	{
-	  float d2m1 = __x2y2m1f (absx, absy);
-	  __real__ result = __log1pf (d2m1) / 2.0f;
-	}
-      else
-	{
-	  float d = __ieee754_hypotf (absx, absy);
-	  __real__ result = __ieee754_logf (d) - scale * (float) M_LN2;
-	}
-
-      __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nanf ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VALF;
-      else
-	__real__ result = __nanf ("");
-    }
-
-  return result;
-}
-#ifndef __clogf
-weak_alias (__clogf, clogf)
-#endif
diff --git a/math/s_clogl.c b/math/s_clogl.c
deleted file mode 100644
index 6db59b722f..0000000000
--- a/math/s_clogl.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Compute complex natural logarithm.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious underflows, use this definition to treat IBM long
-   double as approximating an IEEE-style format.  */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
-
-__complex__ long double
-__clogl (__complex__ long double x)
-{
-  __complex__ long double result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
-      __imag__ result = __copysignl (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabsl (__real__ x);
-    }
-  else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x);
-      int scale = 0;
-
-      if (absx < absy)
-	{
-	  long double t = absx;
-	  absx = absy;
-	  absy = t;
-	}
-
-      if (absx > LDBL_MAX / 2.0L)
-	{
-	  scale = -1;
-	  absx = __scalbnl (absx, scale);
-	  absy = (absy >= LDBL_MIN * 2.0L ? __scalbnl (absy, scale) : 0.0L);
-	}
-      else if (absx < LDBL_MIN && absy < LDBL_MIN)
-	{
-	  scale = LDBL_MANT_DIG;
-	  absx = __scalbnl (absx, scale);
-	  absy = __scalbnl (absy, scale);
-	}
-
-      if (absx == 1.0L && scale == 0)
-	{
-	  __real__ result = __log1pl (absy * absy) / 2.0L;
-	  math_check_force_underflow_nonneg (__real__ result);
-	}
-      else if (absx > 1.0L && absx < 2.0L && absy < 1.0L && scale == 0)
-	{
-	  long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
-	  if (absy >= LDBL_EPSILON)
-	    d2m1 += absy * absy;
-	  __real__ result = __log1pl (d2m1) / 2.0L;
-	}
-      else if (absx < 1.0L
-	       && absx >= 0.5L
-	       && absy < LDBL_EPSILON / 2.0L
-	       && scale == 0)
-	{
-	  long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
-	  __real__ result = __log1pl (d2m1) / 2.0L;
-	}
-      else if (absx < 1.0L
-	       && absx >= 0.5L
-	       && scale == 0
-	       && absx * absx + absy * absy >= 0.5L)
-	{
-	  long double d2m1 = __x2y2m1l (absx, absy);
-	  __real__ result = __log1pl (d2m1) / 2.0L;
-	}
-      else
-	{
-	  long double d = __ieee754_hypotl (absx, absy);
-	  __real__ result = __ieee754_logl (d) - scale * M_LN2l;
-	}
-
-      __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nanl ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VALL;
-      else
-	__real__ result = __nanl ("");
-    }
-
-  return result;
-}
-weak_alias (__clogl, clogl)
diff --git a/math/s_cpow.c b/math/s_cpow.c
deleted file mode 100644
index 037e575b1a..0000000000
--- a/math/s_cpow.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Complex power of double values.
-   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 <complex.h>
-#include <math.h>
-
-
-__complex__ double
-__cpow (__complex__ double x, __complex__ double c)
-{
-  return __cexp (c * __clog (x));
-}
-weak_alias (__cpow, cpow)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cpow, __cpowl)
-weak_alias (__cpow, cpowl)
-#endif
diff --git a/math/s_cpow_template.c b/math/s_cpow_template.c
index 037e575b1a..12dfc92c23 100644
--- a/math/s_cpow_template.c
+++ b/math/s_cpow_template.c
@@ -1,4 +1,4 @@
-/* Complex power of double values.
+/* Complex power of float type.
    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.
@@ -20,14 +20,14 @@
 #include <complex.h>
 #include <math.h>
 
-
-__complex__ double
-__cpow (__complex__ double x, __complex__ double c)
+CFLOAT
+M_DECL_FUNC (__cpow) (CFLOAT x, CFLOAT c)
 {
-  return __cexp (c * __clog (x));
+  return M_SUF (__cexp) (c * M_SUF (__clog) (x));
 }
-weak_alias (__cpow, cpow)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cpow, __cpowl)
-weak_alias (__cpow, cpowl)
+
+declare_mgen_alias (__cpow, cpow)
+
+#if M_LIBM_NEED_COMPAT (cpow)
+declare_mgen_libm_compat (__cpow, cpow)
 #endif
diff --git a/math/s_cpowf.c b/math/s_cpowf.c
deleted file mode 100644
index 2b0b5b26c5..0000000000
--- a/math/s_cpowf.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Complex power of float values.
-   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 <complex.h>
-#include <math.h>
-
-
-__complex__ float
-__cpowf (__complex__ float x, __complex__ float c)
-{
-  return __cexpf (c * __clogf (x));
-}
-#ifndef __cpowf
-weak_alias (__cpowf, cpowf)
-#endif
diff --git a/math/s_cpowl.c b/math/s_cpowl.c
deleted file mode 100644
index 963e03a45c..0000000000
--- a/math/s_cpowl.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Complex power of long double values.
-   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 <complex.h>
-#include <math.h>
-
-
-__complex__ long double
-__cpowl (__complex__ long double x, __complex__ long double c)
-{
-  return __cexpl (c * __clogl (x));
-}
-weak_alias (__cpowl, cpowl)
diff --git a/math/s_cproj.c b/math/s_cproj.c
deleted file mode 100644
index d47f009502..0000000000
--- a/math/s_cproj.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Compute projection of complex double value to Riemann sphere.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ double
-__cproj (__complex__ double x)
-{
-  if (isinf (__real__ x) || isinf (__imag__ x))
-    {
-      __complex__ double res;
-
-      __real__ res = INFINITY;
-      __imag__ res = __copysign (0.0, __imag__ x);
-
-      return res;
-    }
-
-  return x;
-}
-weak_alias (__cproj, cproj)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cproj, __cprojl)
-weak_alias (__cproj, cprojl)
-#endif
diff --git a/math/s_cproj_template.c b/math/s_cproj_template.c
index d47f009502..e274e4cef5 100644
--- a/math/s_cproj_template.c
+++ b/math/s_cproj_template.c
@@ -1,4 +1,4 @@
-/* Compute projection of complex double value to Riemann sphere.
+/* Compute projection of complex float type value to Riemann sphere.
    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.
@@ -22,23 +22,24 @@
 #include <math_private.h>
 
 
-__complex__ double
-__cproj (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__cproj) (CFLOAT x)
 {
   if (isinf (__real__ x) || isinf (__imag__ x))
     {
-      __complex__ double res;
+      CFLOAT res;
 
       __real__ res = INFINITY;
-      __imag__ res = __copysign (0.0, __imag__ x);
+      __imag__ res = M_COPYSIGN (0, __imag__ x);
 
       return res;
     }
 
   return x;
 }
-weak_alias (__cproj, cproj)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cproj, __cprojl)
-weak_alias (__cproj, cprojl)
+
+declare_mgen_alias (__cproj, cproj)
+
+#if M_LIBM_NEED_COMPAT (cproj)
+declare_mgen_libm_compat (__cproj, cproj)
 #endif
diff --git a/math/s_cprojf.c b/math/s_cprojf.c
deleted file mode 100644
index 8a0d873fdc..0000000000
--- a/math/s_cprojf.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Compute projection of complex float value to Riemann sphere.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ float
-__cprojf (__complex__ float x)
-{
-  if (isinf (__real__ x) || isinf (__imag__ x))
-    {
-      __complex__ float res;
-
-      __real__ res = INFINITY;
-      __imag__ res = __copysignf (0.0, __imag__ x);
-
-      return res;
-    }
-
-  return x;
-}
-#ifndef __cprojf
-weak_alias (__cprojf, cprojf)
-#endif
diff --git a/math/s_cprojl.c b/math/s_cprojl.c
deleted file mode 100644
index 213b73331a..0000000000
--- a/math/s_cprojl.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Compute projection of complex long double value to Riemann sphere.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ long double
-__cprojl (__complex__ long double x)
-{
-  if (isinf (__real__ x) || isinf (__imag__ x))
-    {
-      __complex__ long double res;
-
-      __real__ res = INFINITY;
-      __imag__ res = __copysignl (0.0, __imag__ x);
-
-      return res;
-    }
-
-  return x;
-}
-weak_alias (__cprojl, cprojl)
diff --git a/math/s_csqrt.c b/math/s_csqrt.c
deleted file mode 100644
index 1f073e7f17..0000000000
--- a/math/s_csqrt.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/* Complex square root of double value.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__csqrt (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VAL;
-	  __imag__ res = __imag__ x;
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = icls == FP_NAN ? __nan ("") : 0;
-	      __imag__ res = __copysign (HUGE_VAL, __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = __real__ x;
-	      __imag__ res = (icls == FP_NAN
-			      ? __nan ("") : __copysign (0.0, __imag__ x));
-	    }
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else
-    {
-      if (__glibc_unlikely (icls == FP_ZERO))
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = 0.0;
-	      __imag__ res = __copysign (__ieee754_sqrt (-__real__ x),
-					 __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = fabs (__ieee754_sqrt (__real__ x));
-	      __imag__ res = __copysign (0.0, __imag__ x);
-	    }
-	}
-      else if (__glibc_unlikely (rcls == FP_ZERO))
-	{
-	  double r;
-	  if (fabs (__imag__ x) >= 2.0 * DBL_MIN)
-	    r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
-	  else
-	    r = 0.5 * __ieee754_sqrt (2.0 * fabs (__imag__ x));
-
-	  __real__ res = r;
-	  __imag__ res = __copysign (r, __imag__ x);
-	}
-      else
-	{
-	  double d, r, s;
-	  int scale = 0;
-
-	  if (fabs (__real__ x) > DBL_MAX / 4.0)
-	    {
-	      scale = 1;
-	      __real__ x = __scalbn (__real__ x, -2 * scale);
-	      __imag__ x = __scalbn (__imag__ x, -2 * scale);
-	    }
-	  else if (fabs (__imag__ x) > DBL_MAX / 4.0)
-	    {
-	      scale = 1;
-	      if (fabs (__real__ x) >= 4.0 * DBL_MIN)
-		__real__ x = __scalbn (__real__ x, -2 * scale);
-	      else
-		__real__ x = 0.0;
-	      __imag__ x = __scalbn (__imag__ x, -2 * scale);
-	    }
-	  else if (fabs (__real__ x) < 2.0 * DBL_MIN
-		   && fabs (__imag__ x) < 2.0 * DBL_MIN)
-	    {
-	      scale = -((DBL_MANT_DIG + 1) / 2);
-	      __real__ x = __scalbn (__real__ x, -2 * scale);
-	      __imag__ x = __scalbn (__imag__ x, -2 * scale);
-	    }
-
-	  d = __ieee754_hypot (__real__ x, __imag__ x);
-	  /* Use the identity   2  Re res  Im res = Im x
-	     to avoid cancellation error in  d +/- Re x.  */
-	  if (__real__ x > 0)
-	    {
-	      r = __ieee754_sqrt (0.5 * (d + __real__ x));
-	      if (scale == 1 && fabs (__imag__ x) < 1.0)
-		{
-		  /* Avoid possible intermediate underflow.  */
-		  s = __imag__ x / r;
-		  r = __scalbn (r, scale);
-		  scale = 0;
-		}
-	      else
-		s = 0.5 * (__imag__ x / r);
-	    }
-	  else
-	    {
-	      s = __ieee754_sqrt (0.5 * (d - __real__ x));
-	      if (scale == 1 && fabs (__imag__ x) < 1.0)
-		{
-		  /* Avoid possible intermediate underflow.  */
-		  r = fabs (__imag__ x / s);
-		  s = __scalbn (s, scale);
-		  scale = 0;
-		}
-	      else
-		r = fabs (0.5 * (__imag__ x / s));
-	    }
-
-	  if (scale)
-	    {
-	      r = __scalbn (r, scale);
-	      s = __scalbn (s, scale);
-	    }
-
-	  math_check_force_underflow (r);
-	  math_check_force_underflow (s);
-
-	  __real__ res = r;
-	  __imag__ res = __copysign (s, __imag__ x);
-	}
-    }
-
-  return res;
-}
-weak_alias (__csqrt, csqrt)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csqrt, __csqrtl)
-weak_alias (__csqrt, csqrtl)
-#endif
diff --git a/math/s_csqrt_template.c b/math/s_csqrt_template.c
index 1f073e7f17..22af083af7 100644
--- a/math/s_csqrt_template.c
+++ b/math/s_csqrt_template.c
@@ -1,4 +1,4 @@
-/* Complex square root of double value.
+/* Complex square root of a float type.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
@@ -23,10 +23,10 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__csqrt (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__csqrt) (CFLOAT x)
 {
-  __complex__ double res;
+  CFLOAT res;
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
@@ -34,132 +34,131 @@ __csqrt (__complex__ double x)
     {
       if (icls == FP_INFINITE)
 	{
-	  __real__ res = HUGE_VAL;
+	  __real__ res = M_HUGE_VAL;
 	  __imag__ res = __imag__ x;
 	}
       else if (rcls == FP_INFINITE)
 	{
-	  if (__real__ x < 0.0)
+	  if (__real__ x < 0)
 	    {
-	      __real__ res = icls == FP_NAN ? __nan ("") : 0;
-	      __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+	      __real__ res = icls == FP_NAN ? M_NAN : 0;
+	      __imag__ res = M_COPYSIGN (M_HUGE_VAL, __imag__ x);
 	    }
 	  else
 	    {
 	      __real__ res = __real__ x;
 	      __imag__ res = (icls == FP_NAN
-			      ? __nan ("") : __copysign (0.0, __imag__ x));
+			      ? M_NAN : M_COPYSIGN (0, __imag__ x));
 	    }
 	}
       else
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
+	  __real__ res = M_NAN;
+	  __imag__ res = M_NAN;
 	}
     }
   else
     {
       if (__glibc_unlikely (icls == FP_ZERO))
 	{
-	  if (__real__ x < 0.0)
+	  if (__real__ x < 0)
 	    {
-	      __real__ res = 0.0;
-	      __imag__ res = __copysign (__ieee754_sqrt (-__real__ x),
-					 __imag__ x);
+	      __real__ res = 0;
+	      __imag__ res = M_COPYSIGN (M_SQRT (-__real__ x), __imag__ x);
 	    }
 	  else
 	    {
-	      __real__ res = fabs (__ieee754_sqrt (__real__ x));
-	      __imag__ res = __copysign (0.0, __imag__ x);
+	      __real__ res = M_FABS (M_SQRT (__real__ x));
+	      __imag__ res = M_COPYSIGN (0, __imag__ x);
 	    }
 	}
       else if (__glibc_unlikely (rcls == FP_ZERO))
 	{
-	  double r;
-	  if (fabs (__imag__ x) >= 2.0 * DBL_MIN)
-	    r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
+	  FLOAT r;
+	  if (M_FABS (__imag__ x) >= 2 * M_MIN)
+	    r = M_SQRT (M_LIT (0.5) * M_FABS (__imag__ x));
 	  else
-	    r = 0.5 * __ieee754_sqrt (2.0 * fabs (__imag__ x));
+	    r = M_LIT (0.5) * M_SQRT (2 * M_FABS (__imag__ x));
 
 	  __real__ res = r;
-	  __imag__ res = __copysign (r, __imag__ x);
+	  __imag__ res = M_COPYSIGN (r, __imag__ x);
 	}
       else
 	{
-	  double d, r, s;
+	  FLOAT d, r, s;
 	  int scale = 0;
 
-	  if (fabs (__real__ x) > DBL_MAX / 4.0)
+	  if (M_FABS (__real__ x) > M_MAX / 4)
 	    {
 	      scale = 1;
-	      __real__ x = __scalbn (__real__ x, -2 * scale);
-	      __imag__ x = __scalbn (__imag__ x, -2 * scale);
+	      __real__ x = M_SCALBN (__real__ x, -2 * scale);
+	      __imag__ x = M_SCALBN (__imag__ x, -2 * scale);
 	    }
-	  else if (fabs (__imag__ x) > DBL_MAX / 4.0)
+	  else if (M_FABS (__imag__ x) > M_MAX / 4)
 	    {
 	      scale = 1;
-	      if (fabs (__real__ x) >= 4.0 * DBL_MIN)
-		__real__ x = __scalbn (__real__ x, -2 * scale);
+	      if (M_FABS (__real__ x) >= 4 * M_MIN)
+		__real__ x = M_SCALBN (__real__ x, -2 * scale);
 	      else
-		__real__ x = 0.0;
-	      __imag__ x = __scalbn (__imag__ x, -2 * scale);
+		__real__ x = 0;
+	      __imag__ x = M_SCALBN (__imag__ x, -2 * scale);
 	    }
-	  else if (fabs (__real__ x) < 2.0 * DBL_MIN
-		   && fabs (__imag__ x) < 2.0 * DBL_MIN)
+	  else if (M_FABS (__real__ x) < 2 * M_MIN
+		   && M_FABS (__imag__ x) < 2 * M_MIN)
 	    {
-	      scale = -((DBL_MANT_DIG + 1) / 2);
-	      __real__ x = __scalbn (__real__ x, -2 * scale);
-	      __imag__ x = __scalbn (__imag__ x, -2 * scale);
+	      scale = -((M_MANT_DIG + 1) / 2);
+	      __real__ x = M_SCALBN (__real__ x, -2 * scale);
+	      __imag__ x = M_SCALBN (__imag__ x, -2 * scale);
 	    }
 
-	  d = __ieee754_hypot (__real__ x, __imag__ x);
+	  d = M_HYPOT (__real__ x, __imag__ x);
 	  /* Use the identity   2  Re res  Im res = Im x
 	     to avoid cancellation error in  d +/- Re x.  */
 	  if (__real__ x > 0)
 	    {
-	      r = __ieee754_sqrt (0.5 * (d + __real__ x));
-	      if (scale == 1 && fabs (__imag__ x) < 1.0)
+	      r = M_SQRT (M_LIT (0.5) * (d + __real__ x));
+	      if (scale == 1 && M_FABS (__imag__ x) < 1)
 		{
 		  /* Avoid possible intermediate underflow.  */
 		  s = __imag__ x / r;
-		  r = __scalbn (r, scale);
+		  r = M_SCALBN (r, scale);
 		  scale = 0;
 		}
 	      else
-		s = 0.5 * (__imag__ x / r);
+		s = M_LIT (0.5) * (__imag__ x / r);
 	    }
 	  else
 	    {
-	      s = __ieee754_sqrt (0.5 * (d - __real__ x));
-	      if (scale == 1 && fabs (__imag__ x) < 1.0)
+	      s = M_SQRT (M_LIT (0.5) * (d - __real__ x));
+	      if (scale == 1 && M_FABS (__imag__ x) < 1)
 		{
 		  /* Avoid possible intermediate underflow.  */
-		  r = fabs (__imag__ x / s);
-		  s = __scalbn (s, scale);
+		  r = M_FABS (__imag__ x / s);
+		  s = M_SCALBN (s, scale);
 		  scale = 0;
 		}
 	      else
-		r = fabs (0.5 * (__imag__ x / s));
+		r = M_FABS (M_LIT (0.5) * (__imag__ x / s));
 	    }
 
 	  if (scale)
 	    {
-	      r = __scalbn (r, scale);
-	      s = __scalbn (s, scale);
+	      r = M_SCALBN (r, scale);
+	      s = M_SCALBN (s, scale);
 	    }
 
 	  math_check_force_underflow (r);
 	  math_check_force_underflow (s);
 
 	  __real__ res = r;
-	  __imag__ res = __copysign (s, __imag__ x);
+	  __imag__ res = M_COPYSIGN (s, __imag__ x);
 	}
     }
 
   return res;
 }
-weak_alias (__csqrt, csqrt)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csqrt, __csqrtl)
-weak_alias (__csqrt, csqrtl)
+declare_mgen_alias (__csqrt, csqrt)
+
+#if M_LIBM_NEED_COMPAT (csqrt)
+declare_mgen_libm_compat (__csqrt, csqrt)
 #endif
diff --git a/math/s_csqrtf.c b/math/s_csqrtf.c
deleted file mode 100644
index b30af06e08..0000000000
--- a/math/s_csqrtf.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Complex square root of float value.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__csqrtf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VALF;
-	  __imag__ res = __imag__ x;
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = icls == FP_NAN ? __nanf ("") : 0;
-	      __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = __real__ x;
-	      __imag__ res = (icls == FP_NAN
-			      ? __nanf ("") : __copysignf (0.0, __imag__ x));
-	    }
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else
-    {
-      if (__glibc_unlikely (icls == FP_ZERO))
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = 0.0;
-	      __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x),
-					  __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = fabsf (__ieee754_sqrtf (__real__ x));
-	      __imag__ res = __copysignf (0.0, __imag__ x);
-	    }
-	}
-      else if (__glibc_unlikely (rcls == FP_ZERO))
-	{
-	  float r;
-	  if (fabsf (__imag__ x) >= 2.0f * FLT_MIN)
-	    r = __ieee754_sqrtf (0.5f * fabsf (__imag__ x));
-	  else
-	    r = 0.5f * __ieee754_sqrtf (2.0f * fabsf (__imag__ x));
-
-	  __real__ res = r;
-	  __imag__ res = __copysignf (r, __imag__ x);
-	}
-      else
-	{
-	  float d, r, s;
-	  int scale = 0;
-
-	  if (fabsf (__real__ x) > FLT_MAX / 4.0f)
-	    {
-	      scale = 1;
-	      __real__ x = __scalbnf (__real__ x, -2 * scale);
-	      __imag__ x = __scalbnf (__imag__ x, -2 * scale);
-	    }
-	  else if (fabsf (__imag__ x) > FLT_MAX / 4.0f)
-	    {
-	      scale = 1;
-	      if (fabsf (__real__ x) >= 4.0f * FLT_MIN)
-		__real__ x = __scalbnf (__real__ x, -2 * scale);
-	      else
-		__real__ x = 0.0f;
-	      __imag__ x = __scalbnf (__imag__ x, -2 * scale);
-	    }
-	  else if (fabsf (__real__ x) < 2.0f * FLT_MIN
-		   && fabsf (__imag__ x) < 2.0f * FLT_MIN)
-	    {
-	      scale = -((FLT_MANT_DIG + 1) / 2);
-	      __real__ x = __scalbnf (__real__ x, -2 * scale);
-	      __imag__ x = __scalbnf (__imag__ x, -2 * scale);
-	    }
-
-	  d = __ieee754_hypotf (__real__ x, __imag__ x);
-	  /* Use the identity   2  Re res  Im res = Im x
-	     to avoid cancellation error in  d +/- Re x.  */
-	  if (__real__ x > 0)
-	    {
-	      r = __ieee754_sqrtf (0.5f * (d + __real__ x));
-	      if (scale == 1 && fabsf (__imag__ x) < 1.0f)
-		{
-		  /* Avoid possible intermediate underflow.  */
-		  s = __imag__ x / r;
-		  r = __scalbnf (r, scale);
-		  scale = 0;
-		}
-	      else
-		s = 0.5f * (__imag__ x / r);
-	    }
-	  else
-	    {
-	      s = __ieee754_sqrtf (0.5f * (d - __real__ x));
-	      if (scale == 1 && fabsf (__imag__ x) < 1.0f)
-		{
-		  /* Avoid possible intermediate underflow.  */
-		  r = fabsf (__imag__ x / s);
-		  s = __scalbnf (s, scale);
-		  scale = 0;
-		}
-	      else
-		r = fabsf (0.5f * (__imag__ x / s));
-	    }
-
-	  if (scale)
-	    {
-	      r = __scalbnf (r, scale);
-	      s = __scalbnf (s, scale);
-	    }
-
-	  math_check_force_underflow (r);
-	  math_check_force_underflow (s);
-
-	  __real__ res = r;
-	  __imag__ res = __copysignf (s, __imag__ x);
-	}
-    }
-
-  return res;
-}
-#ifndef __csqrtf
-weak_alias (__csqrtf, csqrtf)
-#endif
diff --git a/math/s_csqrtl.c b/math/s_csqrtl.c
deleted file mode 100644
index b0b52a565c..0000000000
--- a/math/s_csqrtl.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Complex square root of long double value.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
-   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 <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ long double
-__csqrtl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VALL;
-	  __imag__ res = __imag__ x;
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = icls == FP_NAN ? __nanl ("") : 0;
-	      __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = __real__ x;
-	      __imag__ res = (icls == FP_NAN
-			      ? __nanl ("") : __copysignl (0.0, __imag__ x));
-	    }
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else
-    {
-      if (__glibc_unlikely (icls == FP_ZERO))
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = 0.0;
-	      __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x),
-					  __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = fabsl (__ieee754_sqrtl (__real__ x));
-	      __imag__ res = __copysignl (0.0, __imag__ x);
-	    }
-	}
-      else if (__glibc_unlikely (rcls == FP_ZERO))
-	{
-	  long double r;
-	  if (fabsl (__imag__ x) >= 2.0L * LDBL_MIN)
-	    r = __ieee754_sqrtl (0.5L * fabsl (__imag__ x));
-	  else
-	    r = 0.5L * __ieee754_sqrtl (2.0L * fabsl (__imag__ x));
-
-	  __real__ res = r;
-	  __imag__ res = __copysignl (r, __imag__ x);
-	}
-      else
-	{
-	  long double d, r, s;
-	  int scale = 0;
-
-	  if (fabsl (__real__ x) > LDBL_MAX / 4.0L)
-	    {
-	      scale = 1;
-	      __real__ x = __scalbnl (__real__ x, -2 * scale);
-	      __imag__ x = __scalbnl (__imag__ x, -2 * scale);
-	    }
-	  else if (fabsl (__imag__ x) > LDBL_MAX / 4.0L)
-	    {
-	      scale = 1;
-	      if (fabsl (__real__ x) >= 4.0L * LDBL_MIN)
-		__real__ x = __scalbnl (__real__ x, -2 * scale);
-	      else
-		__real__ x = 0.0L;
-	      __imag__ x = __scalbnl (__imag__ x, -2 * scale);
-	    }
-	  else if (fabsl (__real__ x) < 2.0L * LDBL_MIN
-		   && fabsl (__imag__ x) < 2.0L * LDBL_MIN)
-	    {
-	      scale = -((LDBL_MANT_DIG + 1) / 2);
-	      __real__ x = __scalbnl (__real__ x, -2 * scale);
-	      __imag__ x = __scalbnl (__imag__ x, -2 * scale);
-	    }
-
-	  d = __ieee754_hypotl (__real__ x, __imag__ x);
-	  /* Use the identity   2  Re res  Im res = Im x
-	     to avoid cancellation error in  d +/- Re x.  */
-	  if (__real__ x > 0)
-	    {
-	      r = __ieee754_sqrtl (0.5L * (d + __real__ x));
-	      if (scale == 1 && fabsl (__imag__ x) < 1.0L)
-		{
-		  /* Avoid possible intermediate underflow.  */
-		  s = __imag__ x / r;
-		  r = __scalbnl (r, scale);
-		  scale = 0;
-		}
-	      else
-		s = 0.5L * (__imag__ x / r);
-	    }
-	  else
-	    {
-	      s = __ieee754_sqrtl (0.5L * (d - __real__ x));
-	      if (scale == 1 && fabsl (__imag__ x) < 1.0L)
-		{
-		  /* Avoid possible intermediate underflow.  */
-		  r = fabsl (__imag__ x / s);
-		  s = __scalbnl (s, scale);
-		  scale = 0;
-		}
-	      else
-		r = fabsl (0.5L * (__imag__ x / s));
-	    }
-
-	  if (scale)
-	    {
-	      r = __scalbnl (r, scale);
-	      s = __scalbnl (s, scale);
-	    }
-
-	  math_check_force_underflow (r);
-	  math_check_force_underflow (s);
-
-	  __real__ res = r;
-	  __imag__ res = __copysignl (s, __imag__ x);
-	}
-    }
-
-  return res;
-}
-weak_alias (__csqrtl, csqrtl)
diff --git a/sysdeps/alpha/fpu/s_cexpf.c b/sysdeps/alpha/fpu/s_cexpf.c
index 2ae519c687..d5b53eb5f6 100644
--- a/sysdeps/alpha/fpu/s_cexpf.c
+++ b/sysdeps/alpha/fpu/s_cexpf.c
@@ -24,14 +24,18 @@
 
 #undef __cexpf
 #undef cexpf
-#define __cexpf internal_cexpf
 
 static _Complex float internal_cexpf (_Complex float x);
 
-#include <math/s_cexpf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_cexpf
+#include <math-type-macros-float.h>
 
-#undef __cexpf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_cexp_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_cexpf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_clog10f.c b/sysdeps/alpha/fpu/s_clog10f.c
index 1ab0730e0e..c46f28819c 100644
--- a/sysdeps/alpha/fpu/s_clog10f.c
+++ b/sysdeps/alpha/fpu/s_clog10f.c
@@ -24,14 +24,18 @@
 
 #undef __clog10f
 #undef clog10f
-#define __clog10f internal_clog10f
 
 static _Complex float internal_clog10f (_Complex float x);
 
-#include <math/s_clog10f.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_clog10f
+#include <math-type-macros-float.h>
 
-#undef __clog10f
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_clog10_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_clog10f (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_clogf.c b/sysdeps/alpha/fpu/s_clogf.c
index 185948f650..492a305c03 100644
--- a/sysdeps/alpha/fpu/s_clogf.c
+++ b/sysdeps/alpha/fpu/s_clogf.c
@@ -24,14 +24,18 @@
 
 #undef __clogf
 #undef clogf
-#define __clogf internal_clogf
 
 static _Complex float internal_clogf (_Complex float x);
 
-#include <math/s_clogf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_clogf
+#include <math-type-macros-float.h>
 
-#undef __clogf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_clog_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_clogf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_cpowf.c b/sysdeps/alpha/fpu/s_cpowf.c
index 686c3971f9..4235fe2993 100644
--- a/sysdeps/alpha/fpu/s_cpowf.c
+++ b/sysdeps/alpha/fpu/s_cpowf.c
@@ -24,14 +24,18 @@
 
 #undef __cpowf
 #undef cpowf
-#define __cpowf internal_cpowf
 
 static _Complex float internal_cpowf (_Complex float x, _Complex float c);
 
-#include <math/s_cpowf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_cpowf
+#include <math-type-macros-float.h>
 
-#undef __cpowf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_cpow_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_cpowf (c1_cfloat_decl (x), c1_cfloat_decl (c))
diff --git a/sysdeps/alpha/fpu/s_cprojf.c b/sysdeps/alpha/fpu/s_cprojf.c
index 30a24a8910..3c4e9e918c 100644
--- a/sysdeps/alpha/fpu/s_cprojf.c
+++ b/sysdeps/alpha/fpu/s_cprojf.c
@@ -24,14 +24,18 @@
 
 #undef __cprojf
 #undef cprojf
-#define __cprojf internal_cprojf
 
 static _Complex float internal_cprojf (_Complex float x);
 
-#include <math/s_cprojf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_cprojf
+#include <math-type-macros-float.h>
 
-#undef __cprojf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_cproj_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_cprojf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_csqrtf.c b/sysdeps/alpha/fpu/s_csqrtf.c
index c7a18d75d7..d2f32b9ff0 100644
--- a/sysdeps/alpha/fpu/s_csqrtf.c
+++ b/sysdeps/alpha/fpu/s_csqrtf.c
@@ -24,14 +24,18 @@
 
 #undef __csqrtf
 #undef csqrtf
-#define __csqrtf internal_csqrtf
 
 static _Complex float internal_csqrtf (_Complex float x);
 
-#include <math/s_csqrtf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_csqrtf
+#include <math-type-macros-float.h>
 
-#undef __csqrtf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_csqrt_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_csqrtf (c1_cfloat_decl (x))
diff --git a/sysdeps/ieee754/ldbl-opt/s_cexp.c b/sysdeps/ieee754/ldbl-opt/s_cexp.c
deleted file mode 100644
index d983c96b7b..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_cexp.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_cexp.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __cexp, cexpl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cexpl.c b/sysdeps/ieee754/ldbl-opt/s_cexpl.c
deleted file mode 100644
index d5ae1fc0d0..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_cexpl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_cexpl.c>
-long_double_symbol (libm, __cexpl, cexpl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog.c b/sysdeps/ieee754/ldbl-opt/s_clog.c
deleted file mode 100644
index 3e0e90cf89..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_clog.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_clog.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __clog, clogl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10.c b/sysdeps/ieee754/ldbl-opt/s_clog10.c
deleted file mode 100644
index ac3f4a3a71..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_clog10.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_clog10.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __clog10, __clog10l, GLIBC_2_1);
-compat_symbol (libm, clog10, clog10l, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10l.c b/sysdeps/ieee754/ldbl-opt/s_clog10l.c
index 954f68095a..6ebd6dd72d 100644
--- a/sysdeps/ieee754/ldbl-opt/s_clog10l.c
+++ b/sysdeps/ieee754/ldbl-opt/s_clog10l.c
@@ -1,10 +1,31 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#define __clog10l __clog10l_internal
-#include <math/s_clog10l.c>
-#undef __clog10l
+/* clog10l alias overrides for platforms where long double
+   was previously not unique.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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/>.  */
+
+#define M_DECL_FUNC(x) __clog10l_internal
+#include <math-type-macros-ldouble.h>
+
+#undef declare_mgen_alias
+#define declare_mgen_alias(from, to)
+
+#include <s_clog10_template.c>
+
+/* __clog10l is also a public symbol.  */
 strong_alias (__clog10l_internal, __clog10l__internal)
 long_double_symbol (libm, __clog10l_internal, __clog10l);
 long_double_symbol (libm, __clog10l__internal, clog10l);
diff --git a/sysdeps/ieee754/ldbl-opt/s_clogl.c b/sysdeps/ieee754/ldbl-opt/s_clogl.c
deleted file mode 100644
index 75126c8b89..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_clogl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_clogl.c>
-long_double_symbol (libm, __clogl, clogl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cpow.c b/sysdeps/ieee754/ldbl-opt/s_cpow.c
deleted file mode 100644
index 4801d7cdf9..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_cpow.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_cpow.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __cpow, cpowl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cpowl.c b/sysdeps/ieee754/ldbl-opt/s_cpowl.c
deleted file mode 100644
index 61840e3381..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_cpowl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_cpowl.c>
-long_double_symbol (libm, __cpowl, cpowl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cproj.c b/sysdeps/ieee754/ldbl-opt/s_cproj.c
deleted file mode 100644
index f298c3795a..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_cproj.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_cproj.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __cproj, cprojl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cprojl.c b/sysdeps/ieee754/ldbl-opt/s_cprojl.c
deleted file mode 100644
index 1cc058007e..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_cprojl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_cprojl.c>
-long_double_symbol (libm, __cprojl, cprojl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrt.c b/sysdeps/ieee754/ldbl-opt/s_csqrt.c
deleted file mode 100644
index 2b6dcfe010..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_csqrt.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_csqrt.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __csqrt, csqrtl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrtl.c b/sysdeps/ieee754/ldbl-opt/s_csqrtl.c
deleted file mode 100644
index 045ff93e43..0000000000
--- a/sysdeps/ieee754/ldbl-opt/s_csqrtl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_csqrtl.c>
-long_double_symbol (libm, __csqrtl, csqrtl);
diff --git a/sysdeps/m68k/m680x0/fpu/s_cexp.c b/sysdeps/m68k/m680x0/fpu/s_cexp_template.c
index f715b77d2d..828ac6c9e9 100644
--- a/sysdeps/m68k/m680x0/fpu/s_cexp.c
+++ b/sysdeps/m68k/m680x0/fpu/s_cexp_template.c
@@ -22,21 +22,14 @@
 #include <math.h>
 #include "mathimpl.h"
 
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
 #define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
+#define s(name) M_SUF (name)
 #define m81(func) __m81_u(s(func))
 
-__complex__ float_type
-s(__cexp) (__complex__ float_type x)
+CFLOAT
+s(__cexp) (CFLOAT x)
 {
-  __complex__ float_type retval;
+  CFLOAT retval;
   unsigned long ix_cond;
 
   ix_cond = __m81_test (__imag__ x);
diff --git a/sysdeps/m68k/m680x0/fpu/s_cexpf.c b/sysdeps/m68k/m680x0/fpu/s_cexpf.c
deleted file mode 100644
index 177a360f9b..0000000000
--- a/sysdeps/m68k/m680x0/fpu/s_cexpf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_cexp.c>
diff --git a/sysdeps/m68k/m680x0/fpu/s_cexpl.c b/sysdeps/m68k/m680x0/fpu/s_cexpl.c
deleted file mode 100644
index bbda4ba990..0000000000
--- a/sysdeps/m68k/m680x0/fpu/s_cexpl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_cexp.c>