[PATCH v2 1/3] math: Remove fenvinline.h

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Mar 10 16:58:11 GMT 2020



On 10/03/2020 08:29, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> Similar to string2.h (18b10de7ce) and string3.h (09a596cc2c) this
>> patch removes the fenvinline.h on all architectures.  Currently
>> only powerpc implements some optimizations.  This kind of optimization
>> is better implemented by the compiler (which handles the architecture
>> ISA transparently).
>>
>> Also, for the specific optimized powerpc implementation the code is
>> becoming convoluted and these micro-optimization are hardly wildly
>> used, even more being a possible hotspot in realword cases
>> (non-default rounding are used only on specific cases and exception
>> handling are done most likely only on errors path).  Only x86
>> implements similar optimization (on fenv.h) also indicates that
>> these should no be on libc.
> 
> Wasn't the idea to make this change only after the GCC optimizations
> have been implemented?
> 

That was Tulio suggestion, but I think this fix is orthogonal because
these fenv optimizations shows similar issues as for string{2,3}.h:

  - They are no scalable, specially for architecture that provides
    different floating-point environment (such as hard and soft
    floating point such as ARM) or even hardware revision that aims
    to improve some performance deficiencies in initial revisions
    (such as POWER with ISA 3.0).

  - Newer code avoid setting exceptions directly since they are 
    costly and set on error case.  For instance, the new generic
    logf, log2f and powf implementation that do not support SVID compat.

  - Exceptions handling are hardly a hotspot, usually it is set in
    code cold path.  This is also likely for non-default rouding
    mode (since set/reset usually requires flush the pipeline on
    most FPU implementation).


More information about the Libc-alpha mailing list