Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是组装新手,这很有趣。无论如何,我有一个问题...
cmpw cr7, %r29, %r8
该代码是否相当于if cr7 > %r29 and %r8?
if cr7 > %r29 and %r8
它将 r29 与 r8 进行比较,并将结果放在我相信的 cr7 中。
换句话说:
cr7 = r29 - r8
在阅读了一些 PPC 文档后,它看起来像 cr(比较寄存器),得到一个编码值,表示小于、大于、等于。
less: 0x100 greater: 0x010 equal: 0x001
在其他架构中,例如 x86,没有 CR 本身,而是一组标志,例如 ZF、SF 和 CF(零、符号和进位标志)。这些总是在算术运算期间设置,例如减法。因此,比较基本上与减法相同。