[03/12] Add a generic scalb implementation

Message ID 20180620020426.20372-4-tuliom@linux.ibm.com
State Superseded
Delegated to: Joseph Myers
Headers

Commit Message

Tulio Magno Quites Machado Filho June 20, 2018, 2:04 a.m. UTC
  Create templates for e_scabl, w_scalb and w_scalb_compat.

2018-06-19  Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>

	* math/Makefile (libm-calls): Move e_scalbF to...
	(gen-libm-calls): ... here and add w_scalbF_compat.
	* math/e_scalb.c: Removed.
	* math/e_scalbf.c: Removed.
	* math/e_scalbl.c: Removed.
	* math/w_scalb_compat.c: Removed.
	* math/w_scalbf_compat.c: Removed.
	* math/e_scalb_template.c: New file.
	* math/w_scalb_compat_template.c: New file.
	* math/w_scalb_template.c: New file.
	* math/w_scalbl_compat.c: Removed.
	* sysdeps/generic/math-type-macros-double.h: Define M_K_STANDARD.
	* sysdeps/generic/math-type-macros-float.h: Likewise.
	* sysdeps/generic/math-type-macros-ldouble.h: Likewise.
	* sysdeps/ieee754/float128/w_scalbf128.c: New file without contents.
	* sysdeps/ieee754/float128/w_scalbf128_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_scalb_compat.c: Removed.
	* sysdeps/ieee754/ldbl-opt/w_scalbl_compat.c: Removed.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
---
 math/Makefile                                      |  7 +-
 math/{e_scalb.c => e_scalb_template.c}             | 32 ++++-----
 math/e_scalbf.c                                    | 54 ---------------
 math/e_scalbl.c                                    | 54 ---------------
 ...{w_scalb_compat.c => w_scalb_compat_template.c} | 36 ++++------
 math/{w_scalbf_compat.c => w_scalb_template.c}     | 54 +++++----------
 math/w_scalbl_compat.c                             | 81 ----------------------
 sysdeps/generic/math-type-macros-double.h          |  1 +
 sysdeps/generic/math-type-macros-float.h           |  1 +
 sysdeps/generic/math-type-macros-ldouble.h         |  1 +
 sysdeps/ieee754/float128/w_scalbf128.c             |  1 +
 sysdeps/ieee754/float128/w_scalbf128_compat.c      |  1 +
 sysdeps/ieee754/ldbl-opt/w_scalb_compat.c          |  5 --
 sysdeps/ieee754/ldbl-opt/w_scalbl_compat.c         |  5 --
 14 files changed, 56 insertions(+), 277 deletions(-)
 rename math/{e_scalb.c => e_scalb_template.c} (64%)
 delete mode 100644 math/e_scalbf.c
 delete mode 100644 math/e_scalbl.c
 rename math/{w_scalb_compat.c => w_scalb_compat_template.c} (69%)
 rename math/{w_scalbf_compat.c => w_scalb_template.c} (53%)
 delete mode 100644 math/w_scalbl_compat.c
 create mode 100644 sysdeps/ieee754/float128/w_scalbf128.c
 create mode 100644 sysdeps/ieee754/float128/w_scalbf128_compat.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/w_scalb_compat.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/w_scalbl_compat.c
  

Comments

Joseph Myers June 20, 2018, 8:32 p.m. UTC | #1
On Tue, 19 Jun 2018, Tulio Magno Quites Machado Filho wrote:

> Create templates for e_scabl, w_scalb and w_scalb_compat.

