与 cmovl 操作码中的内容进行比较?
在汇编操作码 cmovl 中,比较什么? 例如: EAX:00000002 EBX: 00000001
cmovl eax,ebx
结果是什么? 哪一个需要减少才能移动?
谢谢你!
In the assembly opcode cmovl, what gets compared?
For example:
EAX: 00000002
EBX: 00000001
cmovl eax,ebx
What is the result? Which one needs to be less so they can be moved?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
它前面应该有另一条适当设置标志的指令,例如
cmp
。It should be preceded by another instruction that sets flags appropriately, like
cmp
.cmov 不进行比较,它使用先前比较的结果 - 如果为真,它将执行 mov。 cmovl 的意思是“如果之前的比较结果为“小于”,则执行移动。
例如:
cmov doesn't do a comparison, it uses the result of a previous comparison - if it is true, it will perform the mov. cmovl means "perform move if previous comparison resulted in "less than".
For example:
在 AT&T 汇编中,等效代码为:
如果
%eax
中保存有值,则该代码会将%ebx
的值复制到%eax
> 大于调用cmp
时%ebx
中保存的值。使用您的示例值,结果将是条件移动不会将值从
%ebx
复制到%eax
,因为0x02
显然是大于0x01
。In AT&T assembly the equivalent code would be:
which would copy the value of
%ebx
to%eax
, if the value held in%eax
was greater than the value held in%ebx
at the time of thecmp
call.With your example values, the result would be that the conditional move would not copy the value from
%ebx
to%eax
, as0x02
is clearly greater than0x01
.如果标志寄存器具有以下内容,
cmovl
将执行移动:SF!=OF
这些标志将被设置为某些先前操作的结果(通常但不一定,某种比较)。
cmovl
指令不执行其自身的比较。cmovl
will perform the move if the flags register has the following:SF!=OF
Those flags would be set as the result of some previous operation (typically, but not necessarily, a compare of some sort).
The
cmovl
instruction does not perform a compare of its own.