Skip to content
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

Add f16 and f128 math functions #128417

Merged
merged 6 commits into from
Aug 7, 2024
Merged

Add f16 and f128 math functions #128417

merged 6 commits into from
Aug 7, 2024

Commits on Aug 1, 2024

  1. Specify the integer type of the powi LLVM intrinsic

    Since LLVM <https://reviews.llvm.org/D99439> (4c7f820, "Update
    @llvm.powi to handle different int sizes for the exponent"), the size of
    the integer can be specified for the `powi` intrinsic. Make use of this
    so it is more obvious that integer size is consistent across all float
    types.
    
    This feature is available since LLVM 13 (October 2021). Based on
    bootstrap we currently support >= 17.0, so there should be no support
    problems.
    tgross35 committed Aug 1, 2024
    Configuration menu
    Copy the full SHA
    e6d5702 View commit details
    Browse the repository at this point in the history
  2. Add math intrinsics for f16 and f128

    These already exist in the compiler. Expose them in core so we can add
    their library functions.
    tgross35 committed Aug 1, 2024
    Configuration menu
    Copy the full SHA
    82b40c4 View commit details
    Browse the repository at this point in the history
  3. Add math functions for f16 and f128

    This adds missing functions for math operations on the new float types.
    
    Platform support is pretty spotty at this point, since even platforms
    with generally good support can be missing math functions.
    `std/build.rs` is updated to reflect this.
    tgross35 committed Aug 1, 2024
    Configuration menu
    Copy the full SHA
    fc43c01 View commit details
    Browse the repository at this point in the history
  4. Add core functions for f16 and f128 that require math routines

    `min`, `max`, and similar functions require external math routines. Add
    these under the same gates as `std` math functions (`reliable_f16_math`
    and `reliable_f128_math`).
    tgross35 committed Aug 1, 2024
    Configuration menu
    Copy the full SHA
    e18036c View commit details
    Browse the repository at this point in the history
  5. Update comments for {f16, f32, f64, f128}::midpoint

    Clarify what makes some operations not safe, and correct comment in the
    default branch ("not safe" -> "safe").
    tgross35 committed Aug 1, 2024
    Configuration menu
    Copy the full SHA
    4383642 View commit details
    Browse the repository at this point in the history
  6. Add a disclaimer about x86 f128 math functions

    Due to a LLVM bug, `f128` math functions link successfully but LLVM
    chooses the wrong symbols (`long double` symbols rather than those for
    binary128).
    
    Since this is a notable problem that may surprise a number of users, add
    a note about it.
    
    Link: llvm/llvm-project#44744
    tgross35 committed Aug 1, 2024
    Configuration menu
    Copy the full SHA
    8e2ca0c View commit details
    Browse the repository at this point in the history