On Sat, Oct 22, 2011 at 6:40 AM, David Peixotto <d...@rice.edu> wrote:

> Ok, so to do it the "quick" way would be to change the translation of the
> PopCnt primop in compiler/codeGen/CgPrimOp.hs? The change would be to first
> narrow the argument by generating code for the narrow primop before the code
> for the PopCnt primop.
>

You should only have to add calls to the narrowXWord/Int in the base
package. In the instance declarations for Bits in e.g. GHC.Int and GHC.Word.
You should have to touch the code generator I think.


> This actually makes me wonder why the native backend is calling hs_popcnt
> at all? It should use the native instruction too right? The popcnt
> instruction works fine with the (patched) LLVM backend so it should be ok
> for the native codegen as well. It looks like the native gen is trying to
> use it, but for some reason its falling back to hs_popcnt on my system (a
> Nehalem MBP with OSX 10.7).
>

The native backend only uses the POPCNT instruction if you compile with `ghc
-msse4.2`.

-- Johan
_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to