summaryrefslogtreecommitdiff
path: root/storage/rocksdb
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-08-14 18:58:41 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2018-08-15 11:18:49 +0100
commitb795134802c486311e1987f18a95fb17c12935e3 (patch)
treeb4127005557f0953aba0251d8ed84a7a0dd3f500 /storage/rocksdb
parent964ad0c426926034933eb759d34de7379dbf4aed (diff)
downloadmariadb-git-b795134802c486311e1987f18a95fb17c12935e3.tar.gz
MDEV-16859 MyRocks: support SSE42 CRC32-C instruction.
Diffstat (limited to 'storage/rocksdb')
-rw-r--r--storage/rocksdb/build_rocksdb.cmake26
1 files changed, 24 insertions, 2 deletions
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index 0f1b77e255d..895d473c2d4 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -376,9 +376,31 @@ SET(SOURCES)
FOREACH(s ${ROCKSDB_SOURCES})
list(APPEND SOURCES ${ROCKSDB_SOURCE_DIR}/${s})
ENDFOREACH()
-IF(MSVC)
+
+if(MSVC)
add_definitions(-DHAVE_SSE42 -DHAVE_PCLMUL)
-ENDIF()
+else()
+ set(CMAKE_REQUIRED_FLAGS "-msse4.2 -mpclmul ${CXX11_FLAGS}")
+
+ CHECK_CXX_SOURCE_COMPILES("
+#include <cstdint>
+#include <nmmintrin.h>
+#include <wmmintrin.h>
+int main() {
+ volatile uint32_t x = _mm_crc32_u32(0, 0);
+ const auto a = _mm_set_epi64x(0, 0);
+ const auto b = _mm_set_epi64x(0, 0);
+ const auto c = _mm_clmulepi64_si128(a, b, 0x00);
+ auto d = _mm_cvtsi128_si64(c);
+}
+" HAVE_SSE42)
+ if(HAVE_SSE42)
+ set_source_files_properties(${ROCKSDB_SOURCE_DIR}/util/crc32c.cc
+ PROPERTIES COMPILE_FLAGS "-DHAVE_SSE42 -DHAVE_PCLMUL -msse4.2 -mpclmul")
+ endif()
+ unset(CMAKE_REQUIRED_FLAGS)
+endif()
+
IF(CMAKE_VERSION VERSION_GREATER "2.8.10")
STRING(TIMESTAMP GIT_DATE_TIME "%Y-%m-%d %H:%M:%S")
ENDIF()