I don't think w_scalb_compat should become a template, just a new w_scalb 
(with the compat files having all their contents become conditional on 
LIBM_SVID_COMPAT).  Then you don't need to do anything with M_K_STANDARD, 
because __kernel_standard is only used in compat files (and note the 
arguments passed to it are different numbers for float / double / long 
double, so M_K_STANDARD in this patch isn't actually correct).  And 
w_scalbF_compat would stay in libm-compat-calls, so no empty float128 
version would be needed (whereas an empty float128 version of w_scalb 
would be needed).
  
Tulio Magno Quites Machado Filho June 20, 2018, 10:19 p.m. UTC | #2
Joseph Myers <joseph@codesourcery.com> writes:

> On Tue, 19 Jun 2018, Tulio Magno Quites Machado Filho wrote:
>
>> Create templates for e_scabl, w_scalb and w_scalb_compat.
>
> I don't think w_scalb_compat should become a template,

Ack.

> just a new w_scalb (with the compat files having all their contents become
> conditional on LIBM_SVID_COMPAT).

float, double and long double define __USE_WRAPPER_TEMPLATE as:
#define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT

So, I guess the current code is already covering this part.
Am I missing something?

> Then you don't need to do anything with M_K_STANDARD, 
> because __kernel_standard is only used in compat files (and note the 
> arguments passed to it are different numbers for float / double / long 
> double, so M_K_STANDARD in this patch isn't actually correct).  And 
> w_scalbF_compat would stay in libm-compat-calls, so no empty float128 
> version would be needed (whereas an empty float128 version of w_scalb 
> would be needed).

Agreed.
  
Joseph Myers June 20, 2018, 10:23 p.m. UTC | #3
On Wed, 20 Jun 2018, Tulio Magno Quites Machado Filho wrote:

> > just a new w_scalb (with the compat files having all their contents become
> > conditional on LIBM_SVID_COMPAT).
> 
> float, double and long double define __USE_WRAPPER_TEMPLATE as:
> #define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
> 
> So, I guess the current code is already covering this part.
> Am I missing something?

At present, w_scalb_compat is used both for shared and static libm, for 
both old and new ports.

The proposed state is it would become more like the other w_*_compat 
files, which only build any code for shared libm for old ports - all the 
code in the files would be conditional on LIBM_SVID_COMPAT, so that static 
libm and new ports would end up using w_scalb instead (as would float128).
  

Patch

diff --git a/math/Makefile b/math/Makefile
index 335b1fb197..e5d9ab7013 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -48,7 +48,7 @@  libm-support = s_lib_version s_matherr s_signgam			\
 
 # Wrappers for these functions generated per type using a file named
 # <func>_template.c and the appropriate math-type-macros-<TYPE>.h.
-gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF		  \
+gen-libm-calls = cargF conjF cimagF crealF cabsF e_scalbF s_cacosF	  \
 	         s_cacoshF s_ccosF s_ccoshF s_casinF s_csinF s_casinhF	  \
 		 k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \
 		 s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF	  \
@@ -57,13 +57,14 @@  gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF		  \
 		 w_log1pF w_scalblnF s_fmaxmagF s_fminmagF w_acosF	  \
 		 w_acoshF w_asinF w_atan2F w_atanhF w_coshF w_exp10F	  \
 		 w_exp2F w_fmodF w_hypotF w_j0F w_j1F w_jnF w_logF	  \
-		 w_log10F w_log2F w_powF w_remainderF w_sinhF w_sqrtF	  \
+		 w_log10F w_log2F w_powF w_remainderF w_scalbF		  \
+		 w_scalbF_compat w_sinhF w_sqrtF			  \
 		 w_tgammaF w_lgammaF w_lgammaF_r w_expF e_exp2F
 
 libm-calls =								  \
 	e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
 	e_hypotF e_j0F e_j1F e_jnF e_lgammaF_r e_logF e_log10F e_powF	  \
-	e_rem_pio2F e_remainderF e_scalbF e_sinhF e_sqrtF e_gammaF_r	  \
+	e_rem_pio2F e_remainderF e_sinhF e_sqrtF e_gammaF_r		  \
 	e_ilogbF							  \
 	k_cosF k_sinF k_tanF s_asinhF s_atanF s_cbrtF			  \
 	s_ceilF s_cosF s_erfF s_expm1F s_fabsF				  \
diff --git a/math/e_scalb.c b/math/e_scalb_template.c
similarity index 64%
rename from math/e_scalb.c
rename to math/e_scalb_template.c
index 96c3579aad..02663424a7 100644
--- a/math/e_scalb.c
+++ b/math/e_scalb_template.c
@@ -1,6 +1,6 @@ 
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
+/* Multiply by integral power of radix.
+   Copyright (C) 2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -19,36 +19,36 @@ 
 #include <math.h>
 #include <math_private.h>
 
-
-static double
+static FLOAT
 __attribute__ ((noinline))
-invalid_fn (double x, double fn)
+invalid_fn (FLOAT x, FLOAT fn)
 {
-  if (__rint (fn) != fn)
+  if (M_SUF (__rint) (fn) != fn)
     return (fn - fn) / (fn - fn);
-  else if (fn > 65000.0)
-    return __scalbn (x, 65000);
+  else if (fn > M_LIT (65000.0))
+    return M_SUF (__scalbn) (x, 65000);
   else
-    return __scalbn (x,-65000);
+    return M_SUF (__scalbn) (x,-65000);
 }
 
 
-double
-__ieee754_scalb (double x, double fn)
+FLOAT
+M_DECL_FUNC (__ieee754_scalb) (FLOAT x, FLOAT fn)
 {
   if (__glibc_unlikely (isnan (x)))
     return x * fn;
   if (__glibc_unlikely (!isfinite (fn)))
     {
-      if (isnan (fn) || fn > 0.0)
+      if (isnan (fn) || fn > M_LIT (0.0))
 	return x * fn;
-      if (x == 0.0)
+      if (x == M_LIT (0.0))
 	return x;
       return x / -fn;
     }
-  if (__glibc_unlikely (fabs (fn) >= 0x1p31 || (double) (int) fn != fn))
+  if (__glibc_unlikely (M_FABS (fn) >= M_LIT (0x1p31)
+			|| (FLOAT) (int) fn != fn))
     return invalid_fn (x, fn);
 
-  return __scalbn (x, (int) fn);
+  return M_SCALBN (x, (int) fn);
 }
-strong_alias (__ieee754_scalb, __scalb_finite)
+declare_mgen_finite_alias (__ieee754_scalb, __scalb)
diff --git a/math/e_scalbf.c b/math/e_scalbf.c
deleted file mode 100644
index 23b38a95de..0000000000
--- a/math/e_scalbf.c
+++ /dev/null
@@ -1,54 +0,0 @@ 
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <math_private.h>
-
-
-static float
-__attribute__ ((noinline))
-invalid_fn (float x, float fn)
-{
-  if (__rintf (fn) != fn)
-    return (fn - fn) / (fn - fn);
-  else if (fn > 65000.0f)
-    return __scalbnf (x, 65000);
-  else
-    return __scalbnf (x,-65000);
-}
-
-
-float
-__ieee754_scalbf (float x, float fn)
-{
-  if (__glibc_unlikely (isnan (x)))
-    return x * fn;
-  if (__glibc_unlikely (!isfinite (fn)))
-    {
-      if (isnan (fn) || fn > 0.0f)
-	return x * fn;
-      if (x == 0.0f)
-	return x;
-      return x / -fn;
-    }
-  if (__glibc_unlikely (fabsf (fn) >= 0x1p31f || (float) (int) fn != fn))
-    return invalid_fn (x, fn);
-
-  return __scalbnf (x, (int) fn);
-}
-strong_alias (__ieee754_scalbf, __scalbf_finite)
diff --git a/math/e_scalbl.c b/math/e_scalbl.c
deleted file mode 100644
index a677d06b9f..0000000000
--- a/math/e_scalbl.c
+++ /dev/null
@@ -1,54 +0,0 @@ 
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <math_private.h>
-
-
-static long double
-__attribute__ ((noinline))
-invalid_fn (long double x, long double fn)
-{
-  if (__rintl (fn) != fn)
-    return (fn - fn) / (fn - fn);
-  else if (fn > 65000.0L)
-    return __scalbnl (x, 65000);
-  else
-    return __scalbnl (x,-65000);
-}
-
-
-long double
-__ieee754_scalbl (long double x, long double fn)
-{
-  if (__glibc_unlikely (isnan (x)))
-    return x * fn;
-  if (__glibc_unlikely (!isfinite (fn)))
-    {
-      if (isnan (fn) || fn > 0.0L)
-	return x * fn;
-      if (x == 0.0L)
-	return x;
-      return x / -fn;
-    }
-  if (__glibc_unlikely (fabsl (fn) >= 0x1p31L || (long double) (int) fn != fn))
-    return invalid_fn (x, fn);
-
-  return __scalbnl (x, (int) fn);
-}
-strong_alias (__ieee754_scalbl, __scalbl_finite)
diff --git a/math/w_scalb_compat.c b/math/w_scalb_compat_template.c
similarity index 69%
rename from math/w_scalb_compat.c
rename to math/w_scalb_compat_template.c
index 5e57db4a9f..ba69aca017 100644
--- a/math/w_scalb_compat.c
+++ b/math/w_scalb_compat_template.c
@@ -1,6 +1,5 @@ 
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -21,40 +20,37 @@ 
 #include <math_private.h>
 #include <math-svid-compat.h>
 
-
 #if LIBM_SVID_COMPAT
-static double
+
+static FLOAT
 __attribute__ ((noinline))
-sysv_scalb (double x, double fn)
+M_DECL_FUNC (sysv_scalb) (FLOAT x, FLOAT fn)
 {
-  double z = __ieee754_scalb (x, fn);
+  FLOAT z = M_SUF (__ieee754_scalb) (x, fn);
 
   if (__glibc_unlikely (isinf (z)))
     {
       if (isfinite (x))
-	return __kernel_standard (x, fn, 32); /* scalb overflow */
+	return M_K_STANDARD (x, fn, 32); /* scalb overflow */
       else
 	__set_errno (ERANGE);
     }
-  else if (__builtin_expect (z == 0.0, 0) && z != x)
-    return __kernel_standard (x, fn, 33); /* scalb underflow */
+  else if (__builtin_expect (z == M_LIT (0.0), 0) && z != x)
+    return M_K_STANDARD (x, fn, 33); /* scalb underflow */
 
   return z;
 }
