[6/9] Remove the error handling wrapper from exp and exp2

Message ID ce8e8af6-8fc3-06e8-cba1-ead045382acc@arm.com
State New, archived
Headers

Commit Message

Szabolcs Nagy June 29, 2018, 12:54 p.m. UTC
  Introduce new exp and exp2 symbol version that don't do SVID compatible
error handling.  The standard errno and fp exception based error handling
is inline in the new code and does not have significant overhead (only
affects uncommon special case code paths).

The wrappers are disabled for sysdeps/ieee754/dbl-64 by using empty w_
files and the template is enabled on targets that have their own exp
and exp2 implementations or use ifunc on glibc internal __ieee754_exp
symbol using w_ files from the math directory.

The _finite symbols are just aliases to the standard symbols (they have
no performance advantage anymore).  For backward compatibility the old
symbol versions still use the wrapper with SVID error handling around
the new code.

The ia64 asm is chaned so the compat and new symbol versions map to the
same address.

On x86_64 #include <math.h> was added before macro definitions that
may affect that header.

2018-06-29  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* math/Versions (GLIBC_2.28): Add exp and exp2.
	* math/w_exp2_compat.c (__exp2_compat): Change to versioned compat
	symbol.
	* math/w_exp_compat.c (__exp_compat): Likewise.
	* math/w_exp.c: New file.
	* math/w_exp2.c: New file.
	* sysdeps/i386/fpu/w_exp.c: New file.
	* sysdeps/i386/fpu/w_exp2.c: New file.
	* sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Rename to __exp
	and add necessary aliases.
	* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Rename to __exp2
	and add necessary aliases.
	* sysdeps/ieee754/dbl-64/w_exp.c: New file.
	* sysdeps/ieee754/dbl-64/w_exp2.c: New file.
	* sysdeps/ia64/fpu/e_exp.S: Add versioned symbols.
	* sysdeps/ia64/fpu/e_exp2.S: Likewise.
	* sysdeps/m68k/m680x0/fpu/w_exp.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_exp2.c: New file.
	* sysdeps/mach/hurd/i386/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Update.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Update.
	* sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__exp1): Remove.
	(__ieee754_exp): Rename to __exp.
	* sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__exp1): Remove.
	(__ieee754_exp): Rename to __exp.
	* sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__exp1): Remove.
	(__ieee754_exp): Rename to __exp.
	* sysdeps/x86_64/fpu/multiarch/e_exp.c (__ieee754_exp): Rename to
	__exp.
	* sysdeps/x86_64/fpu/multiarch/w_exp.c: New file.
