aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-03-14 21:57:05 +0100
committerTom Smeding <tom@tomsmeding.com>2025-03-14 21:57:05 +0100
commit308ca9fac150cd28d62afef852f26ae4c40fa5a0 (patch)
tree85f3fa346f91d4d00a5ba20f68a053f82280d04a
parentdea00517a29330073049bcab2643d31b3fab85a3 (diff)
Provide +nonportable-simd flag
-rw-r--r--ox-arrays.cabal14
1 files changed, 13 insertions, 1 deletions
diff --git a/ox-arrays.cabal b/ox-arrays.cabal
index 1253956..19a61ab 100644
--- a/ox-arrays.cabal
+++ b/ox-arrays.cabal
@@ -17,6 +17,16 @@ flag trace-wrappers
default: False
manual: True
+flag nonportable-simd
+ description:
+ Assume the binary will be run on the same CPU as where it is built. Setting
+ this flag causes `-march=native` to be passed to the C compiler when
+ compiling arithmetic operations. The result is generally much faster
+ arithmetic operations, but the executable is much less portable to
+ different computers.
+ default: False
+ manual: True
+
library
exposed-modules:
Data.Array.Mixed.Internal.Arith
@@ -53,7 +63,9 @@ library
c-sources: cbits/arith.c
cc-options: -O3 -Wall -Wextra -std=c99
- if arch(x86_64) || arch(i386)
+ if flag(nonportable-simd)
+ cc-options: -march=native
+ elif arch(x86_64) || arch(i386)
-- hmatrix assumes sse2, so we can too
cc-options: -msse2