23 #if (defined(__linux__) || defined(__ANDROID__)) && HAVE_GETAUXVAL
27 #define HWCAP_AARCH64_ASIMDDP (1 << 20)
28 #define HWCAP2_AARCH64_I8MM (1 << 13)
34 unsigned long hwcap = getauxval(AT_HWCAP);
35 unsigned long hwcap2 = getauxval(AT_HWCAP2);
37 if (hwcap & HWCAP_AARCH64_ASIMDDP)
39 if (hwcap2 & HWCAP2_AARCH64_I8MM)
45 #elif defined(__APPLE__) && HAVE_SYSCTLBYNAME
46 #include <sys/sysctl.h>
55 if (!sysctlbyname(
"hw.optional.arm.FEAT_DotProd", &
value, &
size,
NULL, 0)) {
60 if (!sysctlbyname(
"hw.optional.arm.FEAT_I8MM", &
value, &
size,
NULL, 0)) {
67 #elif defined(__OpenBSD__)
68 #include <machine/armreg.h>
69 #include <machine/cpu.h>
70 #include <sys/types.h>
71 #include <sys/sysctl.h>
77 #ifdef CPU_ID_AA64ISAR0
84 mib[1] = CPU_ID_AA64ISAR0;
86 if (sysctl(mib, 2, &isar0, &
len,
NULL, 0) != -1) {
87 if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL)
92 mib[1] = CPU_ID_AA64ISAR1;
94 if (sysctl(mib, 2, &isar1, &
len,
NULL, 0) != -1) {
95 #ifdef ID_AA64ISAR1_I8MM_IMPL
96 if (ID_AA64ISAR1_I8MM(isar1) >= ID_AA64ISAR1_I8MM_IMPL)
105 #elif defined(_WIN32)
111 #ifdef PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE
112 if (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE))
131 #ifdef __ARM_FEATURE_DOTPROD
134 #ifdef __ARM_FEATURE_MATMUL_INT8