我会尽量保持代码简洁。这是一个片段,要求用户输入2个值。将它们放在xmm0和xmm1中。将它们添加到一起,并将它们存储回xmm0。输出总是只有两倍xmm1。
即。用户输入5和7,然后输出14.当它输出12时。
;Prompt user
call scanf
==========将数据移入注册表==================
pop r14
push r14
movsd xmm0, [rsp] ;moves inputed number into SSE register xmm0
pop r14
;Prompt user again
call scanf
==========将更多数据移入注册表==================
pop r15
push r15
movsd xmm1, [rsp] ;moves inputed number into SSE register xmm1
pop r15
=========数学=========
addsd xmm0, xmm1 ;xmm0 = xmm0 + xmm1
=====打印到屏幕=====
mov rdi, floatformat
mov qword rax, 1
call printf