Skip to content

Commit cdce149

Browse files
committed
Merge bitcoin/bitcoin#23045: build: Restrict check for CRC32C intrinsic to aarch64
f2747d1 build: Restrict check for CRC32C intrinsic to aarch64 (W. J. van der Laan) Pull request description: `crc32c`'s hardware accelerated code doesn't handle ARM 32-bit at all, but only 64-bit. Make the check in `configure.ac` check for this architecture explicitly. This change does not affect non-ARM architectures. For the release binaries, the current `configure.ac` check happens to work: it enables it on aarch64 but disables it for armhf. However some combination of compiler version and settings can cause this check to succeed on armhf (as reported on IRC). So make the 64-bit platform requirement explicit. (details: while the check already explicitly checks the `__crc32d` intrinsic, which strictly doesn't exist on 32-bit ARM, this is not enough! gcc happens to helpfully emulate it: > These built-in intrinsics for the ARMv8-A CRC32 extension are available when the -march=armv8-a+crc switch is used "uint32_t __crc32d (uint32_t, uint64_t)" Form of expected instruction(s): Two crc32w r0, r0, r0 instructions for AArch32 ) ACKs for top commit: luke-jr: re-tACK f2747d1 jarolrod: ACK f2747d1 Tree-SHA512: e5f05f05eeec310ac42685621d86862735586be66dc378db404ec9414ac5aaea7c53d76d76d875b15b11924eee6714076120c07b077183fd7af898704fd81823
2 parents 86c3b84 + f2747d1 commit cdce149

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

configure.ac

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,13 +568,17 @@ AX_CHECK_COMPILE_FLAG([-march=armv8-a+crc+crypto],[[ARM_CRC_CXXFLAGS="-march=arm
568568

569569
TEMP_CXXFLAGS="$CXXFLAGS"
570570
CXXFLAGS="$CXXFLAGS $ARM_CRC_CXXFLAGS"
571-
AC_MSG_CHECKING(for ARM CRC32 intrinsics)
571+
AC_MSG_CHECKING(for AArch64 CRC32 intrinsics)
572572
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
573573
#include <arm_acle.h>
574574
#include <arm_neon.h>
575575
]],[[
576+
#ifdef __aarch64__
576577
__crc32cb(0, 0); __crc32ch(0, 0); __crc32cw(0, 0); __crc32cd(0, 0);
577578
vmull_p64(0, 0);
579+
#else
580+
#error "crc32c library does not support hardware acceleration on 32-bit ARM"
581+
#endif
578582
]])],
579583
[ AC_MSG_RESULT(yes); enable_arm_crc=yes; ],
580584
[ AC_MSG_RESULT(no)]

0 commit comments

Comments
 (0)