Add Android CPU feature detection code
Also see https://developer.android.com/ndk/guides/cpu-features.htmlpull/461/head
parent
a04dda56fa
commit
d95a38a9fc
|
|
@ -81,8 +81,11 @@ bool CPU_TryCRC32_ARMV8()
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
|
# if defined(__android__)
|
||||||
|
if (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_CRC32)
|
||||||
|
return true;
|
||||||
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
||||||
# if defined(__linux__) && defined(__aarch64__)
|
# elif defined(__linux__) && defined(__aarch64__)
|
||||||
if (getauxval(AT_HWCAP) & HWCAP_CRC32)
|
if (getauxval(AT_HWCAP) & HWCAP_CRC32)
|
||||||
return true;
|
return true;
|
||||||
# elif defined(__linux__) && defined(__aarch32__)
|
# elif defined(__linux__) && defined(__aarch32__)
|
||||||
|
|
|
||||||
|
|
@ -214,8 +214,11 @@ bool CPU_TryPMULL_ARMV8()
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
# else
|
# else
|
||||||
|
# if defined(__android__)
|
||||||
|
if (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_PMULL)
|
||||||
|
return true;
|
||||||
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
||||||
# if defined(__linux__) && defined(__aarch64__)
|
# elif defined(__linux__) && defined(__aarch64__)
|
||||||
if (getauxval(AT_HWCAP) & HWCAP_PMULL)
|
if (getauxval(AT_HWCAP) & HWCAP_PMULL)
|
||||||
return true;
|
return true;
|
||||||
# elif defined(__linux__) && defined(__aarch32__)
|
# elif defined(__linux__) && defined(__aarch32__)
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,11 @@ bool CPU_TryAES_ARMV8()
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
# else
|
# else
|
||||||
|
# if defined(__android__)
|
||||||
|
if (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_AES)
|
||||||
|
return true;
|
||||||
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
||||||
# if defined(__linux__) && defined(__aarch64__)
|
# elif defined(__linux__) && defined(__aarch64__)
|
||||||
if (getauxval(AT_HWCAP) & HWCAP_AES)
|
if (getauxval(AT_HWCAP) & HWCAP_AES)
|
||||||
return true;
|
return true;
|
||||||
# elif defined(__linux__) && defined(__aarch32__)
|
# elif defined(__linux__) && defined(__aarch32__)
|
||||||
|
|
|
||||||
13
sha-simd.cpp
13
sha-simd.cpp
|
|
@ -91,8 +91,11 @@ bool CPU_TrySHA1_ARMV8()
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
# else
|
# else
|
||||||
|
# if defined(__android__)
|
||||||
|
if (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SHA1)
|
||||||
|
return true;
|
||||||
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
||||||
# if defined(__linux__) && defined(__aarch64__)
|
# elif defined(__linux__) && defined(__aarch64__)
|
||||||
if (getauxval(AT_HWCAP) & HWCAP_SHA1)
|
if (getauxval(AT_HWCAP) & HWCAP_SHA1)
|
||||||
return true;
|
return true;
|
||||||
# elif defined(__linux__) && defined(__aarch32__)
|
# elif defined(__linux__) && defined(__aarch32__)
|
||||||
|
|
@ -158,11 +161,15 @@ bool CPU_TrySHA2_ARMV8()
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
# if defined(__linux__) && defined(__aarch64__)
|
# if defined(__android__)
|
||||||
|
if (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SHA2)
|
||||||
|
return true;
|
||||||
|
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
|
||||||
|
# elif defined(__linux__) && defined(__aarch64__)
|
||||||
if (getauxval(AT_HWCAP) & HWCAP_SHA2)
|
if (getauxval(AT_HWCAP) & HWCAP_SHA2)
|
||||||
return true;
|
return true;
|
||||||
# elif defined(__linux__) && defined(__aarch32__)
|
# elif defined(__linux__) && defined(__aarch32__)
|
||||||
if (getauxval(AT_HWCAP) & HWCAP_SHA2)
|
if (getauxval(AT_HWCAP2) & HWCAP2_SHA2)
|
||||||
return true;
|
return true;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue