Compares the contents of two general-purpose registers algebraically.
cmp | BF,L,RA,RB |
See "Extended Mnemonics of Fixed-Point Compare Instructions" for more information.
The cmp instruction compares the contents of general-purpose register (GPR) RA with the contents of GPR RB as signed integers and sets one of the bits in Condition Register Field BF.
BF can be Condition Register Field 0-7; programmers can specify which Condition Register Field will indicate the result of the operation.
The bits of Condition Register Field BF are interpreted as follows:
Bit | Name | Description |
0 | LT | (RA) < SI |
1 | GT | (RA) > SI |
2 | EQ | (RA) = SI |
3 | SO | SO,OV |
The cmp instruction has one syntax form and does not affect the Fixed-Point Exception Register. Condition Register Field 0 is unaffected unless it is specified as BF by the programmer.
The following code compares the contents of GPR 4 and GPR 6 as signed integers and sets Condition Register Field 0 to reflect the result of the operation:
# Assume GPR 4 contains 0xFFFF FFE7. # Assume GPR 5 contains 0x0000 0011. # Assume 0 is Condition Register Field 0. cmp 0,4,6 # The LT bit of Condition Register Field 0 is set.
The cmpi (Compare Immediate) instruction, cmpl (Compare Logical) instruction, cmpli (Compare Logical Immediate) instruction.