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
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
Note that it doesn't make sense to compare 64 bit operands in xmm registers, you can use general purpose registers for that.
If you need an AND or ANDN test against an operand you can use PTEST:
PTEST XMM0, [yourmem128] ; compare
JZ somewhere ; jump if all bits of the logical and are zero
If you want to test two 64 bit operands, you need to use PCMPEQQ
PCMPEQQ XMM0, [yourmem128] ; compare two 64 bit words
PEXTRQ RAX, XMM0, 1 ; upper 64 bit
MOVQ RBX, XMM0 ; lower 64 bit
OR RAX, RBX
NEG RAX
JZ somewhere ; jump if at least one word is zero
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With