-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
checked_div happy path #73731
Comments
Ideally/most cleanly solved with some branch weight annotation that we don’t have implemented yet. I wouldn’t rely much on re-arranging Rust code much as that can break again on a whim. |
Isn't std::intrinsics::likely a branch weight annotation? Isn't it working in Rust? |
Oh I guess that ended up being added, I skimmed past that part in your report. Yeah in that case we should just go with one of the |
I had a try, but it cannot yet be implemented because likely/unlikely are not yet const intrinsics. |
None that I can think of. But this requires T-lang approval (through FCP I presume) as it is an intrinsic. Better make it a separate PR. |
@rustbot modify labels: -S-blocked |
This is a kind of enhancement suggestion. Given this function:
Compiled wih rustc 1.46.0-nightly (67100f6 2020-06-24) with good optimization flags gives:
But I think the happy path should be with the denominator != 0 (that hopefully is the most common case), instead of the case with a division by zero.
So I've done few more experiments:
The asm:
This issue has been assigned to @nbdd0121 via this comment.
The text was updated successfully, but these errors were encountered: