-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<xutility>
: optimize _Find_unchecked
for data sizes other than 1
#2379
Comments
Note there's a PR currently in review in the same area: #2380 |
Correction, we can't rely on |
Inspected So, looks like should implement a custom solution even for size 1. |
Relevant test: |
New vector search to resolve microsoft#2379 and test that it fixes microsoft#2431 find
_Find_unchecked
is the implementation ofstd::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
The text was updated successfully, but these errors were encountered: