Skip to content

Lower Rust fast floating-point intrinsics with explicit fast flags #186

Closed

Description

@niklebedenko

Problem

core::intrinsics::{fadd_fast,fsub_fast,fmul_fast,fdiv_fast,frem_fast} are generic compiler intrinsics with no MIR body. If they survive as placeholder calls, LLVM lowering can emit unresolved intrinsic symbols. A previous lowering attempt also used the default fast-math attribute, which is empty and does not express the Rust fast-intrinsic contract.

Why this matters

Fast floating-point intrinsics should become LLVM floating-point binops with explicit fast-math flags. Leaving placeholders or empty flags makes the lowering either invalid or semantically weaker than the intrinsic contract.

Expected behavior

The importer should recognize all five fast float intrinsics and emit known placeholders. MIR lowering should route those placeholders before the libdevice path and replace them with the matching LLVM float binop carrying explicit fast flags.

Acceptance criteria

  • fadd_fast, fsub_fast, fmul_fast, fdiv_fast, and frem_fast are recognized.
  • Both core::intrinsics and std::intrinsics spellings are covered.
  • Lowered LLVM ops use explicit FastmathFlags::FAST.
  • No unresolved placeholder call survives MIR lowering.
  • Tests cover all five operations for both f32 and f64.

Activity

  1. added
    bug
    intrinsics
    codegen
    IR-lowering
    on Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    IR-loweringbugcodegenintrinsics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions