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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.