在汇编操作码cmovl中,有什么比较?例如:EAX:00000002 EBX:00000001
cmovl eax,ebx
Run Code Online (Sandbox Code Playgroud)
结果是什么?哪一个需要少,所以可以移动?
谢谢!
Mic*_*ael 16
cmov不进行比较,它使用先前比较的结果 - 如果为真,则执行mov.cmovl表示"如果先前的比较导致"小于",则执行移动.
例如:
cmp ecx, 5
cmovl eax, ebx ; eax = ebx if ecx < 5
Run Code Online (Sandbox Code Playgroud)
它前面应该有另一条适当设置标志的指令,例如cmp.
cmp ebx, ecx ; compare ebx to ecx and set flags.
cmovl ebx, eax ; if (ebx < ecx (comparison based on flags)) ebx = eax
Run Code Online (Sandbox Code Playgroud)