Skip to content

Update more math intrinsics to use LLVM instead of libm - #162104

Draft
ZuseZ4 wants to merge 2 commits into
rust-lang:mainfrom
ZuseZ4:update-math-intrinsics
Draft

Update more math intrinsics to use LLVM instead of libm#162104
ZuseZ4 wants to merge 2 commits into
rust-lang:mainfrom
ZuseZ4:update-math-intrinsics

Conversation

@ZuseZ4

@ZuseZ4 ZuseZ4 commented Sep 1, 2026

Copy link
Copy Markdown
Member

As a prototype to be discussed on zulip. If accepted I'd update miri, f16/f128, clean it up, and add the other ones tan, asin, acos, atan, sinh, cosh.

Motivation: For HPC/Scientific Computing Benchmarks I often port existing C/C++ code to Rust and compare how they fare. When looking at IR differences, these often came up. C++ has the -fno-math-errno flag, but we explicitly don't guarantee which implementation we use, so I think we are free (and should) default to this behaviour which allows more optimizations.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 1, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 7209 files
Diff in /checkout/library/std/src/num/f64.rs:1066:
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn tanh(self) -> f64 {
-       intrinsics::tanhf64(self)
+        intrinsics::tanhf64(self)
     }
 
     /// Inverse hyperbolic sine function.
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Currently active steps:

@tgross35

tgross35 commented Sep 1, 2026

Copy link
Copy Markdown
Member

Zulip discussion starting at #general > algebraic float ops @ 💬

@rust-bors

rust-bors Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #162148) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants