#5413: Add population count primop
---------------------------------+------------------------------------------
    Reporter:  tibbe             |       Owner:              
        Type:  feature request   |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  7.2.1             |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5413>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to