一道简单的组装题
我是组装新手,这很有趣。无论如何,我有一个问题......
cmpw cr7, %r29, %r8
该代码是否相当于 if cr7 > %r29 和 %r8
?
I'm new to assembly, and it's quite fun. Anyways I have one question...
cmpw cr7, %r29, %r8
Is that code the equivalent of if cr7 > %r29 and %r8
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信它将 r29 与 r8 进行比较并将结果放入 cr7 中。
换句话说:
cr7 = r29 - r8
读了一些PPC文档后,看起来像cr(比较寄存器),得到一个编码值,代表小于、大于、等于。
在其他体系结构中,例如 x86,本身没有 CR,而是一组标志,例如 ZF、SF 和 CF(零、符号和进位标志)。这些总是在算术运算(例如减法)期间设置。因此,比较基本上与减法相同。
It compares r29 to r8 and places the result in cr7 I believe.
In other words:
cr7 = r29 - r8
After reading some PPC docs, it looks like cr (the comparison register), gets a coded value, representing less, greater, equal.
In other architectures, such as x86, there is no CR per se, but a group of flags, such as ZF, SF, and CF (zero, sign, and carry flags). Those are always set during arithmetic operations, such as subtraction. Hence a compare is basically the same as a subtract.