Glibc log2 Function Up To 69% Faster Thanks To FMA

Written by Michael Larabel in GNU on 13 August 2023 at 06:08 AM EDT. 13 Comments
GNU
Intel engineer and open-source compiler expert H.J. Lu has landed a much faster log2() implementation within the GNU C Library (glibc) that makes use of FMA instructions with modern x86_64 CPUs.

H.J. Lu has committed an FMA-optimized log2() function to the GNU C Library for obtaining the base 2 logarithm of a value.

Using an older Intel Skylake CPU for reference, his Fused Multiply Add (FMA) optimized log2 function was 34% faster or up to 69% faster for maximum performance.

Git patch for log2 optimization with FMA


It's yet another nice hand-tuned function for the GNU C Library that's now in Glibc Git.
Related News
About The Author
Michael Larabel

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.

Popular News This Week