[commit: ghc] wip/simd: Add support for -mavx512* flags. (1a5995d)
git at git.haskell.org
git at git.haskell.org
Mon Sep 16 07:05:38 CEST 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/simd
Link : http://ghc.haskell.org/trac/ghc/changeset/1a5995db91683d1be31ca0ec5d556e4f2c1e162b/ghc
>---------------------------------------------------------------
commit 1a5995db91683d1be31ca0ec5d556e4f2c1e162b
Author: Geoffrey Mainland <gmainlan at microsoft.com>
Date: Sun Sep 15 16:24:04 2013 -0400
Add support for -mavx512* flags.
>---------------------------------------------------------------
1a5995db91683d1be31ca0ec5d556e4f2c1e162b
compiler/main/DriverPipeline.hs | 21 ++++++++++++++++-----
compiler/main/DynFlags.hs | 32 ++++++++++++++++++++++++++++++--
2 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 74a3c54..48a0466 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1454,6 +1454,7 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
++ map SysTools.Option abiOpts
++ map SysTools.Option sseOpts
++ map SysTools.Option avxOpts
+ ++ map SysTools.Option avx512Opts
++ map SysTools.Option stackAlignOpts)
return (RealPhase next_phase, output_fn)
@@ -1487,9 +1488,15 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
| isSse2Enabled dflags = ["-mattr=+sse2"]
| otherwise = []
- avxOpts | isAvx2Enabled dflags = ["-mattr=+avx2"]
- | isAvxEnabled dflags = ["-mattr=+avx"]
- | otherwise = []
+ avxOpts | isAvx512fEnabled dflags = ["-mattr=+avx512f"]
+ | isAvx2Enabled dflags = ["-mattr=+avx2"]
+ | isAvxEnabled dflags = ["-mattr=+avx"]
+ | otherwise = []
+
+ avx512Opts =
+ [ "-mattr=+avx512cd" | isAvx512cdEnabled dflags ] ++
+ [ "-mattr=+avx512er" | isAvx512erEnabled dflags ] ++
+ [ "-mattr=+avx512pf" | isAvx512pfEnabled dflags ]
stackAlignOpts =
case platformArch (targetPlatform dflags) of
@@ -2105,8 +2112,12 @@ doCpp dflags raw input_fn output_fn = do
[ "-D__SSE4_2__=1" | sse4_2 ]
let avx_defs =
- [ "-D__AVX__" | isAvxEnabled dflags ] ++
- [ "-D__AVX2__" | isAvx2Enabled dflags ]
+ [ "-D__AVX__" | isAvxEnabled dflags ] ++
+ [ "-D__AVX2__" | isAvx2Enabled dflags ] ++
+ [ "-D__AVX512CD__" | isAvx512cdEnabled dflags ] ++
+ [ "-D__AVX512ER__" | isAvx512erEnabled dflags ] ++
+ [ "-D__AVX512F__" | isAvx512fEnabled dflags ] ++
+ [ "-D__AVX512PF__" | isAvx512pfEnabled dflags ]
backend_defs <- getBackendDefs dflags
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 7743915..0e9193d 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -133,6 +133,10 @@ module DynFlags (
isSse4_2Enabled,
isAvxEnabled,
isAvx2Enabled,
+ isAvx512cdEnabled,
+ isAvx512erEnabled,
+ isAvx512fEnabled,
+ isAvx512pfEnabled,
-- * Linker information
LinkerInfo(..),
@@ -769,6 +773,10 @@ data DynFlags = DynFlags {
sseVersion :: Maybe (Int, Int), -- (major, minor)
avx :: Bool,
avx2 :: Bool,
+ avx512cd :: Bool, -- Enable AVX-512 Conflict Detection Instructions.
+ avx512er :: Bool, -- Enable AVX-512 Exponential and Reciprocal Instructions.
+ avx512f :: Bool, -- Enable AVX-512 instructions.
+ avx512pf :: Bool, -- Enable AVX-512 PreFetch Instructions.
-- | Run-time linker information (what options we need, etc.)
rtldFlags :: IORef (Maybe LinkerInfo)
@@ -1401,6 +1409,10 @@ defaultDynFlags mySettings =
sseVersion = Nothing,
avx = False,
avx2 = False,
+ avx512cd = False,
+ avx512er = False,
+ avx512f = False,
+ avx512pf = False,
rtldFlags = panic "defaultDynFlags: no rtldFlags"
}
@@ -2307,6 +2319,10 @@ dynamic_flags = [
, Flag "msse" (versionSuffix (\maj min d -> d{ sseVersion = Just (maj, min) }))
, Flag "mavx" (noArg (\d -> d{ avx = True }))
, Flag "mavx2" (noArg (\d -> d{ avx2 = True }))
+ , Flag "mavx512cd" (noArg (\d -> d{ avx512cd = True }))
+ , Flag "mavx512er" (noArg (\d -> d{ avx512er = True }))
+ , Flag "mavx512f" (noArg (\d -> d{ avx512f = True }))
+ , Flag "mavx512pf" (noArg (\d -> d{ avx512pf = True }))
------ Warning opts -------------------------------------------------
, Flag "W" (NoArg (mapM_ setWarningFlag minusWOpts))
@@ -3607,10 +3623,22 @@ isSse4_2Enabled :: DynFlags -> Bool
isSse4_2Enabled dflags = sseVersion dflags >= Just (4,2)
isAvxEnabled :: DynFlags -> Bool
-isAvxEnabled dflags = avx dflags || avx2 dflags
+isAvxEnabled dflags = avx dflags || avx2 dflags || avx512f dflags
isAvx2Enabled :: DynFlags -> Bool
-isAvx2Enabled dflags = avx2 dflags
+isAvx2Enabled dflags = avx2 dflags || avx512f dflags
+
+isAvx512cdEnabled :: DynFlags -> Bool
+isAvx512cdEnabled dflags = avx512cd dflags
+
+isAvx512erEnabled :: DynFlags -> Bool
+isAvx512erEnabled dflags = avx512er dflags
+
+isAvx512fEnabled :: DynFlags -> Bool
+isAvx512fEnabled dflags = avx512f dflags
+
+isAvx512pfEnabled :: DynFlags -> Bool
+isAvx512pfEnabled dflags = avx512pf dflags
-- -----------------------------------------------------------------------------
-- Linker information
More information about the ghc-commits
mailing list