The source code here requires a version of ghc built from the simd
branch. Vectors primops only work when compiling with -fllvm
. You will also
need to patched version of the primitive
, vector
, and dph
libraries. You
can check out a complete source tree using the bin/ghc-simd-clone.sh
script. For example:
./bin/ghc-simd-clone.sh http://darcs.haskell.org/ghc.git ghc-simd
This will check out the simd branch of ghc in ghc-simd, perform a sync-all get
, and then check out the simd branches of the primitive
, vector
, and
dph
libraries. If you have a local mirror of
http://darcs.haskell.org/ghc.git
at LOCAL
, this might be faster:
./bin/ghc-simd-clone.sh LOCAL ghc-simd
After checking out a complete source tree with the ghc-simd-clone.sh
script,
configure and build as you would normally (see the GHC
wiki). Note that
ghc-simd-clone.sh
automatically enables the quick-llvm
BuildFlavour
.
Unfortunately, Win32 requires a patch to LLVM due to the fact that the stack is
only 4-byte aligned on Win32, causing LLVM to 1) insert extra prologue/epilogue
code to align the stack, and 2) disable tail calls. The patch tricks LLVM into
thinking 128-bit SSE registers only need to be 4-byte aligned. GHC's LLVM
mangler then rewrites all movaps
instructions (for register spills) to
movups
instructions (only on Win32) so that SSE registers really do only
have to be 4-byte aligned :) The patch is in the patches
directory,
here.