[PATCH] Optimized generic expf and exp2f
Arjan van de Ven
arjan@linux.intel.com
Wed Sep 6 13:02:00 GMT 2017
On 9/6/2017 5:55 AM, Wilco Dijkstra wrote:
> Arjan van de Ven wrote:
>>>
>>> expf reciprocal-throughput: 1.5x faster
>>> expf latency: 1.4x faster
>>
>> interesting; the fma existing expf for x86_64 is 10 to 11 cycles reciprocal-throughput ;-)
>> time to see how you got that 1.5x faster....
>
> Just using a good algorithm :-) It's not the first time generic C
> code beats "optimized" assembler implementations in GLIBC,
> and it won't be the last... This shows that optimizing generic
> code is a much better strategy overall.
I'm seeing a 16% throughput increase (not 1.5x) but still impressive.
I do see different numerical answers between the two (I had to disable
the code in my bench that detects differences) and sampling a few
it seems that the C code is a little bit less accurate in places,
likely a simpler polynomal.
(for example for 20.636783599853515625 as input)
I'm all in favor of C code, it's hard to beat compilers, unless
you have a magic trick for which the compiler doesn't know how
to generate code.
More information about the Libc-alpha
mailing list