I have an .asm file with 2 arrays:
.DATA
compara byte 16 dup (?)
subtrai byte 16 dup (128)
Then I tried to use movdqu
on the arrays (to xmm1
and xmm2
), but I'm having a problem.
Even though they are the same size, each array stores 16 bytes of data, I get the error:
error A2022: instruction operands must be the same size
movdqu xmm2, compara
movdqu xmm1, subtrai
MASM is talking about the size of one element (byte), not the total size of the array. Just like if you wrote mov eax, compara
, where you'd need mov eax, dword ptr compara
to get it to emit a 4-byte load from an array of 1-byte elements, even if it was byte 4 dup(?)
movdqu xmm2, xmmword ptr [compara]
The square brackets are optional, but IMO good style to always use them for a memory operand.