[compiler-rt] [builtins] Avoid using long double in FreeBSD standalone environment (PR #76175)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 09:32:49 PST 2024


arichardson wrote:

> @arichardson the problem, at least on FreeBSD, is that we've been building `xf_float` based primitives for platforms that strictly do not support 80 bit long double, such as aarch64, arm, powerpc64, and riscv. (See https://github.com/freebsd/freebsd-src/blob/main/lib/libcompiler_rt/Makefile.inc, specifically the initial list for all arches, which includes `divtc3.c` and `divxc3.c`.) I could remove these from the list for any architectures that do not support 80 bit long doubles, but then I would be breaking backwards compat.
> 
> I.e. in older versions of compiler-rt, functions like `divtc3` were just defined with `long double` in their parameter lists. I think I need to have an alternative where `xf_float` is a plain `long double`...

The *tf functions are not long double, they are tetra-float, i.e. 128-bit floating point. Using long double was incorrect for x86 which should only be using it for the xf* functions. So you should remove the xf files for !x86.

The other option would be to use the same pattern as in the tf files where they compile to nothing if 80-bit floats are not available (this would require updating the ifdef guards and is probably a bit more work than just changing the makefile).

https://github.com/llvm/llvm-project/pull/76175


More information about the llvm-commits mailing list