[commit: ghc] wip/simd: Enable -msse to be specified by itself. (a2fed19)
git at git.haskell.org
git at git.haskell.org
Mon Sep 16 20:38:39 CEST 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/simd
Link : http://ghc.haskell.org/trac/ghc/changeset/a2fed19e8655a4606ffde6b916ec0a9b8cce0f2b/ghc
>---------------------------------------------------------------
commit a2fed19e8655a4606ffde6b916ec0a9b8cce0f2b
Author: Geoffrey Mainland <gmainlan at microsoft.com>
Date: Mon Sep 16 12:27:37 2013 -0400
Enable -msse to be specified by itself.
This sets the SSE "version" to 1.0.
>---------------------------------------------------------------
a2fed19e8655a4606ffde6b916ec0a9b8cce0f2b
compiler/main/CmdLineParser.hs | 2 +-
compiler/main/DriverPipeline.hs | 11 +++++------
compiler/main/DynFlags.hs | 7 +++++++
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/compiler/main/CmdLineParser.hs b/compiler/main/CmdLineParser.hs
index 6681186..fef2701 100644
--- a/compiler/main/CmdLineParser.hs
+++ b/compiler/main/CmdLineParser.hs
@@ -220,7 +220,7 @@ processOneArg opt_kind rest arg args
Just min <- parseInt min_s -> Right (f maj min, args)
| [maj_s] <- split '.' rest_no_eq,
Just maj <- parseInt maj_s -> Right (f maj 0, args)
- | otherwise -> Left ("malformed version argument in " ++ dash_arg)
+ | otherwise -> Right (f 1 0, args)
findArg :: [Flag m] -> String -> Maybe (String, OptKind m)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 0fd8bbb..9528826 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1486,6 +1486,7 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
sseOpts | isSse4_2Enabled dflags = ["-mattr=+sse42"]
| isSse2Enabled dflags = ["-mattr=+sse2"]
+ | isSseEnabled dflags = ["-mattr=+sse"]
| otherwise = []
avxOpts | isAvx512fEnabled dflags = ["-mattr=+avx512f"]
@@ -2104,12 +2105,10 @@ doCpp dflags raw input_fn output_fn = do
-- remember, in code we *compile*, the HOST is the same our TARGET,
-- and BUILD is the same as our HOST.
- let sse2 = isSse2Enabled dflags
- sse4_2 = isSse4_2Enabled dflags
- sse_defs =
- [ "-D__SSE__=1" | sse2 || sse4_2 ] ++
- [ "-D__SSE2__=1" | sse2 || sse4_2 ] ++
- [ "-D__SSE4_2__=1" | sse4_2 ]
+ let sse_defs =
+ [ "-D__SSE__=1" | isSseEnabled dflags ] ++
+ [ "-D__SSE2__=1" | isSse2Enabled dflags ] ++
+ [ "-D__SSE4_2__=1" | isSse4_2Enabled dflags ]
let avx_defs =
[ "-D__AVX__=1" | isAvxEnabled dflags ] ++
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 1d43b7e..47d968e 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -129,6 +129,7 @@ module DynFlags (
unsafeGlobalDynFlags, setUnsafeGlobalDynFlags,
-- * SSE and AVX
+ isSseEnabled,
isSse2Enabled,
isSse4_2Enabled,
isAvxEnabled,
@@ -3610,6 +3611,12 @@ setUnsafeGlobalDynFlags = writeIORef v_unsafeGlobalDynFlags
-- check if SSE is enabled, we might have x86-64 imply the -msse2
-- flag.
+isSseEnabled :: DynFlags -> Bool
+isSseEnabled dflags = case platformArch (targetPlatform dflags) of
+ ArchX86_64 -> True
+ ArchX86 -> sseVersion dflags >= Just (1,0)
+ _ -> False
+
isSse2Enabled :: DynFlags -> Bool
isSse2Enabled dflags = case platformArch (targetPlatform dflags) of
ArchX86_64 -> -- SSE2 is fixed on for x86_64. It would be
More information about the ghc-commits
mailing list