mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
Merge pull request #11391 from agraf/fix-aarch64-crc-v3
AArch64: Detect crc32 extension support from assembler Reviewed-by: Yazen Ghannam <yazen.ghannam@linaro.org> Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
commit
0f85b344b3
@ -16,9 +16,20 @@
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
|
||||
set(HAVE_ARM 1)
|
||||
CHECK_C_COMPILER_FLAG(-march=armv8-a+crc HAVE_ARMV8_CRC)
|
||||
set(save_quiet ${CMAKE_REQUIRED_QUIET})
|
||||
set(CMAKE_REQUIRED_QUIET true)
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("
|
||||
#define CRC32CX(crc, value) __asm__(\"crc32cx %w[c], %w[c], %x[v]\":[c]\"+r\"(crc):[v]\"r\"(value))
|
||||
asm(\".arch_extension crc\");
|
||||
unsigned int foo(unsigned int ret) {
|
||||
CRC32CX(ret, 0);
|
||||
return ret;
|
||||
}
|
||||
int main() { foo(0); }" HAVE_ARMV8_CRC)
|
||||
set(CMAKE_REQUIRED_QUIET ${save_quiet})
|
||||
if(HAVE_ARMV8_CRC)
|
||||
set(ARM_CRC_FLAGS "-march=armv8-a+crc")
|
||||
message(STATUS " aarch64 crc extensions supported")
|
||||
endif()
|
||||
CHECK_C_COMPILER_FLAG(-march=armv8-a+simd HAVE_ARMV8_SIMD)
|
||||
if(HAVE_ARMV8_SIMD)
|
||||
|
@ -484,7 +484,6 @@ set_source_files_properties(${CMAKE_SOURCE_DIR}/src/ceph_ver.c
|
||||
include(SIMDExt)
|
||||
if(HAVE_ARMV8_CRC)
|
||||
add_library(common_crc_aarch64 STATIC common/crc32c_aarch64.c)
|
||||
set_target_properties(common_crc_aarch64 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${ARM_CRC_FLAGS}")
|
||||
target_link_libraries(common common_crc_aarch64)
|
||||
endif(HAVE_ARMV8_CRC)
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
#include "include/int_types.h"
|
||||
#include "common/crc32c_aarch64.h"
|
||||
|
||||
/* Request crc extension capabilities from the assembler */
|
||||
asm(".arch_extension crc");
|
||||
|
||||
#define CRC32CX(crc, value) __asm__("crc32cx %w[c], %w[c], %x[v]":[c]"+r"(crc):[v]"r"(value))
|
||||
#define CRC32CW(crc, value) __asm__("crc32cw %w[c], %w[c], %w[v]":[c]"+r"(crc):[v]"r"(value))
|
||||
#define CRC32CH(crc, value) __asm__("crc32ch %w[c], %w[c], %w[v]":[c]"+r"(crc):[v]"r"(value))
|
||||
|
Loading…
Reference in New Issue
Block a user