Skip to content

LLVM intrinsic emission is inconsistent #88817

Closed
@MabezDev

Description

@MabezDev

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.

let f: f32 = 1.0;
let f = f.mul_add(2.0, 3.0);
println!("f = {}", f);

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 the riscv32imc-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 same mul_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:

1.55.0, also happens on 1.54.0 too

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions