codekingpro/portable-devtools
115k
1/*
2 * This set (target) cpu specific macros:
3 * - Possible values:
4 * NPY_CPU_X86
5 * NPY_CPU_AMD64
6 * NPY_CPU_PPC
7 * NPY_CPU_PPC64
8 * NPY_CPU_PPC64LE
9 * NPY_CPU_SPARC
10 * NPY_CPU_S390
11 * NPY_CPU_IA64
12 * NPY_CPU_HPPA
13 * NPY_CPU_ALPHA
14 * NPY_CPU_ARMEL
15 * NPY_CPU_ARMEB
16 * NPY_CPU_SH_LE
17 * NPY_CPU_SH_BE
18 * NPY_CPU_ARCEL
19 * NPY_CPU_ARCEB
20 * NPY_CPU_RISCV64
21 * NPY_CPU_RISCV32
22 * NPY_CPU_LOONGARCH
23 * NPY_CPU_SW_64
24 * NPY_CPU_WASM
25 */
26#ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_CPU_H_
27#define NUMPY_CORE_INCLUDE_NUMPY_NPY_CPU_H_
28
29#include "numpyconfig.h"
30
31#if defined( __i386__ ) || defined(i386) || defined(_M_IX86)
32 /*
33 * __i386__ is defined by gcc and Intel compiler on Linux,
34 * _M_IX86 by VS compiler,
35 * i386 by Sun compilers on opensolaris at least
36 */
37 #define NPY_CPU_X86
38#elif defined(__x86_64__) || defined(__amd64__) || defined(__x86_64) || defined(_M_AMD64)
39 /*
40 * both __x86_64__ and __amd64__ are defined by gcc
41 * __x86_64 defined by sun compiler on opensolaris at least
42 * _M_AMD64 defined by MS compiler
43 */
44 #define NPY_CPU_AMD64
45#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
46 #define NPY_CPU_PPC64LE
47#elif defined(__powerpc64__) && defined(__BIG_ENDIAN__)
48 #define NPY_CPU_PPC64
49#elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC)
50 /*
51 * __ppc__ is defined by gcc, I remember having seen __powerpc__ once,
52 * but can't find it ATM
53 * _ARCH_PPC is used by at least gcc on AIX
54 * As __powerpc__ and _ARCH_PPC are also defined by PPC64 check
55 * for those specifically first before defaulting to ppc
56 */
57 #define NPY_CPU_PPC
58#elif defined(__sparc__) || defined(__sparc)
59 /* __sparc__ is defined by gcc and Forte (e.g. Sun) compilers */
60 #define NPY_CPU_SPARC
61#elif defined(__s390__)
62 #define NPY_CPU_S390
63#elif defined(__ia64)
64 #define NPY_CPU_IA64
65#elif defined(__hppa)
66 #define NPY_CPU_HPPA
67#elif defined(__alpha__)
68 #define NPY_CPU_ALPHA
69#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM64)
70 /* _M_ARM64 is defined in MSVC for ARM64 compilation on Windows */
71 #if defined(__ARMEB__) || defined(__AARCH64EB__)
72 #if defined(__ARM_32BIT_STATE)
73 #define NPY_CPU_ARMEB_AARCH32
74 #elif defined(__ARM_64BIT_STATE)
75 #define NPY_CPU_ARMEB_AARCH64
76 #else
77 #define NPY_CPU_ARMEB
78 #endif
79 #elif defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
80 #if defined(__ARM_32BIT_STATE)
81 #define NPY_CPU_ARMEL_AARCH32
82 #elif defined(__ARM_64BIT_STATE) || defined(_M_ARM64) || defined(__AARCH64EL__)
83 #define NPY_CPU_ARMEL_AARCH64
84 #else
85 #define NPY_CPU_ARMEL
86 #endif
87 #else
88 # error Unknown ARM CPU, please report this to numpy maintainers with \
89 information about your platform (OS, CPU and compiler)
90 #endif
91#elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
92 #define NPY_CPU_SH_LE
93#elif defined(__sh__) && defined(__BIG_ENDIAN__)
94 #define NPY_CPU_SH_BE
95#elif defined(__MIPSEL__)
96 #define NPY_CPU_MIPSEL
97#elif defined(__MIPSEB__)
98 #define NPY_CPU_MIPSEB
99#elif defined(__or1k__)
100 #define NPY_CPU_OR1K
101#elif defined(__mc68000__)
102 #define NPY_CPU_M68K
103#elif defined(__arc__) && defined(__LITTLE_ENDIAN__)
104 #define NPY_CPU_ARCEL
105#elif defined(__arc__) && defined(__BIG_ENDIAN__)
106 #define NPY_CPU_ARCEB
107#elif defined(__riscv)
108 #if __riscv_xlen == 64
109 #define NPY_CPU_RISCV64
110 #elif __riscv_xlen == 32
111 #define NPY_CPU_RISCV32
112 #endif
113#elif defined(__loongarch_lp64)
114 #define NPY_CPU_LOONGARCH64
115#elif defined(__sw_64__)
116 #define NPY_CPU_SW_64
117#elif defined(__EMSCRIPTEN__) || defined(__wasm__)
118 /* __EMSCRIPTEN__ is defined by emscripten: an LLVM-to-Web compiler */
119 /* __wasm__ is defined by clang when targeting wasm */
120 #define NPY_CPU_WASM
121#else
122 #error Unknown CPU, please report this to numpy maintainers with \
123 information about your platform (OS, CPU and compiler)
124#endif
125
126#endif /* NUMPY_CORE_INCLUDE_NUMPY_NPY_CPU_H_ */
127 