Build: Turn off floating-point contraction for C++

Clang and GCC fuse a * b + c into one rounding on CPUs that have fused
multiply-add, which on ARM64 made the interpreter's dot products, vavg,
vdet and vqmul round differently from x86-64. Fused operations now only
happen where the code asks for them. MSVC doesn't contract by default.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-24 12:24:43 -06:00
1 parent b9144d4fca
commit 1206528e45
3 files changed
+6 -2

No files matched your search

+3
View File
@@ -496,6 +496,9 @@ if(NOT MSVC)
add_compile_options(-fno-math-errno)
# No fused multiply-adds unless written explicitly, so float results are the same on every CPU.
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-ffp-contract=off>")
if(X86)
# enable sse2 code generation (enabled by default on X86_64)
if(NOT MACOSX)
+1 -1
View File
@@ -4,7 +4,7 @@
LOCAL_CFLAGS := -DUSE_FFMPEG -DWITH_UPNP -DUSING_GLES2 -DZ7_CRC_NUM_TABLES=1 -DMOBILE_DEVICE -O3 -fsigned-char -Wall -Wno-multichar -Wno-unused-variable -fno-strict-aliasing -D__STDC_CONSTANT_MACROS -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
# yes, it's really CPPFLAGS for C++
# deprecated-register is generated by Android default code and causes noise.
LOCAL_CPPFLAGS := -fexceptions -std=c++17 -frtti -Wno-reorder -Wno-deprecated-register -Wno-nullability-completeness
LOCAL_CPPFLAGS := -fexceptions -std=c++17 -ffp-contract=off -frtti -Wno-reorder -Wno-deprecated-register -Wno-nullability-completeness
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../Common \
$(LOCAL_PATH)/../.. \
+2 -1
View File
@@ -448,7 +448,8 @@ else
endif
ifeq (,$(findstring msvc,$(platform)))
CXXFLAGS += -std=c++17
# No fused multiply-adds unless written explicitly, so float results are the same on every CPU.
CXXFLAGS += -std=c++17 -ffp-contract=off
else
CXXFLAGS += -std:c++17
endif