-#endif
 
 
 /* Wrapper scalb */
-double
-__scalb (double x, double fn)
+FLOAT
+M_DECL_FUNC (__scalb) (FLOAT x, FLOAT fn)
 {
-#if LIBM_SVID_COMPAT
   if (__glibc_unlikely (_LIB_VERSION == _SVID_))
-    return sysv_scalb (x, fn);
+    return M_SUF (sysv_scalb) (x, fn);
   else
-#endif
     {
-      double z = __ieee754_scalb (x, fn);
+      FLOAT z = M_SUF (__ieee754_scalb) (x, fn);
 
       if (__glibc_unlikely (!isfinite (z) || z == 0.0))
 	{
@@ -78,8 +74,6 @@  __scalb (double x, double fn)
       return z;
     }
 }
-weak_alias (__scalb, scalb)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__scalb, __scalbl)
-weak_alias (__scalb, scalbl)
-#endif
+declare_mgen_alias (__scalb, scalb);
+
+#endif /* __LIBM_SVID_COMPAT.  */
diff --git a/math/w_scalbf_compat.c b/math/w_scalb_template.c
similarity index 53%
rename from math/w_scalbf_compat.c
rename to math/w_scalb_template.c
index 7e35a66f43..b2aafcdf36 100644
--- a/math/w_scalbf_compat.c
+++ b/math/w_scalb_template.c
@@ -1,6 +1,6 @@ 
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
+/* Wrapper to set errno for scalb.
+   Copyright (C) 2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,47 +16,23 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+/* Only build wrappers from the templates for the types that define the macro
+   below.  This macro is set in math-type-macros-<type>.h in sysdeps/generic
+   for each floating-point type.  */
+#if __USE_WRAPPER_TEMPLATE
+
 #include <errno.h>
 #include <math.h>
 #include <math_private.h>
