cmpl
Compare Logical
cmpl BF, L, RA, RB
Compares two registers as unsigned integers.
Encoding
Binary Layout
31
0:5
BF
6:8
/
9
L
10
RA
11:15
RB
16:20
0000100000
21:30
1
31
Operands
-
BF
Condition Register Field -
L
Size (0=32-bit, 1=64-bit) -
RA
Source Register 1 -
RB
Source Register 2
Example
cmpl cr1, 1, r3, r4
// Unsigned compare of r3 vs r4.
Registers Altered
CRRelated
More in Base
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
Performs an unsigned logical comparison between RA and RB, with L determining the operand size (L=0 for 32-bit, L=1 for 64-bit). The comparison result is written to condition register field BF. The comparison sets the LT, GT, or EQ bits in the target CR field based on whether RA is less than, greater than, or equal to RB when interpreted as unsigned integers. This Base category instruction affects only the specified condition register field, not CR0.
Operation
if L = 0 then
a ← zero_extend(RA[32:63], 64)
b ← zero_extend(RB[32:63], 64)
else
a ← RA
b ← RB
if a < b then
CR[BF] ← 0b100 || SO
elseif a > b then
CR[BF] ← 0b010 || SO
else
CR[BF] ← 0b001 || SO
Programming Note
Use cmpl for unsigned comparisons. Ensure registers RA and RB are properly aligned if they contain pointers or data structures. The instruction modifies the Condition Register (CR), so check the appropriate field after execution to determine the result of the comparison.