This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Creating a more efficient sincos interface


On 13/09/18 14:52, Florian Weimer wrote:
> 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).
> 

gcc seems to have a __builtin_cexpif
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/builtins.c;h=58ea7475ef7bb2a8abad2463b896efaa8fd79650;hb=HEAD#l2439

but i dont see it documented, may be we
can add an actual cexpif symbol with the
above signature?

> In general, I would object to using complex numbers for arbitrary pairs, but this doesn't apply to this case.
> 
> Thanks,
> Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]