开发者

a simple assembly question

I'm new to assembly, and it's quite fun. Anyways I have one question...

cmpw c开发者_Go百科r7, %r29, %r8

Is that code the equivalent of if cr7 > %r29 and %r8?


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.

less:    0x100
greater: 0x010
equal:   0x001

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