From 0e9ed351a15ed6cebe80ff9f46190f0142d83583 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sun, 27 Sep 2020 08:55:57 +0200 Subject: [PATCH] Fixed SSE4.1 for old CPUs Enable SSE4.1 only where it's needed. --- cmake/flags.cmake | 8 ++++---- cmake/randomx.cmake | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 4ff316e5..5edad339 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -29,8 +29,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -flax-vector-conversions") else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes -msse4.1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes -msse4.1") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") add_definitions(/DHAVE_ROTR) endif() @@ -87,8 +87,8 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -march=${CMAKE_SYSTEM_PROCESSOR}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=${CMAKE_SYSTEM_PROCESSOR}") else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes -msse4.1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes -msse4.1") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") check_symbol_exists("_rotr" "x86intrin.h" HAVE_ROTR) if (HAVE_ROTR) diff --git a/cmake/randomx.cmake b/cmake/randomx.cmake index 0d3f7bab..c86aa171 100644 --- a/cmake/randomx.cmake +++ b/cmake/randomx.cmake @@ -64,6 +64,10 @@ if (WITH_RANDOMX) set_property(SOURCE src/crypto/randomx/jit_compiler_a64_static.S PROPERTY LANGUAGE C) endif() + if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES Clang) + set_source_files_properties(src/crypto/randomx/blake2/blake2b.c PROPERTIES COMPILE_FLAGS -msse4.1) + endif() + if (CMAKE_CXX_COMPILER_ID MATCHES Clang) set_source_files_properties(src/crypto/randomx/jit_compiler_x86.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-const-variable) endif()