---
  math/Versions                                                |  2 ++
  math/w_exp.c                                                 |  8 ++++++++
  math/w_exp2.c                                                |  8 ++++++++
  math/w_exp2_compat.c                                         |  6 +++---
  math/w_exp_compat.c                                          |  7 +++----
  sysdeps/i386/fpu/w_exp.c                                     |  1 +
  sysdeps/i386/fpu/w_exp2.c                                    |  1 +
  sysdeps/ia64/fpu/e_exp.S                                     |  6 ++++++
  sysdeps/ia64/fpu/e_exp2.S                                    |  6 ++++++
  sysdeps/ieee754/dbl-64/e_exp.c                               | 12 +++++++++---
  sysdeps/ieee754/dbl-64/e_exp2.c                              | 11 ++++++++---
  sysdeps/ieee754/dbl-64/w_exp.c                               |  1 +
  sysdeps/ieee754/dbl-64/w_exp2.c                              |  1 +
  sysdeps/m68k/m680x0/fpu/w_exp.c                              |  1 +
  sysdeps/m68k/m680x0/fpu/w_exp2.c                             |  1 +
  sysdeps/mach/hurd/i386/libm.abilist                          |  2 ++
  sysdeps/unix/sysv/linux/aarch64/libm.abilist                 |  2 ++
  sysdeps/unix/sysv/linux/alpha/libm.abilist                   |  2 ++
  sysdeps/unix/sysv/linux/arm/libm.abilist                     |  2 ++
  sysdeps/unix/sysv/linux/hppa/libm.abilist                    |  2 ++
  sysdeps/unix/sysv/linux/i386/libm.abilist                    |  2 ++
  sysdeps/unix/sysv/linux/ia64/libm.abilist                    |  2 ++
  sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist           |  2 ++
  sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist             |  2 ++
  sysdeps/unix/sysv/linux/microblaze/libm.abilist              |  2 ++
  sysdeps/unix/sysv/linux/mips/mips32/libm.abilist             |  2 ++
  sysdeps/unix/sysv/linux/mips/mips64/libm.abilist             |  2 ++
  sysdeps/unix/sysv/linux/nios2/libm.abilist                   |  2 ++
  sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist   |  2 ++
  sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist |  2 ++
  sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist    |  2 ++
  sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist       |  2 ++
  sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist              |  2 ++
  sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist            |  2 ++
  sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist            |  2 ++
  sysdeps/unix/sysv/linux/sh/libm.abilist                      |  2 ++
  sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist           |  2 ++
  sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist           |  2 ++
  sysdeps/unix/sysv/linux/x86_64/64/libm.abilist               |  2 ++
  sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist              |  2 ++
  sysdeps/x86_64/fpu/multiarch/e_exp-avx.c                     |  3 +--
  sysdeps/x86_64/fpu/multiarch/e_exp-fma.c                     |  3 +--
  sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c                    |  3 +--
  sysdeps/x86_64/fpu/multiarch/e_exp.c                         |  4 +++-
  sysdeps/x86_64/fpu/multiarch/w_exp.c                         |  1 +
  45 files changed, 116 insertions(+), 20 deletions(-)
  create mode 100644 math/w_exp.c
  create mode 100644 math/w_exp2.c
  create mode 100644 sysdeps/i386/fpu/w_exp.c
  create mode 100644 sysdeps/i386/fpu/w_exp2.c
  create mode 100644 sysdeps/ieee754/dbl-64/w_exp.c
  create mode 100644 sysdeps/ieee754/dbl-64/w_exp2.c
  create mode 100644 sysdeps/m68k/m680x0/fpu/w_exp.c
  create mode 100644 sysdeps/m68k/m680x0/fpu/w_exp2.c
  create mode 100644 sysdeps/x86_64/fpu/multiarch/w_exp.c
  

Comments

Szabolcs Nagy June 29, 2018, 2:24 p.m. UTC | #1
On 29/06/18 13:54, Szabolcs Nagy wrote:
> diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c
> index 45644e4139..eb78edda14 100644
> --- a/sysdeps/ieee754/dbl-64/e_exp.c
> +++ b/sysdeps/ieee754/dbl-64/e_exp.c
> @@ -20,6 +20,8 @@
>   #include <stdint.h>
>   #include <math-barriers.h>
>   #include <math-narrow-eval.h>
> +#include <shlib-compat.h>
> +#include <libm-alias-double.h>
>   #include "math_config.h"
>   
>   #define N (1 << EXP_TABLE_BITS)
> @@ -89,7 +91,7 @@ top12 (double x)
>   
>   double
>   SECTION
> -__ieee754_exp (double x)
> +__exp (double x)
>   {
>     uint32_t abstop;
>     uint64_t ki, idx, top, sbits;
> @@ -162,6 +164,10 @@ __ieee754_exp (double x)
>        is no spurious underflow here even without fma.  */
>     return scale + scale * tmp;
>   }
> -#ifndef __ieee754_exp
> -strong_alias (__ieee754_exp, __exp_finite)
> +#ifndef __exp
> +hidden_def (__exp)
> +strong_alias (__exp, __ieee754_exp)
> +strong_alias (__exp, __exp_finite)
> +versioned_symbol (libm, __exp, exp, GLIBC_2_28);
> +libm_alias_double_other (__exp, exp)
>   #endif

