CLZ
Count Leading Zeros.
Syntax
CLZ
{
}
cond
,
Rd
Rm
where:
cond
is an optional condition code.
Rd
is the destination register.
Rm
is the operand register.
Operation
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 A32 instructions but this is deprecated.
You cannot use SP in T32 instructions.
Condition flags
This instruction does not change the flags.
Architectures
This 32-bit instruction is available in A32 and T32.
There is no 16-bit version of this instruction in T32.
Examples
CLZ r4,r9 CLZNE r2,r3
Use the CLZ
T32 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:
CLZ r5, r9 MOVS r9, r9, LSL r5