MCPcopy Create free account
hub / github.com/numpy/numpy / npyv_load2_till_s32

Function npyv_load2_till_s32

numpy/core/src/common/simd/avx2/memory.h:252–270  ·  view source on GitHub ↗

/ 64-bit nlane

Source from the content-addressed store, hash-verified

250
251//// 64-bit nlane
252NPY_FINLINE npyv_s32 npyv_load2_till_s32(const npy_int32 *ptr, npy_uintp nlane,
253 npy_int32 fill_lo, npy_int32 fill_hi)
254{
255 assert(nlane > 0);
256 const __m256i vfill = npyv_set_s32(
257 fill_lo, fill_hi, fill_lo, fill_hi,
258 fill_lo, fill_hi, fill_lo, fill_hi
259 );
260 const __m256i steps = npyv_set_s64(0, 1, 2, 3);
261 __m256i vnlane = npyv_setall_s64(nlane > 4 ? 4 : (int)nlane);
262 __m256i mask = _mm256_cmpgt_epi64(vnlane, steps);
263 __m256i payload = _mm256_maskload_epi64((const long long*)ptr, mask);
264 __m256i ret = _mm256_blendv_epi8(vfill, payload, mask);
265#if NPY_SIMD_GUARD_PARTIAL_LOAD
266 volatile __m256i workaround = ret;
267 ret = _mm256_or_si256(workaround, ret);
268#endif
269 return ret;
270}
271// fill zero to rest lanes
272NPY_FINLINE npyv_s32 npyv_load2_tillz_s32(const npy_int32 *ptr, npy_uintp nlane)
273{ return npyv_load_tillz_s64((const npy_int64*)ptr, nlane); }

Callers

nothing calls this directly

Calls 1

npyv_setall_s64Function · 0.70

Tested by

no test coverage detected