-#include <math-svid-compat.h>
-
 
-#if LIBM_SVID_COMPAT
-static float
-__attribute__ ((noinline))
-sysv_scalbf (float x, float fn)
+/* Wrapper scalb */
+FLOAT
+M_DECL_FUNC (__scalb) (FLOAT x, FLOAT fn)
 {
-  float z = __ieee754_scalbf (x, fn);
-
-  if (__glibc_unlikely (isinf (z)))
     {
-      if (isfinite (x))
-	return __kernel_standard_f (x, fn, 132); /* scalb overflow */
-      else
-	__set_errno (ERANGE);
-    }
-  else if (__builtin_expect (z == 0.0f, 0) && z != x)
-    return __kernel_standard_f (x, fn, 133); /* scalb underflow */
-
-  return z;
-}
-#endif
+      FLOAT z = M_SUF (__ieee754_scalb) (x, fn);
 
-
-/* Wrapper scalbf */
-float
-__scalbf (float x, float fn)
-{
-#if LIBM_SVID_COMPAT
-  if (__glibc_unlikely (_LIB_VERSION == _SVID_))
-    return sysv_scalbf (x, fn);
-  else
-#endif
-    {
-      float z = __ieee754_scalbf (x, fn);
-
-      if (__glibc_unlikely (!isfinite (z) || z == 0.0f))
+      if (__glibc_unlikely (!isfinite (z) || z == M_LIT (0.0)))
 	{
 	  if (isnan (z))
 	    {
@@ -71,11 +47,13 @@  __scalbf (float x, float fn)
 	  else
 	    {
 	      /* z == 0.  */
-	      if (x != 0.0f && !isinf (fn))
+	      if (x != M_LIT (0.0) && !isinf (fn))
 		__set_errno (ERANGE);
 	    }
 	}
       return z;
     }
 }
-weak_alias (__scalbf, scalbf)
+declare_mgen_alias (__scalb, scalb);
+
+#endif /* __USE_WRAPPER_TEMPLATE.  */
diff --git a/math/w_scalbl_compat.c b/math/w_scalbl_compat.c
deleted file mode 100644
index 658b081f91..0000000000
--- a/math/w_scalbl_compat.c
+++ /dev/null
@@ -1,81 +0,0 @@ 
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-
-   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 <errno.h>
-#include <math.h>
-#include <math_private.h>
-#include <math-svid-compat.h>
-
-
-#if LIBM_SVID_COMPAT
-static long double
-__attribute__ ((noinline))
-sysv_scalbl (long double x, long double fn)
-{
-  long double z = __ieee754_scalbl (x, fn);
-
-  if (__glibc_unlikely (isinf (z)))
-    {
-      if (isfinite (x))
-	return __kernel_standard_l (x, fn, 232); /* scalb overflow */
-      else
-	__set_errno (ERANGE);
-    }
-  else if (__builtin_expect (z == 0.0L, 0) && z != x)
-    return __kernel_standard_l (x, fn, 233); /* scalb underflow */
-
-  return z;
-}
-#endif
-
-
-/* Wrapper scalbl */
-long double
-__scalbl (long double x, long double fn)
-{
-#if LIBM_SVID_COMPAT
-  if (__glibc_unlikely (_LIB_VERSION == _SVID_))
-    return sysv_scalbl (x, fn);
-  else
-#endif
-    {
-      long double z = __ieee754_scalbl (x, fn);
-
-      if (__glibc_unlikely (!isfinite (z) || z == 0.0L))
-	{
-	  if (isnan (z))
-	    {
-	      if (!isnan (x) && !isnan (fn))
-		__set_errno (EDOM);
-	    }
-	  else if (isinf (z))
-	    {
-	      if (!isinf (x) && !isinf (fn))
-		__set_errno (ERANGE);
-	    }
-	  else
-	    {
-	      /* z == 0.  */
-	      if (x != 0.0L && !isinf (fn))
-		__set_errno (ERANGE);
-	    }
-	}
-      return z;
-    }
-}
-weak_alias (__scalbl, scalbl)
diff --git a/sysdeps/generic/math-type-macros-double.h b/sysdeps/generic/math-type-macros-double.h
index be5d94488f..dfd0919b71 100644
--- a/sysdeps/generic/math-type-macros-double.h
+++ b/sysdeps/generic/math-type-macros-double.h
@@ -26,6 +26,7 @@ 
 #define FLOAT double
 #define CFLOAT _Complex double
 #define M_STRTO_NAN __strtod_nan
+#define M_K_STANDARD __kernel_standard
 
 #include <libm-alias-double.h>
 #include <math-nan-payload-double.h>
diff --git a/sysdeps/generic/math-type-macros-float.h b/sysdeps/generic/math-type-macros-float.h
index 1f280950cd..72b30171fa 100644
--- a/sysdeps/generic/math-type-macros-float.h
+++ b/sysdeps/generic/math-type-macros-float.h
@@ -25,6 +25,7 @@ 
 #define FLOAT float
 #define CFLOAT _Complex float
 #define M_STRTO_NAN __strtof_nan
+#define M_K_STANDARD __kernel_standard_f
 
 /* Standard/GNU macro literals do not exist for the float type.  Use
    the double macro constants.  */
diff --git a/sysdeps/generic/math-type-macros-ldouble.h b/sysdeps/generic/math-type-macros-ldouble.h
index 300dd18f94..ef0a1e5b99 100644
--- a/sysdeps/generic/math-type-macros-ldouble.h
+++ b/sysdeps/generic/math-type-macros-ldouble.h
@@ -26,6 +26,7 @@ 
 #define FLOAT long double
 #define CFLOAT _Complex long double
 #define M_STRTO_NAN __strtold_nan
+#define M_K_STANDARD __kernel_standard_l
 
 #include <libm-alias-ldouble.h>
 #include <math-nan-payload-ldouble.h>
diff --git a/sysdeps/ieee754/float128/w_scalbf128.c b/sysdeps/ieee754/float128/w_scalbf128.c
new file mode 100644
index 0000000000..067b724164
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_scalbf128.c
@@ -0,0 +1 @@ 
+/* Not defined for _FloatN types.  */
diff --git a/sysdeps/ieee754/float128/w_scalbf128_compat.c b/sysdeps/ieee754/float128/w_scalbf128_compat.c
new file mode 100644
index 0000000000..067b724164
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_scalbf128_compat.c
@@ -0,0 +1 @@ 
+/* Not defined for _FloatN types.  */
diff --git a/sysdeps/ieee754/ldbl-opt/w_scalb_compat.c b/sysdeps/ieee754/ldbl-opt/w_scalb_compat.c
deleted file mode 100644
index f6d53a5ba5..0000000000
--- a/sysdeps/ieee754/ldbl-opt/w_scalb_compat.c
+++ /dev/null
@@ -1,5 +0,0 @@ 
-#include <math_ldbl_opt.h>
-#include <math/w_scalb_compat.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
-compat_symbol (libm, __scalb, scalbl, GLIBC_2_0);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_scalbl_compat.c b/sysdeps/ieee754/ldbl-opt/w_scalbl_compat.c
deleted file mode 100644
index c8feb654a2..0000000000
--- a/sysdeps/ieee754/ldbl-opt/w_scalbl_compat.c
+++ /dev/null
@@ -1,5 +0,0 @@ 
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/w_scalbl_compat.c>
-long_double_symbol (libm, __scalbl, scalbl);