Why does MSVC use SSE2 instruction for such a trivial thing?

The code:

double Ret_Value=0;

by default, VS2012 compiles to:

10112128  xorps       xmm0,xmm0  
1011212E  movsd       mmword ptr [Ret_Value],xmm0

If SSE2 is disabled in the project settings, this is compiled for:

101102AC  fldz  
101102AE  lea         eax,[Ret_Value]  
101102B1  push        eax  
101102B2  fstp        qword ptr [Ret_Value] 

Edit: I'm not sure what push, and leaassociated with this initialization, it may be done after that, just shows their disassembler for this line of C ++ code.

Is SSE2 significantly better? Except these two instructions are shorter? What is optimization here?

As it was discovered: the application started crashing on an old processor that does not support SSE2.

+4
source share
1 answer

Intel 3.8.1 ( ) :

SSE, SSE2 SIMD (, AVX) . x87, SIMD.

3.8.5 :

SIMD- 2 SIMD-, x87. SSE2 , X87, , X87.

+3

All Articles