From da7c89d79d7033a53f30f82da3630ba3a0a77b8d Mon Sep 17 00:00:00 2001 From: Yuqi Gu Date: Wed, 15 May 2019 13:24:36 -0700 Subject: [PATCH] RocksDB Cmake changes for Arm64 CRC32 Optimization (#5304) Summary: Add CMake build for RocksDB CRC32 Optimization on Arm64. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5304 Differential Revision: D15355193 Pulled By: miasantreble fbshipit-source-id: 8d750a444274fbde14e510f51290631a369026b8 --- CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4feee986..5bb0c089f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,15 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") endif(HAS_ALTIVEC) endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") +if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64") + CHECK_C_COMPILER_FLAG("-march=armv8-a+crc" HAS_ARMV8_CRC) + if(HAS_ARMV8_CRC) + message(STATUS " HAS_ARMV8_CRC yes") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a+crc -Wno-unused-function") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crc -Wno-unused-function") + endif(HAS_ARMV8_CRC) +endif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64") + option(PORTABLE "build a portable binary" OFF) option(FORCE_SSE42 "force building with SSE4.2, even when PORTABLE=ON" OFF) if(PORTABLE) @@ -213,7 +222,7 @@ else() if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2") else() - if(NOT HAVE_POWER8) + if(NOT HAVE_POWER8 AND NOT HAS_ARMV8_CRC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") endif() endif() @@ -694,6 +703,11 @@ if(HAVE_POWER8) util/crc32c_ppc_asm.S) endif(HAVE_POWER8) +if(HAS_ARMV8_CRC) + list(APPEND SOURCES + util/crc32c_arm64.cc) +endif(HAS_ARMV8_CRC) + if(WIN32) list(APPEND SOURCES port/win/io_win.cc