this should have been libm_alias_double (...) for
targets where long double is the same as double.

will change it (at other places too) and rerun
build-many-glibcs.py with it.
  
Szabolcs Nagy June 29, 2018, 3:50 p.m. UTC | #2
On 29/06/18 15:24, Szabolcs Nagy wrote:
> On 29/06/18 13:54, Szabolcs Nagy wrote:
>> diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c
...
>> +versioned_symbol (libm, __exp, exp, GLIBC_2_28);
>> +libm_alias_double_other (__exp, exp)
>>   #endif
> 
> this should have been libm_alias_double (...) for
> targets where long double is the same as double.
> 
> will change it (at other places too) and rerun
> build-many-glibcs.py with it.

ok so the reason i used *_double_other is to avoid affecting
long double symbols, now i see that i either have to introduce
new symbol version for expl or keep the long double wrappers
somehow for targets where long double is the same as the double.

so is it acceptable to keep expl wrappers but remove exp
wrappers on the affected targets? what's the best way to do this?
customize sysdeps/ieee754/dbl-64/w_exp.c to do the right thing?
  
Joseph Myers June 29, 2018, 5:39 p.m. UTC | #3
On Fri, 29 Jun 2018, Szabolcs Nagy wrote:

> ok so the reason i used *_double_other is to avoid affecting
> long double symbols, now i see that i either have to introduce
> new symbol version for expl or keep the long double wrappers
> somehow for targets where long double is the same as the double.
> 
> so is it acceptable to keep expl wrappers but remove exp
> wrappers on the affected targets? what's the best way to do this?
> customize sysdeps/ieee754/dbl-64/w_exp.c to do the right thing?

The following applies generically regardless of whether you have a new 
expl symbol version: expl compat symbols for long double = double for 
ldbl-opt configurations need to keep pointing to the w_exp_compat version 
supporting SVID error handling.  (For exp2l, however, the ABI bug meaning 
that symbol only got added in GLIBC_2.4 means such compat symbols don't 
exist and those configurations only have exp2l for long double != double. 
The automatically-generated definitions of 
LONG_DOUBLE_COMPAT_CHOOSE_libm_exp2l etc. depend on LONG_DOUBLE_COMPAT in 
appropriate ways to allow code to do different things depending on whether 
such a compat symbol should be present - powerpc64le being a case where 
-mlong-double-64 is supported but none of those compat symbols exist 
because the first glibc version for the port already supported 128-bit 
long double.  Those macros are duly used in the ldbl-opt version of 
libm-alias-double.h.)

If you keep expl using the wrapper (rather than adding a new version of 
it), then of course on existing platforms with long double = double (as 
the current ABI) that means expl in shared libm needs to support SVID 
error handling, so needs to be defined by the wrapper from w_exp_compat.  
Whereas for new ports with long double = double (both NDS32 and C-SKY 
being under preliminary review, though without upstream tools yet being 
ready), and likewise for static linking, there is no need for SVID error 
handling support, w_exp_compat generates no code and so the expl symbol 
needs to be generated from w_exp (or e_exp).

I think the effect of the above may be that the various 
libm_alias_double_r definitions need refactoring so there is a macro that 
just does the (possibly empty) long double aliasing parts, which would 
then be used in the w_* files (while the _other macro would be used in the 
e_* files to create the _FloatN / _FloatNx aliases, which never need any 
support for SVID error handling and so can always avoid the wrappers once 
you have integrated errno setting).

Optimally, but probably more complicated, you *would* have a new expl 
symbol version that avoids the wrappers on platforms where long double = 
double is the current ABI, with the old one becoming a compat version in 
w_exp_compat.  Then, dbl-64 w_exp would remain empty and not generate any 
code, but w_exp_compat would need to handle defining the old expl as a 
compat symbol in long double = double cases.
  

Patch

