callgrind and sin/cos under GCC

Markus Trippelsdorf markus@trippelsdorf.de
Tue Sep 11 16:47:00 GMT 2012


On 2012.09.11 at 11:30 -0500, Pete Flugstad wrote:
> Markus wrote:
> > 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.
> 
> Correction on my part, we're using Ubuntu 11.10, which uses glibc 2.13.
> 
> So if I'm reading at the various ChangeLogs and BugZilla's correctly,
> we should still have the s_sincos.S impl (we don't have large inputs,
> so we're not seeing any problems).  This s_sincos.S calls fsincos (X87
> instruction?).

Yes, it was removed in 2.16.

> The reason this came up is we were comparing the profiling results we
> got under Visual Studio (using AMD Code Analyst) and while generally
> the profiling was consistent, the call to sincos (and atan2) was
> taking quite a bit more relative time than with Visual Studio.  So
> we're basically digging to try and figure out why.
> 
> Would Intel's SSE2 version make any difference in this case?  (we're
> using doubles, not floats).

Doubles should be fine. Sinf and cosf are already available in the
current glibc git tree. So if you are willing to build glibc trunk of
today, you should be able to measure the difference for yourself,

-- 
Markus



More information about the Gcc-help mailing list