You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So it copies the array to 0x40(%rsp) (in two 64-bit pieces), then puts that address at 0x8(%rsp), and movups loads 16 bytes from there rather than from the array itself.
which generates optimal code in this case, because the array is already pointed to by %rdi, but in general may clobber a register and emit a load when neither is necessary.
This should be
0u64; try replacing themovupswithxorps %xmm0, %xmm0. Here's the generated code:So it copies the array to
0x40(%rsp)(in two 64-bit pieces), then puts that address at0x8(%rsp), andmovupsloads 16 bytes from there rather than from the array itself.In GCC, I would do
which
gcc -O3turns into the optimalAttempting to do the same in Rust
produces even wronger code
Workarounds:
When the array is a static with a name, just name it within the
asm!. See pub static disappears if only used from asm #13365.which generates optimal code in this case, because the array is already pointed to by
%rdi, but in general may clobber a register and emit a load when neither is necessary.