numpy  2.0.0
include/numpy/npy_cpu.h
Go to the documentation of this file.
00001 /*
00002  * This set (target) cpu specific macros:
00003  *      - Possible values:
00004  *              NPY_CPU_X86
00005  *              NPY_CPU_AMD64
00006  *              NPY_CPU_PPC
00007  *              NPY_CPU_PPC64
00008  *              NPY_CPU_PPC64LE
00009  *              NPY_CPU_SPARC
00010  *              NPY_CPU_S390
00011  *              NPY_CPU_IA64
00012  *              NPY_CPU_HPPA
00013  *              NPY_CPU_ALPHA
00014  *              NPY_CPU_ARMEL
00015  *              NPY_CPU_ARMEB
00016  *              NPY_CPU_SH_LE
00017  *              NPY_CPU_SH_BE
00018  */
00019 #ifndef _NPY_CPUARCH_H_
00020 #define _NPY_CPUARCH_H_
00021 
00022 #include "numpyconfig.h"
00023 #include <string.h> /* for memcpy */
00024 
00025 #if defined( __i386__ ) || defined(i386) || defined(_M_IX86)
00026     /*
00027      * __i386__ is defined by gcc and Intel compiler on Linux,
00028      * _M_IX86 by VS compiler,
00029      * i386 by Sun compilers on opensolaris at least
00030      */
00031     #define NPY_CPU_X86
00032 #elif defined(__x86_64__) || defined(__amd64__) || defined(__x86_64) || defined(_M_AMD64)
00033     /*
00034      * both __x86_64__ and __amd64__ are defined by gcc
00035      * __x86_64 defined by sun compiler on opensolaris at least
00036      * _M_AMD64 defined by MS compiler
00037      */
00038     #define NPY_CPU_AMD64
00039 #elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC)
00040     /*
00041      * __ppc__ is defined by gcc, I remember having seen __powerpc__ once,
00042      * but can't find it ATM
00043      * _ARCH_PPC is used by at least gcc on AIX
00044      */
00045     #define NPY_CPU_PPC
00046 #elif defined(__ppc64le__)
00047     #define NPY_CPU_PPC64LE
00048 #elif defined(__ppc64__)
00049     #define NPY_CPU_PPC64
00050 #elif defined(__sparc__) || defined(__sparc)
00051     /* __sparc__ is defined by gcc and Forte (e.g. Sun) compilers */
00052     #define NPY_CPU_SPARC
00053 #elif defined(__s390__)
00054     #define NPY_CPU_S390
00055 #elif defined(__ia64)
00056     #define NPY_CPU_IA64
00057 #elif defined(__hppa)
00058     #define NPY_CPU_HPPA
00059 #elif defined(__alpha__)
00060     #define NPY_CPU_ALPHA
00061 #elif defined(__arm__) && defined(__ARMEL__)
00062     #define NPY_CPU_ARMEL
00063 #elif defined(__arm__) && defined(__ARMEB__)
00064     #define NPY_CPU_ARMEB
00065 #elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
00066     #define NPY_CPU_SH_LE
00067 #elif defined(__sh__) && defined(__BIG_ENDIAN__)
00068     #define NPY_CPU_SH_BE
00069 #elif defined(__MIPSEL__)
00070     #define NPY_CPU_MIPSEL
00071 #elif defined(__MIPSEB__)
00072     #define NPY_CPU_MIPSEB
00073 #elif defined(__or1k__)
00074     #define NPY_CPU_OR1K
00075 #elif defined(__aarch64__)
00076     #define NPY_CPU_AARCH64
00077 #elif defined(__mc68000__)
00078     #define NPY_CPU_M68K
00079 #else
00080     #error Unknown CPU, please report this to numpy maintainers with \
00081     information about your platform (OS, CPU and compiler)
00082 #endif
00083 
00084 #define NPY_COPY_PYOBJECT_PTR(dst, src) memcpy(dst, src, sizeof(PyObject *))
00085 
00086 #if (defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64))
00087 #define NPY_CPU_HAVE_UNALIGNED_ACCESS 1
00088 #else
00089 #define NPY_CPU_HAVE_UNALIGNED_ACCESS 0
00090 #endif
00091 
00092 #endif