Debian Codegraph @

ext/zlib-ng/arch/power/power_features.c

raw symbols SCIP
1 /* power_features.c - POWER feature check
2 * Copyright (C) 2020 Matheus Castanho <[email protected]>, IBM
3 * Copyright (C) 2021-2022 Mika T. Lindqvist <[email protected]>
4 * For conditions of distribution and use, see copyright notice in zlib.h
5 */
6
7 #ifdef HAVE_SYS_AUXV_H
8 # include <sys/auxv.h>
9 #endif
10 #include "../../zbuild.h"
11 #include "power_features.h"
12
13 Z_INTERNAL int power_cpu_has_altivec = 0;
14 Z_INTERNAL int power_cpu_has_arch_2_07 = 0;
15 Z_INTERNAL int power_cpu_has_arch_3_00 = 0;
16
17 void Z_INTERNAL power_check_features(void) {
18 #ifdef PPC_FEATURES
19 unsigned long hwcap;
20 hwcap = getauxval(AT_HWCAP);
21
22 if (hwcap & PPC_FEATURE_HAS_ALTIVEC)
23 power_cpu_has_altivec = 1;
24 #endif
25
26 #ifdef POWER_FEATURES
27 unsigned long hwcap2;
28 hwcap2 = getauxval(AT_HWCAP2);
29
30 if (hwcap2 & PPC_FEATURE2_ARCH_2_07)
31 power_cpu_has_arch_2_07 = 1;
32 if (hwcap2 & PPC_FEATURE2_ARCH_3_00)
33 power_cpu_has_arch_3_00 = 1;
34 #endif
35 }