]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
math: Fix x86_64 tanh _FloatN aliases binding to the FMA variant [BZ 34465] master
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 30 Jul 2026 11:55:54 +0000 (08:55 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 30 Jul 2026 12:50:37 +0000 (09:50 -0300)
The generic implementation emits libm_alias_double unconditionally, so
tanhf32x and tanhf64 bind directly to __tanh_fma.

Guard the alias with '#ifndef __tanh' and emit it from the dispatcher,
as sin.  Also remove the stale __expm1 defines, unused since tanh moved
to CORE-MATH.

Checked on x86_64-linux-gnu, and with 'qemu-x86_64 -cpu Nehalem'.

Reported-by: Michael Brunnbauer <brunni@netestate.de>
sysdeps/ieee754/dbl-64/s_tanh.c
sysdeps/x86_64/fpu/multiarch/s_tanh-fma.c
sysdeps/x86_64/fpu/multiarch/s_tanh.c

index 2029de8fa5e4e6d0436f102605b81fef07b64523..ef80b9edb636587c51e8b94477d2440ce29d1628 100644 (file)
@@ -283,4 +283,6 @@ __tanh (double x)
     return as_tanh_database (x, res);
   return res;
 }
+#ifndef __tanh
 libm_alias_double (__tanh, tanh)
+#endif
index 1b808b1227f50cf50d4ae4a3a85296f81b280d98..1e6b33740aa80e77e554e548b37a61734ed430d4 100644 (file)
@@ -1,10 +1,4 @@
 #define __tanh __tanh_fma
-#define __expm1 __expm1_fma
-
-/* NB: __expm1 may be expanded to __expm1_fma in the following
-   prototypes.  */
-extern long double __expm1l (long double);
-extern long double __expm1f128 (long double);
 
 #define SECTION __attribute__ ((section (".text.fma")))
 
index ec8826f6343e5934fb8d07bda58c0ebf59e57783..9048c977c1acb64324ef7e9f5595499fbe040fa0 100644 (file)
@@ -25,10 +25,9 @@ extern double __redirect_tanh (double);
 # define SYMBOL_NAME tanh
 # include "ifunc-fma.h"
 
-libc_ifunc_redirected (__redirect_tanh, tanh, IFUNC_SELECTOR ());
+libc_ifunc_redirected (__redirect_tanh, __tanh, IFUNC_SELECTOR ());
+libm_alias_double (__tanh, tanh)
 
 # define __tanh __tanh_sse2
-# undef libm_alias_double
-# define libm_alias_double(a, b)
 #endif
 #include <sysdeps/ieee754/dbl-64/s_tanh.c>