Places the number of leading zeros from a source general-purpose register in a general-purpose register.
Bits | Value |
---|---|
0-5 | 31 |
6-10 | RS |
11-15 | RA |
16-20 | /// |
21-30 | 26 |
31 | Rc |
PowerPC | |
---|---|
cntlzw | RA, RS |
cntlzw. | RA, RS |
POWER family | |
---|---|
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 .