Skip to content
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

Division tweaks #380

Merged
merged 3 commits into from
Oct 10, 2020
Merged

Division tweaks #380

merged 3 commits into from
Oct 10, 2020

Conversation

AaronKutch
Copy link
Contributor

@AaronKutch AaronKutch commented Oct 3, 2020

This slims down asymmetric.rs, removes the old style signed division macro code, and constructs signed divisions independent of the specialized_div_rem module. I figured out that when this is done, LLVM autoinlines just how I want it (except that the code gen for RISCV is still horrendous, I guess my leading_zeros changes still have not made it into nightly). The fact that I don't have to manage the signed divisions in the specialized_div_rem module will make it much easier to convert some macros to generics later. In another PR, I will fix problems I have with the division testing code and improve the edge cases that it covers.

Rebenchmarking this showed that perf changed for the worse only on really low end CPUs
These macros and functions are only in the public interface for testing purposes or because of `#[macro_export]` pollution
@@ -4,6 +4,7 @@
// Compilers will insert the check for zero in cases where it is needed.

/// Returns the number of leading binary zeros in `x`.
#[doc(hidden)]
pub fn usize_leading_zeros_default(x: usize) -> usize {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be pub(crate) instead of#[doc(hidden)]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is being used by the testcrate (the CI does not have a RISCV target at the moment, so we want to make sure that they both work)

@alexcrichton
Copy link
Member

r? @Amanieu for having reviewed #332

@Amanieu Amanieu merged commit 3a769f6 into rust-lang:master Oct 10, 2020
@AaronKutch AaronKutch deleted the division-tweaks branch March 30, 2021 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants