与 cmovl 操作码中的内容进行比较?

发布于 2024-08-01 21:17:51 字数 160 浏览 0 评论 0原文

在汇编操作码 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

感情旳空白 2024-08-08 21:17:51

它前面应该有另一条适当设置标志的指令,例如 cmp

cmp ebx, ecx   ; compare ebx to ecx and set flags.
cmovl ebx, eax ; if (ebx < ecx (comparison based on flags)) ebx = eax 

It should be preceded by another instruction that sets flags appropriately, like cmp.

cmp ebx, ecx   ; compare ebx to ecx and set flags.
cmovl ebx, eax ; if (ebx < ecx (comparison based on flags)) ebx = eax 
流年里的时光 2024-08-08 21:17:51

cmov 不进行比较,它使用先前比较的结​​果 - 如果为真,它将执行 mov。 cmovl 的意思是“如果之前的比较结果为“小于”,则执行移动。

例如:

cmp ecx, 5
cmovl eax, ebx ; eax = ebx if ecx < 5

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:

cmp ecx, 5
cmovl eax, ebx ; eax = ebx if ecx < 5
病毒体 2024-08-08 21:17:51

在 AT&T 汇编中,等效代码为:

cmp   %ebx, %eax
cmovl %ebx, %eax

如果 %eax 中保存有值,则该代码会将 %ebx 的值复制到 %eax > 大于调用 cmp%ebx 中保存的值。

使用您的示例值,结果将是条件移动不会将值从 %ebx 复制到 %eax,因为 0x02 显然是大于0x01

In AT&T assembly the equivalent code would be:

cmp   %ebx, %eax
cmovl %ebx, %eax

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 the cmp call.

With your example values, the result would be that the conditional move would not copy the value from %ebx to %eax, as 0x02 is clearly greater than 0x01.

没有伤那来痛 2024-08-08 21:17:51

如果标志寄存器具有以下内容,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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文