From e153ffb526475b498a99d3c9b3a42017b6273e5f Mon Sep 17 00:00:00 2001 From: doyougnu Date: Tue, 12 Sep 2023 16:58:42 -0400 Subject: [PATCH] cabal: add no-msse4.2 flag - Closes #464 --- unordered-containers.cabal | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/unordered-containers.cabal b/unordered-containers.cabal index d16adc73..74d443a4 100644 --- a/unordered-containers.cabal +++ b/unordered-containers.cabal @@ -42,6 +42,13 @@ flag debug description: Enable debug support default: False +flag no-msse4.2 + description: Instruct GHC to *not* use -msse4.2. Typical use is for older + architectures to use unordered-containers. Expect performance + regressions on newer architectures. + default: False + + library exposed-modules: Data.HashMap.Internal @@ -69,7 +76,15 @@ library MagicHash, BangPatterns - ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans + if flag(no-msse4.2) + ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans + else + -- only enable flag on x86 + if arch(i386) || arch(x86_64) + ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans -msse4.2 + else + -- else, get whatever GHC gives you + ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans -- For dumping the generated code: -- ghc-options: -ddump-simpl -ddump-stg-final -ddump-cmm -ddump-asm -ddump-to-file