Commit 44bb8045 by Derek Mauro Committed by Copybara-Service

CRC: Ensure SupportsArmCRC32PMULL() is defined

This fixes the build on arm64 macOS.

Note that hardware acceleration is not yet enabled on arm64 when not
running under Linux.

Addresses the report from https://github.com/abseil/abseil-cpp/commit/1687dbf814eceb93de2d93f91b31acaab404091c#commitcomment-89529264

PiperOrigin-RevId: 487655295
Change-Id: I168dfc863c960d0b694b26dfcb85ff0fd0e95a1e
parent 04658377
...@@ -206,6 +206,8 @@ CpuType GetCpuType() { ...@@ -206,6 +206,8 @@ CpuType GetCpuType() {
} }
} }
bool SupportsArmCRC32PMULL() { return false; }
#elif defined(__aarch64__) && defined(__linux__) #elif defined(__aarch64__) && defined(__linux__)
#define ABSL_INTERNAL_AARCH64_ID_REG_READ(id, val) \ #define ABSL_INTERNAL_AARCH64_ID_REG_READ(id, val) \
...@@ -240,6 +242,8 @@ bool SupportsArmCRC32PMULL() { ...@@ -240,6 +242,8 @@ bool SupportsArmCRC32PMULL() {
CpuType GetCpuType() { return CpuType::kUnknown; } CpuType GetCpuType() { return CpuType::kUnknown; }
bool SupportsArmCRC32PMULL() { return false; }
#endif #endif
} // namespace crc_internal } // namespace crc_internal
......
...@@ -43,14 +43,12 @@ enum class CpuType { ...@@ -43,14 +43,12 @@ enum class CpuType {
// the host CPU is of unknown type, or if detection otherwise fails. // the host CPU is of unknown type, or if detection otherwise fails.
CpuType GetCpuType(); CpuType GetCpuType();
#if defined(__aarch64__)
// Returns whether the host CPU supports the CPU features needed for our // Returns whether the host CPU supports the CPU features needed for our
// accelerated implementations. The CpuTypes enumerated above apart from // accelerated implementations. The CpuTypes enumerated above apart from
// kUnknown support the required features. On unknown CPUs, we can use // kUnknown support the required features. On unknown CPUs, we can use
// this to see if it's safe to use hardware acceleration, though without any // this to see if it's safe to use hardware acceleration, though without any
// tuning. // tuning.
bool SupportsArmCRC32PMULL(); bool SupportsArmCRC32PMULL();
#endif
} // namespace crc_internal } // namespace crc_internal
ABSL_NAMESPACE_END ABSL_NAMESPACE_END
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment