On 09/13/2018 03:27 PM, Wilco Dijkstra wrote:
Hi,
The existing sincos functions use 2 pointers to return the sine and cosine
result. In
most cases 4 memory accesses are necessary per call. This is inefficient and
often
significantly slower than returning values in registers. I ran a few
experiments on the
new optimized sincosf implementation in GLIBC using the following interface:
__complex__ float sincosf2 (float);
This has 50% higher throughput and a 25% reduction in latency on Cortex-A72 for
random inputs in the range +-PI/4. Larger inputs take longer and thus have lower
gains, but there is still a 5% gain on the (rarely used) path with full range
reduction.
Given sincos is used in various HPC applications this can give a worthwile
speedup.
I think this is totally fine if you call it expif or something like that
(and put the sine in the imaginary part, of course).
In general, I would object to using complex numbers for arbitrary pairs,
but this doesn't apply to this case.
Thanks,
Florian