summaryrefslogtreecommitdiffstats
path: root/mysys/crc32
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-01 18:15:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-01 18:15:00 +0000
commita2a2e32c02643a0cec111511220227703fda1cd5 (patch)
tree69cc2b631234c2a8e026b9cd4d72676c61c594df /mysys/crc32
parentReleasing progress-linux version 1:10.11.8-1~progress7.99u1. (diff)
downloadmariadb-a2a2e32c02643a0cec111511220227703fda1cd5.tar.xz
mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.zip
Merging upstream version 1:11.4.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysys/crc32')
-rw-r--r--mysys/crc32/crc32_arm64.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/mysys/crc32/crc32_arm64.c b/mysys/crc32/crc32_arm64.c
index 6588606a..df7e6936 100644
--- a/mysys/crc32/crc32_arm64.c
+++ b/mysys/crc32/crc32_arm64.c
@@ -7,7 +7,23 @@ typedef unsigned (*my_crc32_t)(unsigned, const void *, size_t);
#ifdef HAVE_ARMV8_CRC
-# ifdef HAVE_ARMV8_CRYPTO
+#ifdef _WIN32
+#include <windows.h>
+int crc32_aarch64_available(void)
+{
+ return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
+}
+
+const char *crc32c_aarch64_available(void)
+{
+ if (crc32_aarch64_available() == 0)
+ return NULL;
+ /* TODO : pmull seems supported, but does not compile*/
+ return "Using ARMv8 crc32 instructions";
+}
+#endif /* _WIN32 */
+
+#ifdef HAVE_ARMV8_CRYPTO
static unsigned crc32c_aarch64_pmull(unsigned, const void *, size_t);
# endif
@@ -31,7 +47,8 @@ my_crc32_t crc32c_aarch64_available(void)
# endif
return NULL;
}
-# else
+
+# else /* __APPLE__ */
# include <sys/auxv.h>
# ifdef __FreeBSD__
static unsigned long getauxval(unsigned int key)
@@ -61,7 +78,7 @@ int crc32_aarch64_available(void)
unsigned long auxv= getauxval(AT_HWCAP);
return (auxv & HWCAP_CRC32) != 0;
}
-# endif
+# endif /* __APPLE__ */
# ifndef __APPLE__
static unsigned crc32c_aarch64(unsigned, const void *, size_t);
@@ -78,7 +95,7 @@ my_crc32_t crc32c_aarch64_available(void)
# endif
return crc32c_aarch64;
}
-# endif
+# endif /* __APPLE__ */
const char *crc32c_aarch64_impl(my_crc32_t c)
{
@@ -123,7 +140,10 @@ asm(".arch_extension crypto");
#else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
/* Intrinsics header*/
+#ifndef _WIN32
#include <arm_acle.h>
+#endif
+
#include <arm_neon.h>
#define CRC32CX(crc, value) (crc) = __crc32cd((crc), (value))