Skip to content

Commit 1c9160a

Browse files
author
doyougnu
committed
cabal: add no-msse4.2 flag
- Closes haskell-unordered-containers#464
1 parent 259dc9e commit 1c9160a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

unordered-containers.cabal

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ flag debug
4242
description: Enable debug support
4343
default: False
4444

45+
flag noMsse42
46+
description: Instruct GHC to *not* use -msse4.2. Typical use case is to allow
47+
older architectures to use unordered-containers. Only relevant
48+
for x86; expect performance regressions on newer architectures
49+
when enabled.
50+
default: False
51+
52+
4553
library
4654
exposed-modules:
4755
Data.HashMap.Internal
@@ -69,7 +77,15 @@ library
6977
MagicHash,
7078
BangPatterns
7179

72-
ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans
80+
if flag(noMsse42)
81+
ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans
82+
else
83+
-- only enable flag on x86
84+
if arch(i386) || arch(x86_64)
85+
ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans -msse4.2
86+
else
87+
-- else, get whatever GHC gives you
88+
ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans
7389

7490
-- For dumping the generated code:
7591
-- ghc-options: -ddump-simpl -ddump-stg-final -ddump-cmm -ddump-asm -ddump-to-file

0 commit comments

Comments
 (0)