Why move a 32-bit register to the stack, and then from the stack to the xmm register?

I am compiling with gcc -m32on a 64-bit machine.

What is the difference between the following? Note that this is the syntax of AT & T.

# this
movd  %edx, %xmm0

# and this
movl  %edx, (%esp)
movd  (%esp), %xmm0
+4
source share
1 answer

Summing up the comments in response:

You probably got code that uses memory span because you did not enable optimization.

The only difference in the state of the machine is that the second version leaves a copy on the stack. (But

movd %edx, %xmm0
movl %edx, (%esp)

. , uops ( Intel. AMD Bulldozer/Steamroller 10/5 movd (x)mm, r32/r64. 1 Intel.)

:

/ , AMD. , , , .

( pdf)

+1

All Articles