-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
LLVM intrinsic emission is inconsistent #88817
Comments
What the actual motivation underlying this? What LLVM-IR Rust generates is entirely an implementation detail of the compiler, so I'm not sure we do or will guarantee any specific output in terms of LLVM-IR. |
The motivation is that I am bootstrapping Xtensa targets, in which we are also running a fork of llvm. When rebasing the rust patchset on top of 1.55, our standard library port stopped compiling, throwing a missing intrinsic error ( Overall, I guess it doesn't matter if the compiler does emit it or not. What matters is can the compiler emit it? Is there a list (or an easy way to find) the intrinsics used by the standard library, so we can implement them in our llvm fork? |
https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/intrinsic.rs is probably a good way to find out all of the LLVM intrinsic calls that we might emit for some Rust code. grep for |
Thanks for the assistance @nagisa, we've resolved the issue by correctly implementing the basic llvm intrinsics. |
Running the following snippet across a few different platforms (x86_64-unknown-linux-gnu, riscv32imc-esp-espidf) has varying results in the intrinsic's used in the llvm-ir output.
I would expect the llvm-ir for each target to have calls in llvm intrinsic's, because that's exactly whats in the function body of
mul_add
, however on theriscv32imc-esp-espidf
platform, this doesn't always end up happening.Adding a call to a new unstable function
lerp
for example, and the intrinsic is now emitted in the llvm-ir even though its calling the samemul_add
functions inside it.I thought maybe
compiler_builtins
might have an implementation that is used in the simple example, but that doesn't seem to be the case.Meta
rustc --version --verbose
:also on a side note, where can I find the intrinsic's that must be implemented for a std platform? I notice in the case of the float modules, some calls use intrinsic's, some use cmath. I would be great to have a list of the required intrinsic's as we are bringing up Xtensa Rust support.
The text was updated successfully, but these errors were encountered: