[commit: ghc] simd: Set LLVM option -stack-alignment=32 when compiling AVX instructions. (7d69e70)

Geoffrey Mainland gmainlan at ghc.haskell.org
Fri Jul 19 14:16:55 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : simd

http://hackage.haskell.org/trac/ghc/changeset/7d69e701f4809f4b931b211fa369bd378e38bc27

>---------------------------------------------------------------

commit 7d69e701f4809f4b931b211fa369bd378e38bc27
Author: Geoffrey Mainland <gmainlan at microsoft.com>
Date:   Thu Feb 14 21:25:54 2013 +0000

    Set LLVM option -stack-alignment=32 when compiling AVX instructions.

>---------------------------------------------------------------

 compiler/main/DriverPipeline.hs |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 8fef336..1290652 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1435,7 +1435,8 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
                 ++ map SysTools.Option fpOpts
                 ++ map SysTools.Option abiOpts
                 ++ map SysTools.Option sseOpts
-                ++ map SysTools.Option avxOpts)
+                ++ map SysTools.Option avxOpts
+                ++ map SysTools.Option stackAlignOpts)
 
     return (RealPhase next_phase, output_fn)
   where
@@ -1472,6 +1473,11 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
                 | isAvx2Enabled dflags   = ["-mattr=+avx2"]
                 | otherwise              = []
 
+        stackAlignOpts =
+            case platformArch (targetPlatform dflags) of
+              ArchX86_64 | isAvxEnabled dflags -> ["-stack-alignment=32"]
+              _                                -> []
+
 -----------------------------------------------------------------------------
 -- LlvmMangle phase
 






More information about the ghc-commits mailing list