[commit: ghc] wip/simd: Set LLVM option -stack-alignment=32 when compiling AVX instructions. (104b827)

git at git.haskell.org git at git.haskell.org
Mon Sep 16 07:05:28 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/simd
Link       : http://ghc.haskell.org/trac/ghc/changeset/104b82722ba6cffff8632a8205861946fed4037a/ghc

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

commit 104b82722ba6cffff8632a8205861946fed4037a
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.


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

104b82722ba6cffff8632a8205861946fed4037a
 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 905608d..74a3c54 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1453,7 +1453,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
@@ -1490,6 +1491,11 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
                 | isAvxEnabled dflags    = ["-mattr=+avx"]
                 | otherwise              = []
 
+        stackAlignOpts =
+            case platformArch (targetPlatform dflags) of
+              ArchX86_64 | isAvxEnabled dflags -> ["-stack-alignment=32"]
+              _                                -> []
+
 -----------------------------------------------------------------------------
 -- LlvmMangle phase
 




More information about the ghc-commits mailing list