popcntb
Population Count Bytes
popcntb RA,RS
Counts the number of one bits in each byte of a register.
Encoding
Binary Layout
31
0:5
RS
6:10
RA
11:15
///
16:20
122
21:30
/
31
Operands
-
RA
Target General Purpose Register -
RS
Source General Purpose Register
Example
popcntb r4, r3
Related
Across architectures
Population Count : how x86, ARM, RISC-V, and PowerISA each do this.
More in Base
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
A count of the number of one bits in each byte of register RS is placed into the corresponding byte of register RA. This number ranges from 0 to 8, inclusive.
Operation
for i = 0 to 7
n ← 0
for j = 0 to 7
if (RS)(i×8)+j = 1 then
n ← n+1
RA(i×8):(i×8)+7 ← n