The CLZ instruction counts the number of leading
zeros in the value in Rm and
returns the result in Rd.
The result value is 32 if no bits are set in the source register,
and zero if bit 31 is set.
Register restrictions
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.
Condition flags
This instruction does not change the flags.
Architectures
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.
Examples
CLZ r4,r9
CLZNE r2,r3
Use the CLZ Thumb instruction followed by a left
shift of Rm by
the resulting Rd value
to normalize the value of register Rm.
Use MOVS, rather than MOV, to flag the
case where Rm is
zero:
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.