Places the number of leading zeros from a source general-purpose register in a general-purpose register.
PowerPC | |
---|---|
cntlzw | RA,RS |
cntlzw. | RA,RS |
POWER | |
---|---|
cntlz | RA,RS |
cntlz. | RA,RS |
The cntlzw and cntlz instructions count the number (between 0 and 32 inclusive) of consecutive zero bits starting at bit 0 of general-purpose register (GPR) RS and store the result in the target GPR RA.
Syntax Form | Overflow Exception (OE) | Fixed-Point Exception Register | Record Bit (Rc) | Condition Register Field 0 |
cntlzw | None | None | 0 | None |
cntlzw. | None | None | 1 | LT,GT,EQ,SO |
cntlz | None | None | 0 | None |
cntlz. | None | None | 1 | LT,GT,EQ,SO |
The two syntax forms of the cntlzw instruction and the two syntax forms of the cntlz instruction never affect the Fixed-Point Exception Register. If the syntax form sets the Record (Rc) bit to 1, the instruction affects the Less Than (LT) zero, Greater Than (GT) zero, Equal To (EQ) zero, and Summary Overflow (SO) bits in Condition Register Field 0.
RA | Specifies target general-purpose register where result of operation is stored. |
RS | Specifies source general-purpose register for operation. |
The following code counts the number of leading zeros in the value contained in GPR 3 and places the result back in GPR 3:
# Assume GPR 3 contains 0x0061 9920. cntlzw 3,3 # GPR 3 now holds 0x0000 0009.
Fixed-Point Logical Instructions.