mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Improved CPU detection on ARM platforms
This commit is contained in:
parent
8f1a916ac5
commit
582f570600
@ -338,7 +338,14 @@ CPU_haveAltiVec(void)
|
|||||||
return altivec;
|
return altivec;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__ARM_ARCH)
|
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6)
|
||||||
|
static int
|
||||||
|
CPU_haveARMSIMD(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif !defined(__arm__)
|
||||||
static int
|
static int
|
||||||
CPU_haveARMSIMD(void)
|
CPU_haveARMSIMD(void)
|
||||||
{
|
{
|
||||||
@ -403,10 +410,8 @@ CPU_haveARMSIMD(void)
|
|||||||
static int
|
static int
|
||||||
CPU_haveARMSIMD(void)
|
CPU_haveARMSIMD(void)
|
||||||
{
|
{
|
||||||
#if !defined(__ANDROID__) && !defined(__IPHONEOS__) && !defined(__TVOS__)
|
#warning SDL_HasARMSIMD is not implemented for this ARM platform. Write me.
|
||||||
#warning SDL_HasARMSIMD is not implemented for this ARM platform, defaulting to TRUE
|
return 0;
|
||||||
#endif
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -445,15 +450,15 @@ CPU_haveNEON(void)
|
|||||||
# endif
|
# endif
|
||||||
/* All WinRT ARM devices are required to support NEON, but just in case. */
|
/* All WinRT ARM devices are required to support NEON, but just in case. */
|
||||||
return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
|
return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
|
||||||
#elif !defined(__ARM_ARCH)
|
#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8)
|
||||||
return 0; /* not an ARM CPU at all. */
|
|
||||||
#elif __ARM_ARCH >= 8
|
|
||||||
return 1; /* ARMv8 always has non-optional NEON support. */
|
return 1; /* ARMv8 always has non-optional NEON support. */
|
||||||
#elif defined(__APPLE__) && (__ARM_ARCH >= 7)
|
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
|
||||||
/* (note that sysctlbyname("hw.optional.neon") doesn't work!) */
|
/* (note that sysctlbyname("hw.optional.neon") doesn't work!) */
|
||||||
return 1; /* all Apple ARMv7 chips and later have NEON. */
|
return 1; /* all Apple ARMv7 chips and later have NEON. */
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
return 0; /* assume anything else from Apple doesn't have NEON. */
|
return 0; /* assume anything else from Apple doesn't have NEON. */
|
||||||
|
#elif !defined(__arm__)
|
||||||
|
return 0; /* not an ARM CPU at all. */
|
||||||
#elif defined(__QNXNTO__)
|
#elif defined(__QNXNTO__)
|
||||||
return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON;
|
return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON;
|
||||||
#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
|
#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
|
||||||
|
Loading…
Reference in New Issue
Block a user