Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Use core::arch intrinsics for for rint and rintf where possible #421

Closed
@hanna-kruppe

Description

@hanna-kruppe

These functions don't have any arch-specialized versions right now. I believe they can be done with smaller code size and better performance on some targets:

  • On Wasm, f{32,64}_nearest are always available and already exposed in core::arch (cc Use core::arch::wasm functions rather than intrinsics #418).
  • AArch64 with target_feature=neon has frintn but the scalar versions don't seem to be exposed in core::arch. I guess the vector versions (e.g., vrndn_f32) are still an improvement over softfloat even if they need an unnecessary scalar->vector splat.
  • On x86 and x86_64, there's _mm_round_{sd,ss} and _MM_FROUND_TO_NEAREST_INT. But this requires SSE4.1 so it's not applicable unless someone happens to build libm from crates.io with appropriate RUSTFLAGS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions