llvm / llvm/llvm-project

[libc][math] Tracking Issue - Refactor internal utils to be `constexpr` compatible with `long double` on Linux X87 platform

Open
#185,232 1 comment 0 reactions 0 assignees View on GitHub
libc metaissue
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

On the current effort to make `constexpr` compatible math functions we have several build errors with the current state of the code related to a mismatch in the size of `long double` on Linux X87 and the internal representation bits. This causes alignment issues when using `__builtin_bit_cast` causing undefined behavior and refusal in constant evaluation at compile time.

A possible solution is to use software `float80` as internal representation for all desired targets.

---

Source:
- RFC: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
- GSoC26 `float80/128` Project: https://llvm.org/OpenProjects.html#enable_float80_float128_for_unsupported_target

Resources:
- https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3969r0.html

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.