Purpose of cmove instruction in x86 assembly?
disassembling an executable I encountered the cmove instruction. I've already searched on internet but I've only found that it's a conditional move, and if the source and destination are equal the mov occurs. what i haven't understood yet is why should I need it, since it doesn't change the operands. please could you explain me its purpose, using an example too if necessary
thanks
The CMOVcc
instructions doesn't compare the source and destination. It uses the flags from a previous comparison (or other operation that sets the flags) which determines if the move should be done or not.
Example; this copies edx
to ecx
if eax
and ebx
are equal:
cmp eax, ebx
cmoveq ecx, edx
This does the same as:
cmp eax, ebx
jne skip
mov ecx, edx
skip:
链接地址: http://www.djcxy.com/p/12562.html
上一篇: 在检索地址方面,MOV和LEA有什么区别
下一篇: x86汇编中cmove指令的用途?