[clang] [llvm] [WIP] Correct lowering of `fp128` intrinsics (PR #76558)
Trevor Gross via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 03:15:06 PST 2025
tgross35 wrote:
Finally getting around to this after more than a year. @efriedma-quic as an alternative to the current implementation of duplicating `long double` layout information from Clang to LLVM, would it work if LLVM lowers to `*f128` calls but provides a module flag `fp128_use_long_double_libcalls` to prefer the `*l` versions? So if Clang or other frontends know that their `long double` is `_Float128`, it can select those libcalls.
The advantage is avoided code duplication and the logic is easier to follow. Also this avoids problems if linking a library built with an unexpected `-mlong-double-` configuration.
The disadvantage is that frontends that don't know about C's `long double` can't benefit from the more common `*l` symbols. I don't think this is too big of a problem though: it makes no difference with glibc (the f128 aliases have been around sufficiently long) or on any platforms where `long double` is not `_Float128`. And it is easy enough for frontends to set `fp128_use_long_double_libcalls` on a case-by-case basis if they know what math library is being used (e.g. aarch64 musl).
(I handle the f128 support for Rust and would much rather never think about `*l` symbols, I can alias them to `*f128` if needed or set the flag)
https://github.com/llvm/llvm-project/pull/76558
More information about the llvm-commits
mailing list