From c394fde58a37c2fa4efed39b63d5ff9ac56dad63 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Mon, 24 Jun 2024 04:24:16 +0200 Subject: [PATCH] CMake: Set -ffinite-math-only so math functions get inlined if this is not set, using fminf() actually calls that libm function, if it is set, a CPU instruction that calculates the minimum is generated instead. likely similar for other functions. not sure if this causes trouble anywhere, but I don't think we rely on NaN or INF? --- neo/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 53ffd8c3..727da48a 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -322,9 +322,9 @@ if(D3_COMPILER_IS_GCC_OR_CLANG) set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -D_DEBUG -O0") set(CMAKE_C_FLAGS_DEBUGALL "-g -ggdb -D_DEBUG") set(CMAKE_C_FLAGS_PROFILE "-g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS_RELEASE "-O2 -fno-math-errno -fno-trapping-math -fomit-frame-pointer") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -ggdb -O2 -fno-math-errno -fno-trapping-math -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS_MINSIZEREL "-Os -fno-math-errno -fno-trapping-math -fomit-frame-pointer") + set(CMAKE_C_FLAGS_RELEASE "-O2 -fno-math-errno -fno-trapping-math -ffinite-math-only -fomit-frame-pointer") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -ggdb -O2 -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-omit-frame-pointer") + set(CMAKE_C_FLAGS_MINSIZEREL "-Os -fno-math-errno -fno-trapping-math -ffinite-math-only -fomit-frame-pointer") set(CMAKE_CXX_FLAGS_DEBUGALL ${CMAKE_C_FLAGS_DEBUGALL}) set(CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})