From 308ca9fac150cd28d62afef852f26ae4c40fa5a0 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 14 Mar 2025 21:57:05 +0100 Subject: Provide +nonportable-simd flag --- ox-arrays.cabal | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2