Add CPU feature queries for AIX

Also see the discussion at https://github.com/noloader/POWER8-crypto
pull/603/head
Jeffrey Walton 2018-03-20 23:52:10 -04:00
parent e7be3a8357
commit 04e361889e
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 17 additions and 8 deletions

25
cpu.cpp
View File

@ -623,7 +623,10 @@ inline bool CPU_QueryPower7()
{
// Power7 and ISA 2.06
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE_ARCH_2_06)
if (getauxval(AT_HWCAP2) & PPC_FEATURE_ARCH_2_06 != 0)
return true;
#elif defined(_AIX)
if (__power_8_andup() != 0)
return true;
#endif
return false;
@ -633,7 +636,10 @@ inline bool CPU_QueryPower8()
{
// Power8 and ISA 2.07 provide in-core crypto.
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07 != 0)
return true;
#elif defined(_AIX)
if (__power_8_andup() != 0)
return true;
#endif
return false;
@ -646,8 +652,9 @@ inline bool CPU_QueryAES()
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO)
return true;
//if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
// return true;
#elif defined(_AIX)
if (__power_8_andup() != 0)
return true;
#endif
return false;
}
@ -659,8 +666,9 @@ inline bool CPU_QuerySHA256()
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO)
return true;
//if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
// return true;
#elif defined(_AIX)
if (__power_8_andup() != 0)
return true;
#endif
return false;
}
@ -671,8 +679,9 @@ inline bool CPU_QuerySHA512()
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO)
return true;
//if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
// return true;
#elif defined(_AIX)
if (__power_8_andup() != 0)
return true;
#endif
return false;
}