summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2022-06-12 18:39:29 +0300
committerGitHub <noreply@github.com>2022-06-12 18:39:29 +0300
commit7b94d26d9f7b1f68707f2c496ba67b572fbed303 (patch)
treed8b788f5e316f9916736eb7d25213da649014919 /numpy
parente6d5529dccfec7d1a66929f67f6b04b6ec12f790 (diff)
parent55584dca62eeb47038eebbe0ee6484c3e58c6d9e (diff)
downloadnumpy-7b94d26d9f7b1f68707f2c496ba67b572fbed303.tar.gz
Merge pull request #21734 from hoodmane/check-x86-before-asm
ENH: Check that we are targeting x86 or x64 architecture before using bsr asm instruction
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/common/simd/intdiv.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/src/common/simd/intdiv.h b/numpy/core/src/common/simd/intdiv.h
index fe04e73da..f5066b59b 100644
--- a/numpy/core/src/common/simd/intdiv.h
+++ b/numpy/core/src/common/simd/intdiv.h
@@ -89,7 +89,9 @@ NPY_FINLINE unsigned npyv__bitscan_revnz_u32(npy_uint32 a)
unsigned long rl;
(void)_BitScanReverse(&rl, (unsigned long)a);
r = (unsigned)rl;
-#elif defined(NPY_HAVE_SSE2) && (defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER))
+
+#elif defined(NPY_HAVE_SSE2) && (defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)) \
+ && (defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64))
__asm__("bsr %1, %0" : "=r" (r) : "r"(a));
#elif defined(__GNUC__) || defined(__clang__)
r = 31 - __builtin_clz(a); // performs on arm -> clz, ppc -> cntlzw