aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-10 05:00:43 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-14 08:27:03 +0200
commitc64c45ef1e42bbbae45d78b4f832163e461f141d (patch)
tree8941eed35cef54cb81b72570ca27245afd14d1bb /Makefile
parent585ce41a3647bff2a17f42fbdf4223a92ab81413 (diff)
downloadffwd-c64c45ef1e42bbbae45d78b4f832163e461f141d.tar.gz
ffwd-c64c45ef1e42bbbae45d78b4f832163e461f141d.zip
build: allow FP reassociation/contraction, keep finite-math off
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 4db4490..728dfa4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,11 @@
CC = gcc
-# Keep IEEE math semantics by default. Some GCC/OpenBLAS Linux builds produced
-# NaN embeddings with -ffast-math.
-CFLAGS_BASE = -Wall -Wextra -O3 -march=native
+# Allow FP reassociation and contraction so reduction loops vectorize, but do
+# not assume finite math or approximate libm calls: full -ffast-math produced
+# NaN embeddings on GCC/OpenBLAS Linux builds (-ffinite-math-only and
+# -fapprox-func are the unsafe parts and stay off).
+CFLAGS_BASE = -Wall -Wextra -O3 -march=native \
+ -fno-math-errno -ffp-contract=fast -fno-trapping-math \
+ -fno-signed-zeros -fassociative-math -freciprocal-math
LDFLAGS = -lm -lpthread
CJSON_CFLAGS ?= $(shell sh -c 'pkg-config --cflags libcjson 2>/dev/null')
CJSON_LDFLAGS ?= $(shell sh -c 'pkg-config --libs libcjson 2>/dev/null')