/*
* Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement. If you add a new
- * caller, be sure your expected values of "i" are handled.
*/
#ifndef USE_NO_SIMD
static inline Vector8
#ifdef USE_SSE2
return _mm_slli_epi32(v1, i);
#elif defined(USE_NEON)
- switch (i)
- {
- case 4:
- return (Vector8) vshlq_n_u32((Vector32) v1, 4);
- default:
- Assert(false);
- return vector8_broadcast(0);
- }
+ return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
#endif
}
#endif /* ! USE_NO_SIMD */
/*
* Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement. If you add a new
- * caller, be sure your expected values of "i" are handled.
*/
#ifndef USE_NO_SIMD
static inline Vector8
#ifdef USE_SSE2
return _mm_srli_epi32(v1, i);
#elif defined(USE_NEON)
- switch (i)
- {
- case 4:
- return (Vector8) vshrq_n_u32((Vector32) v1, 4);
- case 8:
- return (Vector8) vshrq_n_u32((Vector32) v1, 8);
- default:
- Assert(false);
- return vector8_broadcast(0);
- }
+ /* negative shift count means right shift */
+ return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
#endif
}
#endif /* ! USE_NO_SIMD */