Add Windows ARM NEON dtection

This commit is contained in:
Jeffrey Walton 2016-05-06 01:28:06 -04:00
parent f0e8a2b137
commit 15900246bb
3 changed files with 12 additions and 7 deletions

View File

@ -518,8 +518,8 @@ NAMESPACE_END
#endif
#if !defined(CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE)
# if (defined(CRYPTOPP_BOOL_ARM32) || defined(CRYPTOPP_BOOL_ARM64)) && ((CRYPTOPP_GCC_VERSION >= 40400) || (CRYPTOPP_CLANG_VERSION >= 20800))
# if defined(__ARM_NEON__) || defined(__ARM_NEON)
# if (defined(CRYPTOPP_BOOL_ARM32) || defined(CRYPTOPP_BOOL_ARM64)) && ((CRYPTOPP_GCC_VERSION >= 40400) || (CRYPTOPP_CLANG_VERSION >= 20800) || (CRYPTOPP_MSC_VERSION >= 1700))
# if defined(__ARM_NEON__) || defined(__ARM_NEON) || defined(_M_ARM)
# define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
# endif
# endif

View File

@ -395,8 +395,8 @@ NAMESPACE_END
#endif
#if !defined(CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE)
# if (defined(CRYPTOPP_BOOL_ARM32) || defined(CRYPTOPP_BOOL_ARM64)) && ((CRYPTOPP_GCC_VERSION >= 40400) || (CRYPTOPP_CLANG_VERSION >= 20800))
# if defined(__ARM_NEON__) || defined(__ARM_NEON)
# if (defined(CRYPTOPP_BOOL_ARM32) || defined(CRYPTOPP_BOOL_ARM64)) && ((CRYPTOPP_GCC_VERSION >= 40400) || (CRYPTOPP_CLANG_VERSION >= 20800) || (CRYPTOPP_MSC_VERSION >= 1700))
# if defined(__ARM_NEON__) || defined(__ARM_NEON) || defined(_M_ARM)
# define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
# endif
# endif

View File

@ -23,8 +23,10 @@
#endif
#if CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE
# if defined(__linux__)
# include <sys/auxv.h>
# include <asm/hwcap.h>
# endif
# include <arm_neon.h>
#endif
@ -258,6 +260,7 @@ void DetectX86Features()
}
// http://community.arm.com/groups/android-community/blog/2014/10/10/runtime-detection-of-cpu-features-on-an-armv8-a-cpu
// http://stackoverflow.com/questions/26701262/how-to-check-the-existence-of-neon-on-arm
#elif defined(CRYPTOPP_BOOL_ARM32) || defined (CRYPTOPP_BOOL_ARM64)
bool g_ArmDetectionDone = false;
@ -282,6 +285,8 @@ void DetectArmFeatures()
# elif defined(__linux__)
const long hwcaps = getauxval(AT_HWCAP);
g_hasNEON = !!(hwcaps & HWCAP_ARM_NEON);
# elif defined(_WIN32) && defined(_M_ARM)
g_hasNEON = true;
# endif
#endif
*((volatile bool*)&g_ArmDetectionDone) = true;