Ticket #5413 (closed feature request: fixed)
Add population count primop
Description
Modern CPUs have a POPCNT instruction for efficient population count. This instruction can be used to implement various data structures.
I propose we add the following set of primops
popCnt8# :: Word# -> Word# popCnt16# :: Word# -> Word# popCnt32# :: Word# -> Word# popCnt64# :: Word64# -> Word# popCnt# :: Word# -> Word#
(We use Word# for all functions except the 64 bit version as there are no Word8, Word16# and Word32# types).
Each primop compiles into either a single POPCNT instruction or a call to some fallback function, implemented in C.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

