diff options
author | Geoffrey Mainland <gmainlan@microsoft.com> | 2013-09-16 12:27:37 -0400 |
---|---|---|
committer | Geoffrey Mainland <gmainlan@microsoft.com> | 2013-09-22 22:34:00 -0400 |
commit | 1ed36c54d50e0e97aee95d15d674f95cabab0b77 (patch) | |
tree | 3f3b2ebd3459328dbcad5e3f03eaaea85edbef76 | |
parent | d2b95264c97b3d7786b359fbf04fb297a160daa3 (diff) | |
download | haskell-1ed36c54d50e0e97aee95d15d674f95cabab0b77.tar.gz |
Enable -msse to be specified by itself.
This sets the SSE "version" to 1.0.
-rw-r--r-- | compiler/main/CmdLineParser.hs | 2 | ||||
-rw-r--r-- | compiler/main/DriverPipeline.hs | 11 | ||||
-rw-r--r-- | 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 6681186246..fef2701bcd 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 63f203aaf5..44a6fa57a1 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 37f35e61d6..d6b386a475 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 |