Simplify CRYPTO_FLAGS logic, remove RYZEN_HACK

We currently spend a bunch of time setting CRYPTO_FLAGS and then just
completely wipe it out if NATIVE_BUILD is specified.

The AMD_RYZEN_HACK is really not needed; it was only some early CPU
microcode and compiler combinations that had trouble detecting Ryzen's
FMA3 support (and Ryzen *doesn't* properly support FMA4--it can be
forced on and runs, but apparently it can give wrong results).
pull/1024/head
Jason Rhinelander 4 years ago
parent 6f3757e933
commit 7cec0db371

@ -11,7 +11,6 @@ project(${PROJECT_NAME} C CXX)
# Core options
option(USE_AVX2 "enable avx2 code" OFF)
option(USE_NETNS "enable networking namespace support. Linux only" OFF)
option(AMD_RYZEN_HACK "hack for AMD Ryzen FPU bug (support FMA3 and FMA4 in FPU, but does not show in CPUID)" OFF)
option(NATIVE_BUILD "optimise for host system and FPU" ON)
option(EMBEDDED_CFG "optimise for older hardware or embedded systems" OFF)
if (NOT MSVC)
@ -162,6 +161,8 @@ endif(WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
if(DEBIAN)
add_definitions(-DDEBIAN)
elseif(NATIVE_BUILD)
set(CRYPTO_FLAGS -march=native -mtune=native)
elseif(NOT NON_PC_TARGET)
if (USE_AVX2)
set(CRYPTO_FLAGS -march=haswell -mtune=haswell -mfpmath=sse)
@ -171,16 +172,6 @@ elseif(NOT NON_PC_TARGET)
endif()
endif()
# only needed if using AVX2
if(AMD_RYZEN_HACK AND USE_AVX2)
set(CRYPTO_FLAGS -march=native -mfpmath=sse -mavx -mavx2 -mfma)
message(WARNING "This option may be removed in a future release. Contact your computer manufacturer for updated ROMs or microcode patches.")
endif(AMD_RYZEN_HACK AND USE_AVX2)
if(NATIVE_BUILD AND NOT DEBIAN)
set(CRYPTO_FLAGS -march=native -mtune=native)
endif()
if(EMBEDDED_CFG)
message(WARNING "This configuration is optimised for older hardware and/or constrained node operation, may result in poor performance on desktop systems")
message(WARNING "For deployment on such systems, all external code (currently, libuv) must also be compiled for the target!")

Loading…
Cancel
Save