-
Notifications
You must be signed in to change notification settings - Fork 4
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
Simd leading zero count #2
Comments
Hey! Thanks for reading and suggesting. The movemask is super useful here, thanks! I had to use Perhaps I should add a CONTRIBUTORS file and add you there. |
I would appreciate that |
Some time ago I came across an old book of mine (hackers delight). And for some reason I opened the part about zero counting. Showing the extremely smart tricks to a friend. A week ago I did read your article as it was posted on reddit.com/r/cpp. And this morning I saw your comment on the microsoft stl issue (microsoft/STL#870) related to your article. Long story short I did a 1+1 a figured that I could at the very least give you an working simd sample of one of the branchless hackers delight samples.
I did not benchmark this, and I am kinda throwing it over the fence but I guess you would appreciate it anyway.
https://godbolt.org/z/Snm4Ld
Update:
This works, but its slow. I think best is to do _mm_cmpeq_epi8 + _mm_movemask_epi8 and count the zeros.
Like this:
The text was updated successfully, but these errors were encountered: