Re: callgrind and sin/cos under GCC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/11/2012 04:15 PM, Markus Trippelsdorf wrote:
> On 2012.09.11 at 16:00 +0100, Andrew Haley wrote:
>> On 09/11/2012 03:56 PM, Pete Flugstad wrote:
>>> Hi,
>>>
>>>    I'm trying to profile (using valgrind's callgrind) some code that
>>> uses sin/cos and I'm seeing some things I'm not expecting.
>>>
>>>   My OS is Ubuntu 12.04/x86_64, hardware is an Intel Xeon X5690.  GCC
>>> is the distro version, gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1.  I'm
>>> compiling with -O2.
>>>
>>>   The strange thing is that I'm seeing sincos (from libm.so) is
>>> showing up in the callgrind output.   From reading the manual, GCC
>>> should replace our calls to sin and cos with __builtin_ versions,
>>> right? 
>>
>> Yes, it does, and one of the things that expanding the builtins does is
>> call sincos().
> 
> BTW, s_sincos.S was removed from glibc a while ago. So if you're running
> a recent glibc version you end up with the slow floating-point sin/cos
> implementation, that causes a 50% slowdown.
> See: http://sourceware.org/bugzilla/show_bug.cgi?id=14412
> 
> However Intel has recently posted fast SSE sin/cos/sincos versions for
> libm (sinf, cosf and sincosf). I think gcc should be updated to call
> those instead. 

Well, gcc will call whatever sincos is in the library.  If there's a faster
accurate way to do sincos(), glibc should do it.

Andrew.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux