movaps instruction set in the documentation is as follows
MOVAPS—Move Aligned Packed Single Precision Floating-Point Values
Instruction:
MOVAPS xmm1, xmm2/m128
Description:
Move aligned packed single precision floating-point values from xmm2/mem to xmm1.
Questions 1: Why is xmm1 written instead of xmm register?
;nasm -f elf64 test.asm
section .data
var1 dd 0.1, 0.2, 0.3, 0.4
section .text
global _start
_start:
movaps xmm1, var1
exit:
mov rax,60
mov rdi,0
syscall
I got the error when I tried to compile the code.
test.asm:11: error: invalid combination of opcode and operands
As a result of my research from the internet, I fixed the error by replacing movaps xmm1, var1
with movaps xmm1, [var1]
.
Question 2: Where is the error in movaps xmm1, var1
. Isn't variable name a pointer in NASM? For example:
section .data
var1 dd 100
section .text
global _start
_start:
mov eax, var1 ; put var1's pointer in eax
;eax = memory
mov eax, dword [var1] ; put var1's value in eax
;eax = 100
exit:
mov rax,60
mov rdi,0
syscall
I am using Linux and NASM.