-
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
Correct lzcnt results #1108
Correct lzcnt results #1108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just a couple of questions about naming. If you or @fsb4000 can confirm that the tests for countl_zero
fail on the affected processors before your change, and pass after, I think that should be sufficient for validation. (Note that you can compile a test program on one machine and just copy it to another if you statically link.)
Co-authored-by: Stephan T. Lavavej <[email protected]>
# Conflicts: # stl/inc/bit
On my CPU(AMD FX8300) both versions(current master and the pull request) print same(correct) result: |
I confirm the fix on pre AMB-LZCNT-POPCNT machine |
Thanks @fsb4000 and @AlexGuteniev! I think this all makes sense - the FX-8300 worked because it physically supported Advanced Bit Manipulation, so the previous code said "oh, this doesn't support AVX2, we need to special-case 0" but otherwise used lzcnt which works. The test previously failed on Alex's even older processor which doesn't physically support lzcnt. |
it sucks that we can't test this by modifying __isa_available before running the functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved with a testing suggestion, I don't feel that suggestion should block merging this though.
Thanks @statementreply for noticing this bug, @AlexGuteniev for fixing it, and @fsb4000 for helping to validate the fix! 😺 😸 🐈 |
Fixes #1103