From df144244102e7a0c7f3aab3b5640200a27c418a3 Mon Sep 17 00:00:00 2001 From: Koby Kahane Date: Mon, 2 Apr 2018 20:39:11 -0700 Subject: [PATCH] Fix 3-way SSE4.2 crc32c usage in MSVC with CMake Summary: The introduction of the 3-way SSE4.2 optimized crc32c implementation in commit f54d7f5feaff09b0e2bf749ecd77043bcd4141b2 added the `HAVE_PCLMUL` definition when the compiler supports intrinsics for that instruction, but did not modify CMakeLists.txt to set that definition on MSVC when appropriate. As a result, 3-way SSE4.2 is not used in MSVC builds with CMake although it could be. Since the existing test program in CMakeLists.txt for `HAVE_SSE42` already uses `_mm_clmulepi64_si128` which is a PCLMUL instruction, this PR sets `HAVE_PCLMUL` as well if that program builds successfully, fixing the problem. Closes https://github.com/facebook/rocksdb/pull/3673 Differential Revision: D7473975 Pulled By: miasantreble fbshipit-source-id: bc346b9eb38920e427aa1a253e6dd9811efa269e --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe72adfa2..18f896944 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,6 +229,7 @@ int main() { unset(CMAKE_REQUIRED_FLAGS) if(HAVE_SSE42) add_definitions(-DHAVE_SSE42) + add_definitions(-DHAVE_PCLMUL) elseif(FORCE_SSE42) message(FATAL_ERROR "FORCE_SSE42=ON but unable to compile with SSE4.2 enabled") endif()