summaryrefslogtreecommitdiff
path: root/compiler/main/DriverPipeline.hs
diff options
context:
space:
mode:
authorGeoffrey Mainland <gmainlan@microsoft.com>2013-02-13 16:33:01 +0000
committerGeoffrey Mainland <gmainlan@microsoft.com>2013-09-22 22:33:59 -0400
commit0c6cf2a83b65bcb873e574d4940823e7f1c67c65 (patch)
tree8687544cdc9b3777b0f5e44e5fbea0f714775dd3 /compiler/main/DriverPipeline.hs
parent638cd12df65d59162b904576367a1ecda409353d (diff)
downloadhaskell-0c6cf2a83b65bcb873e574d4940823e7f1c67c65.tar.gz
Add support for -mavx and -mavx2 flags.
Diffstat (limited to 'compiler/main/DriverPipeline.hs')
-rw-r--r--compiler/main/DriverPipeline.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 035d5778d6..a123564984 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1380,7 +1380,8 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
++ [SysTools.Option tbaa]
++ map SysTools.Option fpOpts
++ map SysTools.Option abiOpts
- ++ map SysTools.Option sseOpts)
+ ++ map SysTools.Option sseOpts
+ ++ map SysTools.Option avxOpts)
return (RealPhase next_phase, output_fn)
where
@@ -1413,6 +1414,10 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
| isSse2Enabled dflags = ["-mattr=+sse2"]
| otherwise = []
+ avxOpts | isAvx2Enabled dflags = ["-mattr=+avx2"]
+ | isAvxEnabled dflags = ["-mattr=+avx"]
+ | otherwise = []
+
-----------------------------------------------------------------------------
-- LlvmMangle phase
@@ -2022,6 +2027,10 @@ doCpp dflags raw input_fn output_fn = do
[ "-D__SSE2__=1" | sse2 || sse4_2 ] ++
[ "-D__SSE4_2__=1" | sse4_2 ]
+ let avx_defs =
+ [ "-D__AVX__=1" | isAvxEnabled dflags ] ++
+ [ "-D__AVX2__=1" | isAvx2Enabled dflags ]
+
backend_defs <- getBackendDefs dflags
cpp_prog ( map SysTools.Option verbFlags
@@ -2031,6 +2040,7 @@ doCpp dflags raw input_fn output_fn = do
++ map SysTools.Option backend_defs
++ map SysTools.Option hscpp_opts
++ map SysTools.Option sse_defs
+ ++ map SysTools.Option avx_defs
-- Set the language mode to assembler-with-cpp when preprocessing. This
-- alleviates some of the C99 macro rules relating to whitespace and the hash
-- operator, which we tend to abuse. Clang in particular is not very happy