cmpli
Compare Logical Immediate
Compares the contents of a register with an immediate value and updates the condition register.
Details
The contents of register RA ((RA)32:63 zero-extended to 64 bits if L=0) are compared with 480 || UI, treating the operands as unsigned integers. The result of the comparison is placed into CR field BF.
Pseudocode Operation
if L = 0 then a ←320 || (RA)32:63
else a ←(RA)
if a <u (480 || UI) then c ←0b100
else if a >u (480 || UI) then c ←0b010
else c ←0b001
CR4×BF+32:4×BF+35 ←c || XERSO
Programming Note
The cmpli instruction is commonly used for unsigned integer comparisons where one operand is an immediate value. Be cautious with the zero-extension behavior when L=0, as it can lead to unexpected results if not accounted for. This instruction operates at user privilege level and does not generate exceptions under normal circumstances.
Extended Mnemonics
| Extended Mnemonic | Equivalent Instruction |
|---|---|
| cmpldi |
Example
Encoding
Operands
-
BF
Condition Register Field -
L
Size -
RA
Source Register -
UI
Unsigned 16-bit Immediate -
CRb
Condition Register Field -
SIMM
Signed Immediate Value