[PATCH v3 1/2] math: Optimize dbl-64 remainder implementation

Wilco Dijkstra Wilco.Dijkstra@arm.com
Thu Oct 2 19:45:20 GMT 2025


Hi Adhemerval,

> The commit 34b9f8bc17 provides an optimized fmod implementation; use
> the same strategy used for remainderf and implement the double variant
> on top of fmod.
>
> I see the following performance improvements using remainder benchtests
> (using reciprocal-throughput metric):
> 
> Architecture     | Input           |   master |   patch  | Improvemnt
> -----------------|-----------------|----------|-----------------------
> x86_64           | subnormals      |  76.1345 |  21.5334 |     71.72%
> x86_64           | normal          | 553.2670 | 426.5670 |     22.90%
> x86_64           | close-exponent  |  30.5111 |  22.6893 |     25.64%
> aarch64          | subnormals      |  26.0734 |   8.4876 |     67.45%
> aarch64          | normal          | 205.2590 |  200.082 |      2.52%
> aarch64          | close-exponent  |  13.8481 |  13.6663 |      1.31%
> 
> The aarch64 used as Neoverse-N1, gcc 15.1.1; while the x86_64 was
> a AMD Ryzen 9 5900X, gcc 15.2.1.
>
> This implementation also fixes the math/test-double-remainder issues
> on alpha.
>
> Tested on aarch64-linux-gnu and x86_64-linux-gnu.

Looks good to me now - and since this makes removal of the wrappers
feasible, another 15% gain can be had.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>

Cheers,
Wilco


More information about the Libc-alpha mailing list