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 interface to call them under MSVC? How about under Linux?
Thanks a lot for the help.
Why not just do this:
?