add explicit non-zero context to _Countr_zero#2298
add explicit non-zero context to _Countr_zero#2298AlexGuteniev wants to merge 10 commits intomicrosoft:mainfrom
_Countr_zero#2298Conversation
# 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