From ddf9e70234a2fead75041a1197dce060647e26a1 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 21 Mar 2018 00:35:56 -0400 Subject: [PATCH] Fix Power7 test using PPC_FEATURE_ARCH_2_06 --- cpu.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cpu.cpp b/cpu.cpp index 49bc49f6..875ddd57 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -603,6 +603,9 @@ inline bool CPU_QueryAltivec() #if defined(__linux__) if (getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC) return true; +#elif defined(_AIX) + if (__power_vmx() != 0) + return true; #elif defined(__APPLE__) && defined(__POWERPC__) // http://stackoverflow.com/questions/45637888/how-to-determine-armv8-features-at-runtime-on-ios struct utsname systemInfo; @@ -623,10 +626,10 @@ inline bool CPU_QueryPower7() { // Power7 and ISA 2.06 #if defined(__linux__) - if (getauxval(AT_HWCAP2) & PPC_FEATURE_ARCH_2_06 != 0) + if (getauxval(AT_HWCAP) & PPC_FEATURE_ARCH_2_06 != 0) return true; #elif defined(_AIX) - if (__power_8_andup() != 0) + if (__power_7_andup() != 0) return true; #endif return false; @@ -650,7 +653,7 @@ inline bool CPU_QueryAES() // Power8 and ISA 2.07 provide in-core crypto. Glibc // 2.24 or higher is required for PPC_FEATURE2_VEC_CRYPTO. #if defined(__linux__) - if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO) + if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO != 0) return true; #elif defined(_AIX) if (__power_8_andup() != 0) @@ -664,7 +667,7 @@ inline bool CPU_QuerySHA256() // Power8 and ISA 2.07 provide in-core crypto. Glibc // 2.24 or higher is required for PPC_FEATURE2_VEC_CRYPTO. #if defined(__linux__) - if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO) + if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO != 0) return true; #elif defined(_AIX) if (__power_8_andup() != 0) @@ -677,7 +680,7 @@ inline bool CPU_QuerySHA512() // Power8 and ISA 2.07 provide in-core crypto. Glibc // 2.24 or higher is required for PPC_FEATURE2_VEC_CRYPTO. #if defined(__linux__) - if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO) + if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO != 0) return true; #elif defined(_AIX) if (__power_8_andup() != 0)