Is there any interface to call __libm_sse2_sincos under MSVC?
I'm currently working on an optimization of some C codes under MSVC, in which some sin() and cos() calculations are performed.
I use the SSE implementations like:
a = _mm_set_pd(cos(w),sin(w));
However, when I check disassembly codes later, I find that Microsoft compiler interpret cos(w) and sin(w) as follows:
call __libm_sse2_cos
...
call __libm_sse2_sin
In which cos and sin are called separately. But I would expect that compiler call __libm_sse2_sincos to calculate sin and cos with the same radian simultaneously.
So is it possible that I tell compiler to do this? or any inter开发者_运维技巧face to call them under MSVC? How about under Linux?
Thanks a lot for the help.
Why not just do this:
double s, c;
sincos(w, &s, &c);
a = _mm_set_pd(c, s);
?
if you want sincos under MSVC, you can use the implementation(s) from the XNA math library, namely XMVectorSinCos
and XMScalarSinCos
, which suck as they are float
only or you need to use an external library like AMD's LibM (for x64 only) or a smaller time one like this.
精彩评论