Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aarch64 - Emit note if crc instructions available and not used #7987

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CMake/HPHPCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ CHECK_CXX_SOURCE_COMPILES("
#endif
int main() { return 0; }" IS_PPC64)

function(AARCH64_HAS_CRC HAS_CRC)
if(NOT AARCH64_TARGET_CPU)
set(CMAKE_REQUIRED_FLAGS "-mcpu=native")
endif()
CHECK_CXX_SOURCE_COMPILES("
int main() {
unsigned x;
unsigned ret;
__asm__ (\"crc32cx %w0, %w1, %x1\"
: \"=r\"(ret)
: \"r\"(x)
); return ret;
}" FOUND_CRC)
set(HAS_CRC ${FOUND_CRC} PARENT_SCOPE)
endfunction()

# using Clang or GCC
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
# Warnings to disable by name, -Wno-${name}
Expand Down Expand Up @@ -226,6 +242,14 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQU
list(APPEND GENERAL_OPTIONS "mno-fix-cortex-a53-843419")
endif()
endif()

AARCH64_HAS_CRC(HAS_CRC)
if(NOT ENABLE_AARCH64_CRC)
if(HAS_CRC)
message(STATUS "AARCH64 Host supports crc instruction.")
message(STATUS "Consider adding -DENABLE_AARCH64_CRC")
endif()
endif()
endif()

# PPC64
Expand Down