[PATCH 23/25] math: Use erfc from CORE-MATH

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Wed Sep 17 12:05:24 GMT 2025



On 17/09/25 07:25, H. Peter Anvin wrote:
> On September 17, 2025 1:19:54 AM PDT, Andreas Schwab <schwab@suse.de> wrote:
>> On Sep 17 2025, H. Peter Anvin wrote:
>>
>>> I don't know if there is some trick with headers that would let -ffast-math invoke a "fast and sloppy" version?
>>
>>     This option causes the preprocessor macro '__FAST_MATH__' to be
>>     defined.
>>
> 
> So one could involve something like __fast_math_erf in that case ...

I think it could be accomplished with current CORE-MATH implementations,
for the Ziv's algorithm it would require to export an extra __fast_math_symbol
that just calls the fast path (before rounding test), and the required alias 
in the math.h using __FAST_MATH__.

It has the advantage of not require multiple implementations, but it would
require exporting another symbol. And we will need to check if really does
provide an performance advantage.

We have tried something similar with -ffinite-math-only and the gains were 
minimal, and it resulted extra maintenance. We ended up making this compat
symbol for the default implementations and not providing it for newer ABIs.




More information about the Libc-alpha mailing list