aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4803b475b..e3389cea9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -769,6 +769,16 @@ else()
# - we don't deal with Inf/NaN or signed zero
set(MATH_FLAGS "-fno-math-errno -fno-trapping-math -ffinite-math-only -fno-signed-zeros")
+ # Enable SSE for floating point math on 32-bit x86 by default
+ # reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ check_c_source_compiles("#ifndef __i686__\n#error\n#endif\nint main(){}" IS_I686)
+ if(IS_I686)
+ message(STATUS "Detected Intel x86: using SSE instead of x87 FPU")
+ set(OTHER_FLAGS "${OTHER_FLAGS} -mfpmath=sse -msse")
+ endif()
+ endif()
+
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} ${OTHER_FLAGS} -Wall -pipe -funroll-loops")
if(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")