1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Add CMake checks for getauxval and elf_aux_info for POWER

- Change __unix__ check for feature detection. NetBSD does not
have either API.
- Adds support for OpenBSD/powerpc64.
This commit is contained in:
Brad Smith
2025-01-18 21:34:52 -05:00
parent 1d701d1690
commit 918196ec1b
3 changed files with 13 additions and 4 deletions
+4 -4
View File
@@ -151,7 +151,7 @@ const uint64_t AT_HWCAP = NT_GNU_HWCAP;
#endif
#if (defined __ppc64__ || defined __PPC64__) && defined __unix__
#if ((defined __ppc64__ || defined __PPC64__) && (defined HAVE_GETAUXVAL || defined HAVE_ELF_AUX_INFO))
# include "sys/auxv.h"
# ifndef AT_HWCAP2
# define AT_HWCAP2 26
@@ -686,7 +686,7 @@ struct HWFeatures
have[CV_CPU_MSA] = true;
#endif
#if (defined __ppc64__ || defined __PPC64__) && defined __linux__
#if (defined __ppc64__ || defined __PPC64__) && defined HAVE_GETAUXVAL
unsigned int hwcap = getauxval(AT_HWCAP);
if (hwcap & PPC_FEATURE_HAS_VSX) {
hwcap = getauxval(AT_HWCAP2);
@@ -696,7 +696,7 @@ struct HWFeatures
have[CV_CPU_VSX] = (hwcap & PPC_FEATURE2_ARCH_2_07) != 0;
}
}
#elif (defined __ppc64__ || defined __PPC64__) && defined __FreeBSD__
#elif (defined __ppc64__ || defined __PPC64__) && defined HAVE_ELF_AUX_INFO
unsigned long hwcap = 0;
elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
if (hwcap & PPC_FEATURE_HAS_VSX) {
@@ -708,7 +708,7 @@ struct HWFeatures
}
}
#else
// TODO: AIX, OpenBSD
// TODO: AIX
#if CV_VSX || defined _ARCH_PWR8 || defined __POWER9_VECTOR__
have[CV_CPU_VSX] = true;
#endif