summaryrefslogtreecommitdiffstats
path: root/cmake/modules/SIMDExt.cmake
diff options
context:
space:
mode:
authorwei xiao <wei.xiao@linaro.org>2017-01-13 05:36:39 +0100
committerwei xiao <wei.xiao@linaro.org>2017-02-04 07:20:50 +0100
commitb0ae5ae2adda63260d1eacc58aa0a798645f5965 (patch)
treea814ff7777bb7896acf77c441845315a29805acf /cmake/modules/SIMDExt.cmake
parentMerge pull request #13080 from yuyuyu101/wip-async-fd (diff)
downloadceph-b0ae5ae2adda63260d1eacc58aa0a798645f5965.tar.xz
ceph-b0ae5ae2adda63260d1eacc58aa0a798645f5965.zip
crc32c: optimize aarch64 crc32c implementation
ARMv8 defines PMULL crypto instruction. This patch optimizes crc32c calculate with the instruction when available rather than original linear crc instructions. ceph crc32c performance unit test shows that the optimization get ~ x3.90 speedups on ThunderX ARM Core@2.0GHz (Cavium) ~ x1.45 speedups on ARM Cortex-A57@2.1GHz (Huaiwei) ~ x1.16 speedups on ARM Cortex-A57@2.0GHz (Softiron) Jira: ENTLLT-358 Change-Id: I657422cd20c9ca78237cd060210a5383f4122575 Signed-off-by: wei xiao <wei.xiao@linaro.org>
Diffstat (limited to 'cmake/modules/SIMDExt.cmake')
-rw-r--r--cmake/modules/SIMDExt.cmake19
1 files changed, 17 insertions, 2 deletions
diff --git a/cmake/modules/SIMDExt.cmake b/cmake/modules/SIMDExt.cmake
index a984b51e689..a879ef3470f 100644
--- a/cmake/modules/SIMDExt.cmake
+++ b/cmake/modules/SIMDExt.cmake
@@ -27,22 +27,37 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
return ret;
}
int main() { foo(0); }" HAVE_ARMV8_CRC)
+ check_cxx_source_compiles("
+ asm(\".arch_extension crypto\");
+ unsigned int foo(unsigned int ret) {
+ __asm__(\"pmull v2.1q, v2.1d, v1.1d\");
+ return ret;
+ }
+ int main() { foo(0); }" HAVE_ARMV8_CRYPTO)
set(CMAKE_REQUIRED_QUIET ${save_quiet})
if(HAVE_ARMV8_CRC)
message(STATUS " aarch64 crc extensions supported")
endif()
+ if(HAVE_ARMV8_CRYPTO)
+ message(STATUS " aarch64 crypto extensions supported")
+ endif()
+ CHECK_C_COMPILER_FLAG(-march=armv8-a+crc+crypto HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
+ if(HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
+ message(STATUS " aarch64 crc+crypto intrinsics supported")
+ set(ARMV8_CRC_COMPILE_FLAGS "${ARMV8_CRC_COMPILE_FLAGS} -march=armv8-a+crc+crypto")
+ endif()
CHECK_C_COMPILER_FLAG(-march=armv8-a+simd HAVE_ARMV8_SIMD)
if(HAVE_ARMV8_SIMD)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -march=armv8-a+simd")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
- set(HAVE_ARM 1)
+ set(HAVE_ARM 1)
CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_ARM_NEON)
if(HAVE_ARM_NEON)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mfpu=neon")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64")
- set(HAVE_INTEL 1)
+ set(HAVE_INTEL 1)
CHECK_C_COMPILER_FLAG(-msse HAVE_INTEL_SSE)
if(HAVE_INTEL_SSE)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse")