[PATCH] Sparc exp(), expf() performance improvement

Joseph Myers joseph@codesourcery.com
Mon Jul 31 23:22:00 GMT 2017


On Mon, 31 Jul 2017, Patrick McGehearty wrote:

> I have to say that the ratio of 5285/70 = 75x speedup seems way
> too optimistic for my new code. I have not investigated the reason
> for the apparently super slow max value.

That would be the code that tries to ensure correctly rounded results 
(only for round-to-even) in cases where the mathematical result is very 
close to a half-way value.

There is no need for functions such as exp to be correctly rounded, only 
functions such as fma and sqrt that are fully bound to IEEE 754 
operations.  (TS 18661-4 reserves names such as crexp for 
correctly-rounded implementations, which need to be correctly rounded, 
with correct exceptions including "inexact", in all rounding modes.)  
Thus in fact the slow cases could be removed - *provided* an analysis of 
the existing checks for when to use them shows that the fast cases still 
have a sufficiently small error bound (it's possible some slow cases may 
still be needed, if the errors from the fast case can be too large for 
some inputs).

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list