Commit 151fc0ed authored by Yuqi Gu's avatar Yuqi Gu Committed by Marko Mäkelä

MDEV-23495: Refine Arm64 PMULL runtime check in MariaDB

Raspberry Pi 4 supports crc32 but doesn't support pmull (MDEV-23030).

The PR #1645 offers a solution to fix this issue. But it does not consider
the condition that the target platform does support crc32 but not support PMULL.

In this condition, it should leverage the Arm64 crc32 instruction (__crc32c) and
just only skip parallel computation (pmull/vmull) rather than skip all hardware
crc32 instruction of computation.

The PR also removes unnecessary CRC32_ZERO branch in 'crc32c_aarch64' for MariaDB,
formats the indent and coding style.

Change-Id: I76371a6bd767b4985600e8cca10983d71b7e9459
Signed-off-by: default avatarYuqi Gu <yuqi.gu@arm.com>
parent 0b4ed0b7
...@@ -911,9 +911,7 @@ extern MYSQL_PLUGIN_IMPORT my_crc32_t my_checksum; ...@@ -911,9 +911,7 @@ extern MYSQL_PLUGIN_IMPORT my_crc32_t my_checksum;
#if defined(__GNUC__) && defined(HAVE_ARMV8_CRC) #if defined(__GNUC__) && defined(HAVE_ARMV8_CRC)
int crc32_aarch64_available(void); int crc32_aarch64_available(void);
#if defined(HAVE_ARMV8_CRYPTO) const char *crc32c_aarch64_available(void);
int crc32c_aarch64_available(void);
#endif
#endif #endif
#ifdef DBUG_ASSERT_EXISTS #ifdef DBUG_ASSERT_EXISTS
......
This diff is collapsed.
...@@ -342,11 +342,11 @@ allocations, would not hurt if called twice, but would be pointless. */ ...@@ -342,11 +342,11 @@ allocations, would not hurt if called twice, but would be pointless. */
void ut_crc32_init() void ut_crc32_init()
{ {
#ifndef HAVE_CRC32_VPMSUM #ifndef HAVE_CRC32_VPMSUM
# if defined(__GNUC__) && defined(HAVE_ARMV8_CRC) && defined(HAVE_ARMV8_CRYPTO) # if defined(__GNUC__) && defined(HAVE_ARMV8_CRC)
if (crc32c_aarch64_available()) if (const char *crc32c_implementation= crc32c_aarch64_available())
{ {
ut_crc32_low= crc32c_aarch64; ut_crc32_low= crc32c_aarch64;
ut_crc32_implementation= "Using ARMv8 crc32 + pmull instructions"; ut_crc32_implementation= crc32c_implementation;
return; return;
} }
# elif defined(TRY_SSE4_2) # elif defined(TRY_SSE4_2)
......
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