mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Automatically use SSE registers for FP operations on i386 (#11853)
use SSE for floating-point operations to avoid issues with improper fp-rounding and loss of precision when moving fp-data to incompatible or less-precise registers/storage locations https://gcc.gnu.org/wiki/FloatingPointMath https://gcc.gnu.org/wiki/x87note
This commit is contained in:
parent
7f6306ca96
commit
cc64a0405a
@ -286,7 +286,6 @@ endif()
|
|||||||
|
|
||||||
# Subdirectories
|
# Subdirectories
|
||||||
# Be sure to add all relevant definitions above this
|
# Be sure to add all relevant definitions above this
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
|
||||||
|
@ -769,6 +769,16 @@ else()
|
|||||||
# - we don't deal with Inf/NaN or signed zero
|
# - 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")
|
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")
|
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)")
|
if(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")
|
||||||
|
Loading…
Reference in New Issue
Block a user