-
Notifications
You must be signed in to change notification settings - Fork 1.6k
add explicit non-zero context to _Countr_zero
#2298
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
Conversation
# Conflicts: # stl/inc/limits
Fix "assmuption" typo. Simplify _Non_zero_input to _Nonzero, consistent with function name. Avoid negation in _No_assumption; _Possibly_zero focuses on what we're concerned with.
|
@AlexGuteniev I have pushed a merge with Please let me know if anything looks weird/wrong! |
I think it is correct, but looks like without attempting to use As the change was originally written, it avoided branches. The branches were there only for zero input. So currently the change appears to be near-zero improvement, that doesn't even worth complicating code. Need to benchmark and inspect codegen to figure out what should be done. Maybe implementing the same thing as for |
|
This optimization makes gcd 1 to 2 percent faster. |
|
1-2% is worth it, I think (it's pretty small on the scale of libs performance improvements, but it's easily something that the backend team would celebrate as their codegen is already highly optimized, and improving program perf without user-programmer intervention is always nice). @barcharcraz agrees - let's proceed! |
|
Please consider submitting #2343 instead of this one.
|
|
Looking at #2343, I agree that it appears to be superior. Closing this PR. |
fixes #2292
x86 diff:
https://godbolt.org/z/v7v9zv3Gr
x64 diff:
https://godbolt.org/z/b8h86MrMo