Moving a quadword number to xmm registers

2.9k views Asked by At

I am trying to move a number in a 64-bit register to an xmm register to do arithmetic. My thinking was:

movq xmm1, r14

In my program r14 is holding the counter and I need it to get moved into xmm1 so I can divide it with the sum of numbers i have stored in xmm0. And then display it.

When I execute the code, it stores 0 into xmm1.

Someone please help.

1

There are 1 answers

3
DocMax On BEST ANSWER

I created test.asm as:

section .code
global _start
_start:
    mov r14,0x123456789abcdef0
    movq xmm1, r14
    int 3

Compiled and linked with:

nasm.exe -f win64 -o test.obj test.asm
link.exe test.obj /entry:_start /subsystem:console

And ran it under the 64-bit WinDbg. When it hit the int 3 WinDbg showed the registers as:

r14      123456789abcdef0
xmm1     0.000000e+000: 0.000000e+000: 5.690457e-028:-7.811515e-023
xmm1/0   9abcdef0
xmm1/1   12345678
xmm1/2   0
xmm1/3   0
xmm1l    1234:5678:9abc:def0
xmm1h    0:0:0:0

...and having typed all of that, is it possible that you are looking at xmm1 as a floating point instead of integer values?