
On Mon, Sep 23, 2013 at 12:35 AM, Johan Tibell
On Mon, Sep 23, 2013 at 12:12 AM,
wrote: Repository : ssh://git@git.haskell.org/ghc
On branch : wip/simd Link : http://ghc.haskell.org/trac/ghc/changeset/1ed36c54d50e0e97aee95d15d674f95cab...
---------------------------------------------------------------
commit 1ed36c54d50e0e97aee95d15d674f95cabab0b77 Author: Geoffrey Mainland
Date: Mon Sep 16 12:27:37 2013 -0400 Enable -msse to be specified by itself.
This sets the SSE "version" to 1.0.
---------------------------------------------------------------
1ed36c54d50e0e97aee95d15d674f95cabab0b77 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)
This looks wrong. Shouldn't we match on [] here? There's still a possibility that the value after -msse is garbage.
findArg :: [Flag m] -> String -> Maybe (String, OptKind m) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 63f203a..44a6fa5 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1414,6 +1414,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"] @@ -2033,12 +2034,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 37f35e6..d6b386a 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, @@ -3617,6 +3618,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
_______________________________________________ ghc-commits mailing list ghc-commits@haskell.org http://www.haskell.org/mailman/listinfo/ghc-commits