How to build compiler-rt for new X86 half float ABI

Reland "Reland "Reland "Reland "[X86][RFC] Enable `_Float16` type sup… · llvm/llvm-project@655ba9c · GitHub changed half floats from being passed in GPRs to XMM registers. This breaks compatibility with anything that passes half as uint16_t, including compiler-rt.

LLVM generates a call to __truncsfhf2 to cast float->half when the hardware doesn’t have an instruction for it. This now requires rebuilding compiler-rt with the new ABI by configuring it with COMPILER_RT_HAS_FLOAT16 but this is also impossible because _Float16 is only available in clang when avx512fp16 is enabled.

Are there any options for

  • Building a compiler-rt that works at all?
  • Building a compiler-rt that can support multiple ABIs?


@d0k Yes, this is a problem. We need the front-end patch to enable the support of _Float16. I think we can split that patch to enable the type support first.

Split by ⚙ D128571 [X86] Support `_Float16` on SSE2 and up