diff --git a/math/Versions b/math/Versions
index b5a2500712..a6503e8798 100644
--- a/math/Versions
+++ b/math/Versions
@@ -574,5 +574,7 @@  libm {
     f32subf64x; f32subf128;
     f32xsubf64x; f32xsubf128; f64subf64x; f64subf128;
     f64xsubf128;
+    # No SVID compatible error handling.
+    exp; exp2;
   }
 }
diff --git a/math/w_exp.c b/math/w_exp.c
new file mode 100644
index 0000000000..efe4116764
--- /dev/null
+++ b/math/w_exp.c
@@ -0,0 +1,8 @@ 
+#include <math-type-macros-double.h>
+#undef __USE_WRAPPER_TEMPLATE
+#define __USE_WRAPPER_TEMPLATE 1
+#undef declare_mgen_alias
+#define declare_mgen_alias(a, b)
+#include <w_exp_template.c>
+versioned_symbol (libm, __exp, exp, GLIBC_2_28);
+libm_alias_double_other (__exp, exp)
diff --git a/math/w_exp2.c b/math/w_exp2.c
new file mode 100644
index 0000000000..079ddae890
--- /dev/null
+++ b/math/w_exp2.c
@@ -0,0 +1,8 @@ 
+#include <math-type-macros-double.h>
+#undef __USE_WRAPPER_TEMPLATE
+#define __USE_WRAPPER_TEMPLATE 1
+#undef declare_mgen_alias
+#define declare_mgen_alias(a, b)
+#include <w_exp2_template.c>
+versioned_symbol (libm, __exp2, exp2, GLIBC_2_28);
+libm_alias_double_other (__exp2, exp2)
diff --git a/math/w_exp2_compat.c b/math/w_exp2_compat.c
index 7ab618292f..440a535866 100644
--- a/math/w_exp2_compat.c
+++ b/math/w_exp2_compat.c
@@ -7,9 +7,9 @@ 
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
-#if LIBM_SVID_COMPAT
+#if LIBM_SVID_COMPAT && SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_28)
 double
