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

Use inline asm! for x86 DIV #236

Merged
merged 2 commits into from
May 6, 2024
Merged

Use inline asm! for x86 DIV #236

merged 2 commits into from
May 6, 2024

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Feb 23, 2022

No description provided.

@cuviper
Copy link
Member Author

cuviper commented Feb 24, 2022

bors try

bors bot added a commit that referenced this pull request Feb 24, 2022
@bors

This comment was marked as outdated.

@cuviper
Copy link
Member Author

cuviper commented Feb 25, 2022

While this does improve benchmarks here and in my own programs, one downside is that this asm! is opaque to LLVM, so it doesn't get a chance to optimize division by a constant (scalar) value into "magic" multiplication.

@cuviper cuviper changed the title Use inline asm! for x86 DIV on Rust 1.59+ Use inline asm! for x86 DIV May 4, 2024
@cuviper
Copy link
Member Author

cuviper commented May 6, 2024

On further reflection, the measured gains should outweigh theoretical optimization losses.

Maybe someday we could try is_val_statically_known to detect divisors that might be optimizable.

@cuviper cuviper added this pull request to the merge queue May 6, 2024
Merged via the queue into rust-num:master with commit 9210db6 May 6, 2024
4 checks passed
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.

1 participant