* Non-contiguous partial load *********************************/ / 32
| 309 | *********************************/ |
| 310 | //// 32 |
| 311 | NPY_FINLINE npyv_s32 |
| 312 | npyv_loadn_till_s32(const npy_int32 *ptr, npy_intp stride, npy_uintp nlane, npy_int32 fill) |
| 313 | { |
| 314 | assert(nlane > 0); |
| 315 | __m128i vfill = npyv_setall_s32(fill); |
| 316 | #ifndef NPY_HAVE_SSE41 |
| 317 | const short *wptr = (const short*)ptr; |
| 318 | #endif |
| 319 | switch(nlane) { |
| 320 | #ifdef NPY_HAVE_SSE41 |
| 321 | case 3: |
| 322 | vfill = _mm_insert_epi32(vfill, ptr[stride*2], 2); |
| 323 | case 2: |
| 324 | vfill = _mm_insert_epi32(vfill, ptr[stride], 1); |
| 325 | case 1: |
| 326 | vfill = _mm_insert_epi32(vfill, ptr[0], 0); |
| 327 | break; |
| 328 | #else |
| 329 | case 3: |
| 330 | vfill = _mm_unpacklo_epi32(_mm_cvtsi32_si128(ptr[stride*2]), vfill); |
| 331 | case 2: |
| 332 | vfill = _mm_unpacklo_epi64(_mm_unpacklo_epi32( |
| 333 | _mm_cvtsi32_si128(*ptr), _mm_cvtsi32_si128(ptr[stride]) |
| 334 | ), vfill); |
| 335 | break; |
| 336 | case 1: |
| 337 | vfill = _mm_insert_epi16(vfill, wptr[0], 0); |
| 338 | vfill = _mm_insert_epi16(vfill, wptr[1], 1); |
| 339 | break; |
| 340 | #endif // NPY_HAVE_SSE41 |
| 341 | default: |
| 342 | return npyv_loadn_s32(ptr, stride); |
| 343 | } // switch |
| 344 | #if NPY_SIMD_GUARD_PARTIAL_LOAD |
| 345 | volatile __m128i workaround = vfill; |
| 346 | vfill = _mm_or_si128(workaround, vfill); |
| 347 | #endif |
| 348 | return vfill; |
| 349 | } |
| 350 | // fill zero to rest lanes |
| 351 | NPY_FINLINE npyv_s32 |
| 352 | npyv_loadn_tillz_s32(const npy_int32 *ptr, npy_intp stride, npy_uintp nlane) |
nothing calls this directly
no test coverage detected