diff --git a/CMakeLists.txt b/CMakeLists.txt index ff03e675da..98448dbc62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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("$<$:-ffp-contract=off>") + if(X86) # enable sse2 code generation (enabled by default on X86_64) if(NOT MACOSX) diff --git a/android/jni/Locals.mk b/android/jni/Locals.mk index c4033435c5..bcaac1e061 100644 --- a/android/jni/Locals.mk +++ b/android/jni/Locals.mk @@ -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)/../.. \ diff --git a/libretro/Makefile b/libretro/Makefile index f3a60535cc..35c739f73b 100644 --- a/libretro/Makefile +++ b/libretro/Makefile @@ -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