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

git at git.haskell.org git at git.haskell.org
Mon Sep 16 20:38:22 CEST 2013


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

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

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

commit c3f34dfba65262370f371bba949e6eb3871a4b96
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.


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

c3f34dfba65262370f371bba949e6eb3871a4b96
 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 965b8e4..bbd07cc 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