diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/include/numpy/npy_common.h | 8 | ||||
-rw-r--r-- | numpy/core/include/numpy/npy_cpu.h | 3 | ||||
-rw-r--r-- | numpy/core/src/multiarray/compiled_base.c | 7 |
3 files changed, 9 insertions, 9 deletions
diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h index c8495db8e..d5a586c56 100644 --- a/numpy/core/include/numpy/npy_common.h +++ b/numpy/core/include/numpy/npy_common.h @@ -10,6 +10,14 @@ #include <npy_config.h> #endif +// int*, int64* should be propertly aligned on ARMv7 to avoid bus error +#if !defined(NPY_STRONG_ALIGNMENT) && defined(__arm__) && !(defined(__aarch64__) || defined(_M_ARM64)) +#define NPY_STRONG_ALIGNMENT 1 +#endif +#if !defined(NPY_STRONG_ALIGNMENT) +#define NPY_STRONG_ALIGNMENT 0 +#endif + // compile time environment variables #ifndef NPY_RELAXED_STRIDES_CHECKING #define NPY_RELAXED_STRIDES_CHECKING 0 diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h index 88f22a248..4dbf9d84e 100644 --- a/numpy/core/include/numpy/npy_cpu.h +++ b/numpy/core/include/numpy/npy_cpu.h @@ -84,9 +84,6 @@ # error Unknown ARM CPU, please report this to numpy maintainers with \ information about your platform (OS, CPU and compiler) #endif - #if !(defined(__aarch64__) || defined(_M_ARM64)) - #define NPY_CPU_ARMV7 - #endif #elif defined(__sh__) && defined(__LITTLE_ENDIAN__) #define NPY_CPU_SH_LE #elif defined(__sh__) && defined(__BIG_ENDIAN__) diff --git a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarray/compiled_base.c index 3b5322c15..f09a1de32 100644 --- a/numpy/core/src/multiarray/compiled_base.c +++ b/numpy/core/src/multiarray/compiled_base.c @@ -20,11 +20,6 @@ typedef enum { PACK_ORDER_BIG } PACK_ORDER; -#ifdef NPY_CPU_ARMV7 - #define ISARMV7 1 -#else - #define ISARMV7 0 -#endif /* * Returns -1 if the array is monotonic decreasing, * +1 if the array is monotonic increasing, @@ -1525,7 +1520,7 @@ pack_inner(const char *inptr, bb[2] = npyv_tobits_b8(npyv_cmpneq_u8(v2, v_zero)); bb[3] = npyv_tobits_b8(npyv_cmpneq_u8(v3, v_zero)); if(out_stride == 1 && - (!ISARMV7 || npy_is_aligned(outptr, sizeof(npy_uint64)))) { + (!NPY_STRONG_ALIGNMENT || npy_is_aligned(outptr, sizeof(npy_uint64)))) { npy_uint64 *ptr64 = (npy_uint64*)outptr; #if NPY_SIMD_WIDTH == 16 npy_uint64 bcomp = bb[0] | (bb[1] << 16) | (bb[2] << 32) | (bb[3] << 48); |