riscv: Optimize hweight API with Zbb extension

The Hamming Weight of a number is the total number of bits set in it, so
the cpop/cpopw instruction from Zbb extension can be used to accelerate
hweight() API.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Link: https://lore.kernel.org/r/20231112095244.4015351-1-xiao.w.wang@intel.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
Xiao Wang 2023-11-12 17:52:44 +08:00 • committed by Palmer Dabbelt
commit 55ca8d7aa2
No known key found for this signature in database
GPG key ID: 2E1319F35FBB1889
2 changed files with 81 additions and 1 deletions