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

Geoffrey Mainland gmainlan at microsoft.com
Tue Mar 26 13:55:58 CET 2013


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

On branch  : simd

https://github.com/ghc/ghc/commit/21615d8395c7dcccb922b00b02c0abad734d0cad

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

commit 21615d8395c7dcccb922b00b02c0abad734d0cad
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 a4d826b..7685e57 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1459,7 +1459,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
@@ -1496,6 +1497,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