Encoding:

POOL32S

010110

rt

rs

DCLZ

0101101100

POOL32SXf

111100

6

5

5

10

6

Format:

DCLZ rd, rs

microMIPS64

Count Leading Zeros in Doubleword

Purpose:

Count Leading Zeros in Doubleword

To count the number of leading zeros in a doubleword

Description:

 GPR[rd] = count_leading_zeros GPR[rs]

The 64-bit word in GPR rs is scanned from most significant to least significant bit. The number of leading zeros is counted and the result is written to GPR rd. If no bits were set in GPR rs, the result written to GPR rd is 64.

Restrictions:

To be compliant with the MIPS32 and MIPS64 Architecture, software must place the same GPR number in both the

rt and rd fields of the instruction. The operation of the instruction is UNPREDICTABLE if the rt and rd fields of the

instruction contain different values.

Operation:

temp = 64
for i in 63.. 0
   if GPR[rs]i = 1 then
      temp = 63 - i
      break
   endif
endfor
GPR[rd] = temp

Exceptions:

None