-__exp2 (double x)
+__exp2_compat (double x)
 {
   double z = __ieee754_exp2 (x);
   if (__builtin_expect (!isfinite (z) || z == 0, 0)
@@ -19,5 +19,5 @@  __exp2 (double x)
 
   return z;
 }
-libm_alias_double (__exp2, exp2)
+compat_symbol (libm, __exp2_compat, exp2, GLIBC_2_1);
 #endif
diff --git a/math/w_exp_compat.c b/math/w_exp_compat.c
index ccda100075..c873132e3a 100644
--- a/math/w_exp_compat.c
+++ b/math/w_exp_compat.c
@@ -21,10 +21,10 @@ 
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
-#if LIBM_SVID_COMPAT
+#if LIBM_SVID_COMPAT && SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_28)
 /* wrapper exp */
 double
-__exp (double x)
+__exp_compat (double x)
 {
   double z = __ieee754_exp (x);
   if (__builtin_expect (!isfinite (z) || z == 0, 0)
@@ -33,6 +33,5 @@  __exp (double x)
 
   return z;
 }
-libm_hidden_def (__exp)
-libm_alias_double (__exp, exp)
+compat_symbol (libm, __exp_compat, exp, GLIBC_2_0);
 #endif
diff --git a/sysdeps/i386/fpu/w_exp.c b/sysdeps/i386/fpu/w_exp.c
new file mode 100644
index 0000000000..27eee98a0a
--- /dev/null
+++ b/sysdeps/i386/fpu/w_exp.c
@@ -0,0 +1 @@ 
+#include <sysdeps/../math/w_exp.c>
diff --git a/sysdeps/i386/fpu/w_exp2.c b/sysdeps/i386/fpu/w_exp2.c
new file mode 100644
index 0000000000..e0636a7ceb
--- /dev/null
+++ b/sysdeps/i386/fpu/w_exp2.c
@@ -0,0 +1 @@ 
+#include <sysdeps/../math/w_exp2.c>
diff --git a/sysdeps/ia64/fpu/e_exp.S b/sysdeps/ia64/fpu/e_exp.S
index c8cebeb177..e33146289c 100644
--- a/sysdeps/ia64/fpu/e_exp.S
+++ b/sysdeps/ia64/fpu/e_exp.S
@@ -739,6 +739,12 @@  EXP_UNDERFLOW_ZERO:
 
 GLOBAL_IEEE754_END(exp)
 libm_alias_double_other (__exp, exp)
+#ifdef SHARED
+.symver exp,exp@@GLIBC_2.28
+.weak __exp_compat
+.set __exp_compat,__exp
+.symver __exp_compat,exp@GLIBC_2.0
+#endif
 
 
 LOCAL_LIBM_ENTRY(__libm_error_region)
diff --git a/sysdeps/ia64/fpu/e_exp2.S b/sysdeps/ia64/fpu/e_exp2.S
index 18711866a1..0890ada08a 100644
--- a/sysdeps/ia64/fpu/e_exp2.S
+++ b/sysdeps/ia64/fpu/e_exp2.S
@@ -495,6 +495,12 @@  OUT_RANGE_exp2:
 
 GLOBAL_LIBM_END(exp2)
 libm_alias_double_other (exp2, exp2)
+#ifdef SHARED
+.symver exp2,exp2@@GLIBC_2.28
+.weak __exp2_compat
+.set __exp2_compat,__exp2
+.symver __exp2_compat,exp2@GLIBC_2.1
+#endif
 
 
 LOCAL_LIBM_ENTRY(__libm_error_region)
diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c
index 45644e4139..eb78edda14 100644
--- a/sysdeps/ieee754/dbl-64/e_exp.c
+++ b/sysdeps/ieee754/dbl-64/e_exp.c
@@ -20,6 +20,8 @@ 
 #include <stdint.h>
 #include <math-barriers.h>
 #include <math-narrow-eval.h>
+#include <shlib-compat.h>
+#include <libm-alias-double.h>
 #include "math_config.h"
 
 #define N (1 << EXP_TABLE_BITS)
@@ -89,7 +91,7 @@  top12 (double x)
 
 double
 SECTION
-__ieee754_exp (double x)
+__exp (double x)
 {
   uint32_t abstop;
   uint64_t ki, idx, top, sbits;
@@ -162,6 +164,10 @@  __ieee754_exp (double x)
      is no spurious underflow here even without fma.  */
   return scale + scale * tmp;
 }
-#ifndef __ieee754_exp
-strong_alias (__ieee754_exp, __exp_finite)
+#ifndef __exp
+hidden_def (__exp)
+strong_alias (__exp, __ieee754_exp)
+strong_alias (__exp, __exp_finite)
+versioned_symbol (libm, __exp, exp, GLIBC_2_28);
+libm_alias_double_other (__exp, exp)
 #endif
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c
index 954cbbfce7..ac39383325 100644
--- a/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -20,6 +20,8 @@ 
 #include <stdint.h>
 #include <math-barriers.h>
 #include <math-narrow-eval.h>
+#include <shlib-compat.h>
+#include <libm-alias-double.h>
 #include "math_config.h"
 
 #define N (1 << EXP_TABLE_BITS)
@@ -82,7 +84,7 @@  top12 (double x)
 }
 
 double
-__ieee754_exp2 (double x)
+__exp2 (double x)
 {
   uint32_t abstop;
   uint64_t ki, idx, top, sbits;
@@ -144,6 +146,9 @@  __ieee754_exp2 (double x)
      is no spurious underflow here even without fma.  */
   return scale + scale * tmp;
 }
-#ifndef __ieee754_exp2
-strong_alias (__ieee754_exp2, __exp2_finite)
+#ifndef __exp2
+strong_alias (__exp2, __ieee754_exp2)
+strong_alias (__exp2, __exp2_finite)
+versioned_symbol (libm, __exp2, exp2, GLIBC_2_28);
+libm_alias_double_other (__exp2, exp2)
 #endif
diff --git a/sysdeps/ieee754/dbl-64/w_exp.c b/sysdeps/ieee754/dbl-64/w_exp.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/w_exp.c
@@ -0,0 +1 @@ 
+/* Not needed.  */
diff --git a/sysdeps/ieee754/dbl-64/w_exp2.c b/sysdeps/ieee754/dbl-64/w_exp2.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/w_exp2.c
@@ -0,0 +1 @@ 
+/* Not needed.  */
diff --git a/sysdeps/m68k/m680x0/fpu/w_exp.c b/sysdeps/m68k/m680x0/fpu/w_exp.c
new file mode 100644
index 0000000000..27eee98a0a
--- /dev/null
+++ b/sysdeps/m68k/m680x0/fpu/w_exp.c
@@ -0,0 +1 @@ 
+#include <sysdeps/../math/w_exp.c>
diff --git a/sysdeps/m68k/m680x0/fpu/w_exp2.c b/sysdeps/m68k/m680x0/fpu/w_exp2.c
new file mode 100644
index 0000000000..e0636a7ceb
--- /dev/null
+++ b/sysdeps/m68k/m680x0/fpu/w_exp2.c
@@ -0,0 +1 @@ 
+#include <sysdeps/../math/w_exp2.c>
diff --git a/sysdeps/mach/hurd/i386/libm.abilist b/sysdeps/mach/hurd/i386/libm.abilist
index fd0a277bdc..8b94b67140 100644
--- a/sysdeps/mach/hurd/i386/libm.abilist
+++ b/sysdeps/mach/hurd/i386/libm.abilist
@@ -1020,6 +1020,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libm.abilist b/sysdeps/unix/sysv/linux/aarch64/libm.abilist
index 37e99a91bc..d3bcd37960 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libm.abilist
@@ -984,6 +984,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/alpha/libm.abilist b/sysdeps/unix/sysv/linux/alpha/libm.abilist
index 2773d61cd1..d1198e1e8f 100644
--- a/sysdeps/unix/sysv/linux/alpha/libm.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libm.abilist
@@ -995,6 +995,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/arm/libm.abilist b/sysdeps/unix/sysv/linux/arm/libm.abilist
index e126eb07e3..f425add367 100644
--- a/sysdeps/unix/sysv/linux/arm/libm.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libm.abilist
@@ -433,6 +433,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/hppa/libm.abilist b/sysdeps/unix/sysv/linux/hppa/libm.abilist
index 679bbfbd59..726b1511c4 100644
--- a/sysdeps/unix/sysv/linux/hppa/libm.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libm.abilist
@@ -744,6 +744,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist
index 3110c1f4fa..8198a183e0 100644
--- a/sysdeps/unix/sysv/linux/i386/libm.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libm.abilist
@@ -1027,6 +1027,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/ia64/libm.abilist b/sysdeps/unix/sysv/linux/ia64/libm.abilist
index 33a99ff678..47b7e7ed15 100644
--- a/sysdeps/unix/sysv/linux/ia64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libm.abilist
@@ -957,6 +957,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
index e126eb07e3..f425add367 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
@@ -433,6 +433,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
index 40ac529f7f..c5ec0f9f13 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
@@ -784,6 +784,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/microblaze/libm.abilist b/sysdeps/unix/sysv/linux/microblaze/libm.abilist
index 4a2c2e669e..d731b5912c 100644
--- a/sysdeps/unix/sysv/linux/microblaze/libm.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/libm.abilist
@@ -745,6 +745,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
index ff011f86f2..bb3b05487f 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
@@ -744,6 +744,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
index c19ee985a6..e395509999 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
@@ -984,6 +984,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/nios2/libm.abilist b/sysdeps/unix/sysv/linux/nios2/libm.abilist
index 2ed649a655..721e931859 100644
--- a/sysdeps/unix/sysv/linux/nios2/libm.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libm.abilist
@@ -745,6 +745,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
index 511b24b764..50ae595087 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
@@ -790,6 +790,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
index a6e4e4edaa..715410f54f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
@@ -789,6 +789,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
index 1e1f2b8d6e..20d473ac2c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
@@ -1028,6 +1028,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
index 331449dfcb..5882439a2a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
@@ -468,6 +468,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist
index 361fce20bb..af1a5bf260 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist
@@ -971,6 +971,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
index 643aa55498..5df3451518 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
@@ -985,6 +985,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
index 8cc5fdfc0b..05f2d2c516 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
@@ -985,6 +985,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/sh/libm.abilist b/sysdeps/unix/sysv/linux/sh/libm.abilist
index 43525fccf6..ee342928c8 100644
--- a/sysdeps/unix/sysv/linux/sh/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libm.abilist
@@ -744,6 +744,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
 GLIBC_2.28 f32divf32x F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
index fd973676e2..558f214959 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
@@ -992,6 +992,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
index 470e64f4ef..804044f527 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
@@ -984,6 +984,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
index 4a442c3989..87cbb6ae13 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
@@ -1018,6 +1018,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
index f1fc0e9f4d..991d3bcaa2 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
@@ -1018,6 +1018,8 @@  GLIBC_2.28 daddl F
 GLIBC_2.28 ddivl F
 GLIBC_2.28 dmull F
 GLIBC_2.28 dsubl F
+GLIBC_2.28 exp F
+GLIBC_2.28 exp2 F
 GLIBC_2.28 f32addf128 F
 GLIBC_2.28 f32addf32x F
 GLIBC_2.28 f32addf64 F
diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp-avx.c b/sysdeps/x86_64/fpu/multiarch/e_exp-avx.c
index afd917442a..3a6160327d 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_exp-avx.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_exp-avx.c
@@ -1,5 +1,4 @@ 
-#define __ieee754_exp __ieee754_exp_avx
-#define __exp1 __exp1_avx
+#define __exp __ieee754_exp_avx
 #define SECTION __attribute__ ((section (".text.avx")))
 
 #include <sysdeps/ieee754/dbl-64/e_exp.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp-fma.c b/sysdeps/x86_64/fpu/multiarch/e_exp-fma.c
index 765b1b9dd3..a9f84e3ab3 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_exp-fma.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_exp-fma.c
@@ -1,5 +1,4 @@ 
-#define __ieee754_exp __ieee754_exp_fma
-#define __exp1 __exp1_fma
+#define __exp __ieee754_exp_fma
 #define SECTION __attribute__ ((section (".text.fma")))
 
 #include <sysdeps/ieee754/dbl-64/e_exp.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c b/sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c
index 9ac7acad28..94e45b6edf 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c
@@ -1,5 +1,4 @@ 
-#define __ieee754_exp __ieee754_exp_fma4
-#define __exp1 __exp1_fma4
+#define __exp __ieee754_exp_fma4
 #define SECTION __attribute__ ((section (".text.fma4")))
 
 #include <sysdeps/ieee754/dbl-64/e_exp.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp.c b/sysdeps/x86_64/fpu/multiarch/e_exp.c
index 7cd7d1729c..26e614fa70 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_exp.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_exp.c
@@ -16,6 +16,8 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
+
 extern double __redirect_ieee754_exp (double);
 
 #define SYMBOL_NAME ieee754_exp
@@ -25,5 +27,5 @@  libc_ifunc_redirected (__redirect_ieee754_exp, __ieee754_exp,
 		       IFUNC_SELECTOR ());
 strong_alias (__ieee754_exp, __exp_finite)
 
-#define __ieee754_exp __ieee754_exp_sse2
+#define __exp __ieee754_exp_sse2
 #include <sysdeps/ieee754/dbl-64/e_exp.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/w_exp.c b/sysdeps/x86_64/fpu/multiarch/w_exp.c
new file mode 100644
index 0000000000..27eee98a0a
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/w_exp.c
@@ -0,0 +1 @@ 
+#include <sysdeps/../math/w_exp.c>