]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
math: Remove the SVID error handling from sinhf
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 31 Oct 2025 16:08:54 +0000 (13:08 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 4 Nov 2025 07:14:01 +0000 (04:14 -0300)
It improves latency for about 3-10% and throughput for about 5-15%.

Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
29 files changed:
math/Versions
math/w_sinhf_compat.c
sysdeps/ieee754/flt-32/e_sinhf.c
sysdeps/ieee754/flt-32/w_sinhf.c [new file with mode: 0644]
sysdeps/m68k/m680x0/fpu/w_sinhf_compat.c [new file with mode: 0644]
sysdeps/mach/hurd/i386/libm.abilist
sysdeps/unix/sysv/linux/aarch64/libm.abilist
sysdeps/unix/sysv/linux/alpha/libm.abilist
sysdeps/unix/sysv/linux/arm/be/libm.abilist
sysdeps/unix/sysv/linux/arm/le/libm.abilist
sysdeps/unix/sysv/linux/hppa/libm.abilist
sysdeps/unix/sysv/linux/i386/libm.abilist
sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
sysdeps/unix/sysv/linux/microblaze/be/libm.abilist
sysdeps/unix/sysv/linux/microblaze/le/libm.abilist
sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
sysdeps/unix/sysv/linux/sh/be/libm.abilist
sysdeps/unix/sysv/linux/sh/le/libm.abilist
sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist

index 3b16796453f6d4975cdb2724d411769ce878be28..f81ff75a00d5fc160a02c7f6be8be091ac77e7ad 100644 (file)
@@ -699,6 +699,7 @@ libm {
     log10f;
     remainder;
     remainderf;
+    sinhf;
     y0f;
     y1f;
     ynf;
index e8de6675af4e44bc3827c02d0f02d7101f7a5492..77c7cefb55be86bd521ff5cee73b04dc57914f21 100644 (file)
@@ -21,9 +21,9 @@
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
-#if LIBM_SVID_COMPAT
+#if LIBM_SVID_COMPAT && SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_43)
 float
-__sinhf (float x)
+__sinh_compatf (float x)
 {
        float z = __ieee754_sinhf (x);
        if (__builtin_expect (!isfinite (z), 0) && isfinite (x)
@@ -32,5 +32,10 @@ __sinhf (float x)
 
        return z;
 }
-libm_alias_float (__sinh, sinh)
+# ifdef NO_COMPAT_NEEDED
+strong_alias (__sinh_compatf, __sinhf)
+libm_alias_float (__sinh_compat, sinh)
+# else
+compat_symbol (libm, __sinh_compatf, sinhf, GLIBC_2_0);
+# endif
 #endif
index 5e812c35afeafc003bf0ada0894a2a95f7e80bbb..687f75332ef90b18b81b8ecd5608a98f7897ace3 100644 (file)
@@ -24,15 +24,18 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
+#include <errno.h>
 #include <math.h>
 #include <stdint.h>
 #include <libm-alias-finite.h>
+#include <libm-alias-float.h>
+#include <math-svid-compat.h>
 #include <math-narrow-eval.h>
 #include "math_config.h"
 #include "e_sincoshf_data.h"
 
 float
-__ieee754_sinhf (float x)
+__sinhf (float x)
 {
   static const struct
   {
@@ -44,15 +47,9 @@ __ieee754_sinhf (float x)
   uint32_t ux = asuint (x) << 1;
   if (__glibc_unlikely (ux > 0x8565a9f8u))
     { /* |x| >~ 89.4 */
-      float sgn = copysignf (2.0f, x);
       if (ux >= 0xff000000u)
-       {
-         if (ux << 8)
-           return x + x;                           /* nan */
-         return copysignf (INFINITY, x); /* +-inf */
-       }
-      float r = math_narrow_eval (sgn * 0x1.fffffep127f);
-      return r;
+       return x + x;;
+      return __math_oflowf (x < 0);
     }
   if (__glibc_unlikely (ux < 0x7c000000u))
     { /* |x| < 0.125 */
@@ -105,4 +102,11 @@ __ieee754_sinhf (float x)
     }
   return ub;
 }
+strong_alias (__sinhf, __ieee754_sinhf)
+#if LIBM_SVID_COMPAT
+versioned_symbol (libm, __sinhf, sinhf, GLIBC_2_43);
+libm_alias_float_other (__sinh, sinh)
+#else
+libm_alias_float (__sinh, sinh)
+#endif
 libm_alias_finite (__ieee754_sinhf, __sinhf)
diff --git a/sysdeps/ieee754/flt-32/w_sinhf.c b/sysdeps/ieee754/flt-32/w_sinhf.c
new file mode 100644 (file)
index 0000000..1cc8931
--- /dev/null
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/m68k/m680x0/fpu/w_sinhf_compat.c b/sysdeps/m68k/m680x0/fpu/w_sinhf_compat.c
new file mode 100644 (file)
index 0000000..e8e4bc9
--- /dev/null
@@ -0,0 +1,8 @@
+/* m68k provides an optimized __ieee754_sinhhf.  */
+#ifdef SHARED
+# define NO_COMPAT_NEEDED 1
+# include <math/w_sinhf_compat.c>
+#else
+# include <math-type-macros-float.h>
+# include <w_sinh_template.c>
+#endif
index 1dc8f572d0e3daa2ceae15170132bcd0b374f2da..b9274b47c4681aae1d5f3ffa84adfdb295fe24d5 100644 (file)
@@ -1330,6 +1330,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index d799f204faf8b63980531abce4af70ddf7f4095c..79a327aae299c78daa151a561c0b32075684237f 100644 (file)
@@ -1296,6 +1296,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 0d608533c92b7f7c94afe2e65c49d746d42f77a5..63bba07bbf0285bd87704d1206645f2e21cd89e9 100644 (file)
@@ -1455,6 +1455,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index d60a11026cdaf8b90d80f9215fc14c6ec5743fe5..d62946108a328d9eeb41a6b402afe4fafef701f0 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index d60a11026cdaf8b90d80f9215fc14c6ec5743fe5..d62946108a328d9eeb41a6b402afe4fafef701f0 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 60ce950d8afbb7c6d2179ea0e0f0ebbfc0c934de..e8083d0af5838f46db8c46eb15c0be335f74027c 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index b4164516f6b054a6212dcc97b791c69ce5daa348..67a4cc555ef10610bdf59b44af9da1032cd09d01 100644 (file)
@@ -1337,6 +1337,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index d60a11026cdaf8b90d80f9215fc14c6ec5743fe5..d62946108a328d9eeb41a6b402afe4fafef701f0 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index e24b8ef83aa15f446a93389051f33acf118cee24..624eff1cafd7677a7aeb9f6a8e8914fce3b88a4a 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index e24b8ef83aa15f446a93389051f33acf118cee24..624eff1cafd7677a7aeb9f6a8e8914fce3b88a4a 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 42afecec7c84d19ddcdffe5779a6c27886a1b3c6..8502e66e3e73fd5c0f8e7007255ab88e9dfca7c5 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 2850dacf7f35cb3886bb2d054f30c73472730cfa..fc20a8e42ea74ce3f9109e27fb0dfbf2d034ed11 100644 (file)
@@ -1296,6 +1296,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 71f1e74f75e7e07932709d703aa449a5ca95d8f7..f13ccd8a69934c953d05a24bd136b4617ee0f5e0 100644 (file)
@@ -1108,6 +1108,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 2cab971c10282968092dd5c613df2b68a82c0648..254e25106a52b095f9061c43628e7b0add7d8b27 100644 (file)
@@ -1107,6 +1107,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 6574ba9908b821e0a3dd63f19ffcfea6b19e340f..8a8992d3243d6acd31b56b12d93e1413a47d916e 100644 (file)
@@ -1101,6 +1101,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index e4888b6cf2b66edb55641767c35c3191d4f4beeb..cb4690018764b4ee2ac2790122a134293a9ce04e 100644 (file)
@@ -1485,6 +1485,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index ccc0de5b98813f33c4cb70c8705516576209185c..721e0c4bc51fe7361ba7ab436ff1aed8998e9e76 100644 (file)
@@ -1399,6 +1399,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 871c473efa6296553c42a704f53b2e44a40ad7fa..fedb41284a4a7ea5c06c5b93b9df0ffa6f453c94 100644 (file)
@@ -1399,6 +1399,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 7a0edfe5c37bde137f46c7cc50df5f0ff789c28e..312075b479c6c4df2b25ac3bca491f3bf8b305a5 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 7a0edfe5c37bde137f46c7cc50df5f0ff789c28e..312075b479c6c4df2b25ac3bca491f3bf8b305a5 100644 (file)
@@ -961,6 +961,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index acfe74ef6ff342cc887b6351b1072da2ef6ff9ba..192349cbf34abf949651f8b3eebec5a8c399f9d5 100644 (file)
@@ -1406,6 +1406,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index dc28560fdcb168b73fcbe3c596bab6dfb620d2b7..03f14432d612a2bf2b5072bdbfdd689a42c7ab71 100644 (file)
@@ -1296,6 +1296,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index 369000017530fb0bb82a69630c0a2c81620c9ffd..8e08ac5e1821487f4445ff82b114244d182ceb70 100644 (file)
@@ -1329,6 +1329,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F
index c41a781b5c916e95ee40ce98ebdaef4c8f8ad079..be5cd7c8a153c0220f2d9460800599eefb629cff 100644 (file)
@@ -1329,6 +1329,7 @@ GLIBC_2.43 jnf F
 GLIBC_2.43 log10f F
 GLIBC_2.43 remainder F
 GLIBC_2.43 remainderf F
+GLIBC_2.43 sinhf F
 GLIBC_2.43 y0f F
 GLIBC_2.43 y1f F
 GLIBC_2.43 ynf F