mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-24 10:29:43 +00:00
Add Windows ARM NEON dtection
This commit is contained in:
parent
f0e8a2b137
commit
15900246bb
4
config.h
4
config.h
@ -518,8 +518,8 @@ NAMESPACE_END
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE)
|
#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(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)
|
# if defined(__ARM_NEON__) || defined(__ARM_NEON) || defined(_M_ARM)
|
||||||
# define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
|
# define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
@ -395,8 +395,8 @@ NAMESPACE_END
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE)
|
#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(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)
|
# if defined(__ARM_NEON__) || defined(__ARM_NEON) || defined(_M_ARM)
|
||||||
# define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
|
# define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
11
cpu.cpp
11
cpu.cpp
@ -23,9 +23,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE
|
#if CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE
|
||||||
#include <sys/auxv.h>
|
# if defined(__linux__)
|
||||||
#include <asm/hwcap.h>
|
# include <sys/auxv.h>
|
||||||
#include <arm_neon.h>
|
# include <asm/hwcap.h>
|
||||||
|
# endif
|
||||||
|
# include <arm_neon.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
@ -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://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)
|
#elif defined(CRYPTOPP_BOOL_ARM32) || defined (CRYPTOPP_BOOL_ARM64)
|
||||||
|
|
||||||
bool g_ArmDetectionDone = false;
|
bool g_ArmDetectionDone = false;
|
||||||
@ -282,6 +285,8 @@ void DetectArmFeatures()
|
|||||||
# elif defined(__linux__)
|
# elif defined(__linux__)
|
||||||
const long hwcaps = getauxval(AT_HWCAP);
|
const long hwcaps = getauxval(AT_HWCAP);
|
||||||
g_hasNEON = !!(hwcaps & HWCAP_ARM_NEON);
|
g_hasNEON = !!(hwcaps & HWCAP_ARM_NEON);
|
||||||
|
# elif defined(_WIN32) && defined(_M_ARM)
|
||||||
|
g_hasNEON = true;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
*((volatile bool*)&g_ArmDetectionDone) = true;
|
*((volatile bool*)&g_ArmDetectionDone) = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user