|
MSA 011110 |
11000010 |
df |
ws |
wd |
2R 011110 |
|
6 |
8 |
2 |
5 |
5 |
6 |
NLOC.df |
Vector Leading Ones Count | |
NLOC.B wd,ws |
MSA |
Vector Leading Ones Count |
NLOC.H wd,ws |
MSA |
Vector Leading Ones Count |
NLOC.W wd,ws |
MSA |
Vector Leading Ones Count |
NLOC.D wd,ws |
MSA |
Vector Leading Ones Count |
Vector Leading Ones Count
Vector element count of leading bits set to 1.
wd[i] = leading_one_count(ws[i])
The number of leading ones for elements in vector ws is stored to the elements in vector wd.
The operands and results are values in integer data format df.
No data-dependent exceptions are possible.
NLOC.B
for i in 0 .. WRLEN/8-1
WR[wd]8i+7..8i = leading_one_count(WR[ws]8i+7..8i, 8)
endfor
NLOC.H
for i in 0 .. WRLEN/16-1
WR[wd]16i+15..16i = leading_one_count(WR[ws]16i+15..16i, 16)
endfor
NLOC.W
for i in 0 .. WRLEN/32-1
WR[wd]32i+31..32i = leading_one_count(WR[ws]32i+31..32i, 32)
endfor
NLOC.D
for i in 0 .. WRLEN/64-1
WR[wd]64i+63..64i = leading_one_count(WR[ws]64i+63..64i, 64)
endfor
function leading_one_count(tt, n)
z = 0
for i in n-1..0
if tti = 0 then
return z
else
z = z + 1
endif
endfunction leading_one_count
Reserved Instruction Exception, MSA Disabled Exception.