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

rustc: Remove f{32,64} % from the language #13410

Closed
wants to merge 1 commit into from

Conversation

alexcrichton
Copy link
Member

This commit removes the compiler support for floating point modulus operations,
as well as from the language. An implementation for this operator is now
required to be provided by libraries.

Floating point modulus is rarely used, doesn't exist in C, and is always lowered
to an fmod library call by LLVM, and LLVM is considering removing support
entirely.

Closes #12278

This commit removes the compiler support for floating point modulus operations,
as well as from the language. An implementation for this operator is now
required to be provided by libraries.

Floating point modulus is rarely used, doesn't exist in C, and is always lowered
to an fmod library call by LLVM, and LLVM is considering removing support
entirely.

Closes rust-lang#12278
@thestinger
Copy link
Contributor

Are they really going to remove it, or just turn it into an intrinsic? The other floating point intrinsics are also usually just lowered down to the C call, but it provides LLVM with an opportunity to do more optimization since it knows you do not care about errno. At the very least, it knows how to do constant folding for the frem instruction so this loses an optimization.

@alexcrichton
Copy link
Member Author

The issue indicates that LLVM is considering removing support entirely. I am unsure about the source of this information, however.

@pcwalton
Copy link
Contributor

This info is from Dan Gohman.

bors added a commit that referenced this pull request Apr 20, 2014
This commit removes the compiler support for floating point modulus operations,
as well as from the language. An implementation for this operator is now
required to be provided by libraries.

Floating point modulus is rarely used, doesn't exist in C, and is always lowered
to an fmod library call by LLVM, and LLVM is considering removing support
entirely.

Closes #12278
@bors bors closed this Apr 20, 2014
@alexcrichton alexcrichton deleted the issue-12278 branch April 21, 2014 16:40
flip1995 pushed a commit to flip1995/rust that referenced this pull request Dec 15, 2024
Fixes rust-lang#10195.

changelog: Added new [`literal_string_with_formatting_args`] `pedantic`
lint
[rust-lang#13410](rust-lang/rust-clippy#13410)
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.

Remove floating point modulus as a built-in operation; relegate it to the libraries
4 participants