-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
_Find_unchecked is the implementation of std::find.
Currently it is optimized for 8 bit size array elements by using memchr.
It is possible to expand this optimization for 16 bit size array elements by using wmemchr.
For greater size operands, like 32 or 64 bit, it is possible to implement the optimization either, but it takes some manual implementation.
Assuming 32 bit element, the comparison using SSE2 can be made with _mm_cmpeq_epi32. Then with _mm_movemask_epi8, mask can be extracted. If it is nonzero, countr_zero may be used to determine the position of the first match. This only requires SSE2, which is x64 baseline.
With AVX2, there are 256-bit variables available and 64 bit data sizes are possible.
The implementations should probably go to vector_algorithm.cpp