I can't get SSE register arithmetic to work
I'll try to keep the code concise. This is a snippet that asks a user to
input 2 values. Putting them in xmm0 and xmm1. Adds them together, and
stores them back into xmm0. The output is always just double xmm1 though.
i.e. User inputs 5 and 7, it then outputs 14. When it should output 12.
;Prompt user
call scanf
==========Moving data into register==================
pop r14
push r14
movsd xmm0, [rsp] ;moves inputed number into SSE register xmm0
pop r14
;Prompt user again
call scanf
==========Moving more data into register==================
pop r15
push r15
movsd xmm1, [rsp] ;moves inputed number into SSE register xmm1
pop r15
=========Math=========
addsd xmm0, xmm1 ;xmm0 = xmm0 + xmm1
=====Print to screen=====
mov rdi, floatformat
mov qword rax, 1
call printf
No comments:
Post a Comment