Encoding:

MSA

011110

11000011

df

ws

wd

2R

011110

6

8

2

5

5

6

Format:

NLZC.df 

Vector Leading Zeros Count

NLZC.B wd,ws

MSA

Vector Leading Zeros Count

NLZC.H wd,ws

MSA

Vector Leading Zeros Count

NLZC.W wd,ws

MSA

Vector Leading Zeros Count

NLZC.D wd,ws

MSA

Vector Leading Zeros Count

Purpose:

Vector Leading Zeros Count

Vector element count of leading bits set to 0.

Description:

wd[i] = leading_zero_count(ws[i])

The number of leading zeroes for elements in vector ws is stored to the elements in vector wd.

The operands and results are values in integer data format df.

Restrictions:

No data-dependent exceptions are possible.

Operation:

NLZC.B
   for i in 0 .. WRLEN/8-1
      WR[wd]8i+7..8i = leading_zero_count(WR[ws]8i+7..8i, 8)
   endfor
NLZC.H
   for i in 0 .. WRLEN/16-1
      WR[wd]16i+15..16i = leading_zero_count(WR[ws]16i+15..16i, 16)
   endfor
NLZC.W
   for i in 0 .. WRLEN/32-1
      WR[wd]32i+31..32i = leading_zero_count(WR[ws]32i+31..32i, 32)
   endfor
NLZC.D
   for i in 0 .. WRLEN/64-1
      WR[wd]64i+63..64i = leading_zero_count(WR[ws]64i+63..64i, 64)
   endfor
function leading_zero_count(tt, n)
   z = 0
   for i in n-1..0
      if tti = 1 then
          return z
      else
          z = z + 1
      endif
endfunction leading_zero_count

Exceptions:

Reserved Instruction Exception, MSA Disabled Exception.