cmpdi
Compare Doubleword Immediate
cmpdi bf,ra,si
Compares a doubleword immediate value with the contents of a register and updates the condition register.
Details
For cmpdi, the immediate value SI is compared with the contents of register RA. The result is placed into CR Field BF.
Pseudocode Operation
if 'cmpdi' then
if (RA) < SI then CR[bF] <- 0b00000001
else if (RA) > SI then CR[bF] <- 0b00000010
else CR[bF] <- 0b00000100
Programming Note
Use cmpdi to compare a register with an immediate value and set the condition register field accordingly. Ensure the immediate value fits within the signed 16-bit range. The comparison result is used in conditional branches, so check CR Field BF after execution.
Extended Mnemonics
| Extended Mnemonic | Equivalent Instruction |
|---|---|
Example
cmpdi bf, ra, si
Encoding
Binary Layout
11
0
BF
6
/
9
L
10
RA
11
SI
16
Operands
-
bf
Target Condition Register Field -
ra
Source General Purpose Register -
si
Signed Immediate Value