Search code examples
assemblyx86nasmsse

Comparing quadwords in xmm


using nasm to program in x86 assembly...

with MOVQ instruction I put m64 to xmm

MOVQ xmm1, qword [mymem64]

and now I want to compare it to zero so I can use Jcc

how it can be done and what instruction must use? (with quick look in manual I didn't found)

PS. I prefer Intel syntax :P


Solution

  • Don't use SSE if you want to jump conditionally depending on the value. To be able to set the flags necessary for Jcc you need to store the value in a general purpose register. If you are on 64-bit you can do something like:

        mov     r8,[m64]
        test    r8,r8
        jnz     .out
    

    If you're on 32-bit you can check the two parts separately:

        mov     eax,dword [m64]
        mov     edx,dword [m64+4]
        or      eax,edx
        jnz     .out