diff options
author | Sayed Adel <seiko@imavr.com> | 2020-11-14 19:26:54 +0000 |
---|---|---|
committer | Sayed Adel <seiko@imavr.com> | 2020-11-14 19:30:45 +0000 |
commit | f9e88280efa4b5c8c4501b12d4f7cb48e12c7e2d (patch) | |
tree | 1108be2a462c40e6f733e21c94779bf1fe79d3af /numpy | |
parent | 5cf7c0749666b3682578d89a2ae397cac2cda919 (diff) | |
download | numpy-f9e88280efa4b5c8c4501b12d4f7cb48e12c7e2d.tar.gz |
MAINT, SIMD: remove unlikely and give constant hint to improve memory access of glibc fallback
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/umath/simd.inc.src | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/numpy/core/src/umath/simd.inc.src b/numpy/core/src/umath/simd.inc.src index c2fc069c6..71ee7e07e 100644 --- a/numpy/core/src/umath/simd.inc.src +++ b/numpy/core/src/umath/simd.inc.src @@ -2679,24 +2679,22 @@ static NPY_GCC_OPT_3 NPY_GCC_TARGET_@ISA@ void } /* process elements using glibc for large elements */ - if (NPY_UNLIKELY(iglibc_mask != 0)) { + if (iglibc_mask != 0) { float NPY_DECL_ALIGNED(@BYTES@) ip_fback[@NUM_LANES@]; _mm@vsize@_store_ps(ip_fback, x_in); if (my_trig_op == npy_compute_cos) { - for (int ii = 0; iglibc_mask != 0; ++ii) { + for (int ii = 0; ii < num_lanes; ++ii, iglibc_mask >>= 1) { if (iglibc_mask & 0x01) { op[ii] = npy_cosf(ip_fback[ii]); } - iglibc_mask = iglibc_mask >> 1; } } else { - for (int ii = 0; iglibc_mask != 0; ++ii) { + for (int ii = 0; ii < num_lanes; ++ii, iglibc_mask >>= 1) { if (iglibc_mask & 0x01) { op[ii] = npy_sinf(ip_fback[ii]); } - iglibc_mask = iglibc_mask >> 1; } } } @@ -3309,15 +3307,14 @@ AVX512F_log_DOUBLE(npy_double * op, } /* call glibc's log func when x around 1.0f */ - if (NPY_UNLIKELY(glibc_mask != 0)) { + if (glibc_mask != 0) { double NPY_DECL_ALIGNED(64) ip_fback[8]; _mm512_store_pd(ip_fback, x_in); - for (int ii = 0; glibc_mask != 0; ++ii) { + for (int ii = 0; ii < 8; ++ii, glibc_mask >>= 1) { if (glibc_mask & 0x01) { op[ii] = npy_log(ip_fback[ii]); } - glibc_mask = glibc_mask >> 1; } } ip += num_lanes * stride; |