| |||
| Home > ARM and Thumb Instructions > General data processing instructions > CLZ | |||
Count Leading Zeros.
CLZ{cond}Rd,Rm
where:
condis an optional condition code.
Rdis the destination register.
Rmis the operand register.
The CLZ instruction counts the number of leading
zeros in the value in and
returns the result in Rm.
The result value is 32 if no bits are set in the source register,
and zero if bit 31 is set.Rd
You cannot use PC for any operand.
You can use SP in these ARM instructions but this is deprecated in ARMv6T2 and above.
You cannot use SP in Thumb instructions.
This ARM instruction is available in ARMv5T and above.
This 32-bit Thumb instruction is available in ARMv6T2 and above.
There is no 16-bit Thumb version of this instruction.
CLZ r4,r9
CLZNE r2,r3
Use the CLZ Thumb instruction followed by a left
shift of by
the resulting Rm value
to normalize the value of register Rd.
Use RmMOVS, rather than MOV, to flag the
case where is
zero:Rm
CLZ r5, r9 MOVS r9, r9, LSL r5