VOOZH about

URL: https://www.phoronix.com/news/glibc-Faster-Hyperbolic-FMA

⇱ Glibc's Hyperbolic Functions Score Nice Speed-Ups With FMA Optimizations - Phoronix


👁 Phoronix

Glibc's Hyperbolic Functions Score Nice Speed-Ups With FMA Optimizations

Written by Michael Larabel in GNU on 14 March 2025 at 09:00 AM EDT. 15 Comments
The GNU C Library's tanh and other hyperbolic functions are now as much as 14~17% faster on modern Intel and AMD CPUs with the FMA instruction support for fused multiply-add operations.

The FMA instruction set has been around for roughly the past decade with both Intel and AMD processors. Only now this week thanks to the work of Intel engineer Sunil K Pandey is there an FMA-optimized tanh function along with atanh and sinh functions.

👁 Intel Core Skylake CPU


Testing of the FMA'ed tanh on an Intel Skylake CPU is showing a max improvement around 14% while the min/mean improvement clocks in around 4% faster than the prior code. Those interested can find the FMA optimized tanh function via this Glibc commit.

The sinh optimization is 4~17% faster. The atanh optimization is around 2% faster.

Not bad for something that's been commonplace among Intel/AMD x86_64 CPUs for years though surprising it took this long for the optimization to be cracked. In any event, Intel continues to deserve kudos for all their open-source toolchain optimizations over the years and especially when it comes to tuning the GNU C Library (glibc) for new x86_64 instruction set capabilities.

👁 FMA tanh


These improvements will be found in the GNU C Library 2.42 release due out around August.

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.