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

Geoffrey Mainland gmainlan at microsoft.com
Thu Feb 14 23:16:55 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : simd

http://hackage.haskell.org/trac/ghc/changeset/c4a5ca480571e2a7d2c58f45cd56f1f470281178

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

commit c4a5ca480571e2a7d2c58f45cd56f1f470281178
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 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 7c98aa3..ef89a71 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1438,7 +1438,8 @@ runPhase 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 (next_phase, output_fn)
   where
@@ -1475,6 +1476,11 @@ runPhase 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