Skip to content

Commit 979b5c9

Browse files
authored
Merge pull request numpy#29221 from brad0/openbsd_elf_aux_info
ENH: Detect CPU features on OpenBSD ARM and PowerPC64
2 parents 80833c5 + d1c6757 commit 979b5c9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

numpy/_core/src/common/npy_cpu_features.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ npy__cpu_init_features(void)
562562

563563
#elif defined(NPY_CPU_PPC64) || defined(NPY_CPU_PPC64LE)
564564

565-
#if defined(__linux__) || defined(__FreeBSD__)
565+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
566566
#ifdef __FreeBSD__
567567
#include <machine/cpu.h> // defines PPC_FEATURE_HAS_VSX
568568
#endif
@@ -585,7 +585,7 @@ static void
585585
npy__cpu_init_features(void)
586586
{
587587
memset(npy__cpu_have, 0, sizeof(npy__cpu_have[0]) * NPY_CPU_FEATURE_MAX);
588-
#if defined(__linux__) || defined(__FreeBSD__)
588+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
589589
#ifdef __linux__
590590
unsigned int hwcap = getauxval(AT_HWCAP);
591591
if ((hwcap & PPC_FEATURE_HAS_VSX) == 0)
@@ -612,7 +612,7 @@ npy__cpu_init_features(void)
612612
npy__cpu_have[NPY_CPU_FEATURE_VSX2] = (hwcap & PPC_FEATURE2_ARCH_2_07) != 0;
613613
npy__cpu_have[NPY_CPU_FEATURE_VSX3] = (hwcap & PPC_FEATURE2_ARCH_3_00) != 0;
614614
npy__cpu_have[NPY_CPU_FEATURE_VSX4] = (hwcap & PPC_FEATURE2_ARCH_3_1) != 0;
615-
// TODO: AIX, OpenBSD
615+
// TODO: AIX
616616
#else
617617
npy__cpu_have[NPY_CPU_FEATURE_VSX] = 1;
618618
#if defined(NPY_CPU_PPC64LE) || defined(NPY_HAVE_VSX2)
@@ -698,7 +698,7 @@ npy__cpu_init_features_arm8(void)
698698
npy__cpu_have[NPY_CPU_FEATURE_ASIMD] = 1;
699699
}
700700

701-
#if defined(__linux__) || defined(__FreeBSD__)
701+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
702702
/*
703703
* we aren't sure of what kind kernel or clib we deal with
704704
* so we play it safe
@@ -709,7 +709,7 @@ npy__cpu_init_features_arm8(void)
709709
#if defined(__linux__)
710710
__attribute__((weak)) unsigned long getauxval(unsigned long); // linker should handle it
711711
#endif
712-
#ifdef __FreeBSD__
712+
#if defined(__FreeBSD__) || defined(__OpenBSD__)
713713
__attribute__((weak)) int elf_aux_info(int, void *, int); // linker should handle it
714714

715715
static unsigned long getauxval(unsigned long k)
@@ -807,7 +807,7 @@ static void
807807
npy__cpu_init_features(void)
808808
{
809809
memset(npy__cpu_have, 0, sizeof(npy__cpu_have[0]) * NPY_CPU_FEATURE_MAX);
810-
#ifdef __linux__
810+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
811811
if (npy__cpu_init_features_linux())
812812
return;
813813
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy