Add Altivec detection for PowerMac
We now need to detect Altivec/Power4. Formerly it did not matter so CPU_QueryAltivec simply returned falsepull/548/head
parent
e1c9746b70
commit
43a34590a9
14
cpu.cpp
14
cpu.cpp
|
|
@ -33,7 +33,7 @@
|
||||||
unsigned long int getauxval(unsigned long int) { return 0; }
|
unsigned long int getauxval(unsigned long int) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__aarch64__)
|
#if defined(__APPLE__) && (defined(__aarch64__) || defined(__POWERPC__))
|
||||||
# include <sys/utsname.h>
|
# include <sys/utsname.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -596,6 +596,18 @@ inline bool CPU_QueryAltivec()
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
if (getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC)
|
if (getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC)
|
||||||
return true;
|
return true;
|
||||||
|
#elif defined(__APPLE__) && defined(__POWERPC__)
|
||||||
|
// http://stackoverflow.com/questions/45637888/how-to-determine-armv8-features-at-runtime-on-ios
|
||||||
|
struct utsname systemInfo;
|
||||||
|
systemInfo.machine[0] = '\0';
|
||||||
|
uname(&systemInfo);
|
||||||
|
|
||||||
|
// The machine strings below are known PPC machines
|
||||||
|
std::string machine(systemInfo.machine);
|
||||||
|
if (machine.substr(0, 15) == "Power Macintosh")
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue