Verify optimized brctz - #2383
Merged
Merged
Conversation
klinashka
marked this pull request as draft
August 17, 2026 12:10
miriampolzer
self-requested a review
August 17, 2026 12:15
miriampolzer
approved these changes
Aug 19, 2026
miriampolzer
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! Looks good overall, just some detail comments. Let me know when you rebased and updated so that I can trigger the CI and merge.
klinashka
force-pushed
the
verify-optimized-brctz
branch
from
August 19, 2026 12:23
3862db6 to
198b31b
Compare
klinashka
marked this pull request as ready for review
August 19, 2026 12:27
miriampolzer
enabled auto-merge (squash)
August 19, 2026 14:48
miriampolzer
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements an implementation of
br_ctz, which takes as input a 64-bit unsigned word and returns the number of trailing Zeros.The implementation repeatedly shifts the input left by 1, until the input becomes 0. We have opted for this implementation, rather than the more intuitive alternative, because the current implementation targets optimizations performed in the
LoopIdiomRecognizepass of the LLVM compiler. This results in efficient compilations by bothclangandgcc(even though we did not specifically targetgccinitially). More details on this can be found here.The PR is currently a draft, as it should be merged after mit-plv/coqutil#177 propagates to fiat-crypto.