[GHC] #7684: cgrun071 segfaults
Johan Tibell
johan.tibell at gmail.com
Thu Sep 5 14:09:11 UTC 2013
On Thu, Sep 5, 2013 at 12:20 AM, GHC <ghc-devs at haskell.org> wrote:
> Should we switch to calling the "slower" popCount for this certain case?
> https://github.com/ghc/testsuite/blob/master/tests/codeGen/should_run/cgrun071.hs#L41-L46
> {{{
> slowPopcnt :: Word -> Word
> slowPopcnt x = count' (bitSize x) x 0
> where
> count' 0 _ !acc = acc
> count' n x acc = count' (n-1) (x `shiftR` 1)
> (acc + if x .&. 1 == 1 then 1 else 0)
> }}}
I've not been following this closely so apologies if I've
misunderstood the issue.
Are you asking if we should call slowPopcnt in the test in more
circumstances or if we should call it in the real implementation of
the primop? The primop already has a fallback if the popcnt
instruction isn't available (it uses a table-based implementation).
More information about the ghc-devs
mailing list