Back to LLVM Compiler Infrastructure
GSoC 2026

Use LLVM libc math routines for compiler-rt floating point routines

compiler-rt builtins provide software floating-point routines (__addtf3, __multf3, __floatsitf, etc.) for targets that lack hardware FP support. The current implementations carry two problems. First, they are under-tested, and subtle bugs survive for years. PR#119449 shows one example: __floatdixf relies on the compiler to lower a cast, but the compiler implements that cast by calling __floatdixf, creating infinite recursion. Second, the codebase mixes C and hand-written assembly across architectures, which makes maintenance and extension to new types (_Float16, bfloat16) expensive. LLVM libc implements these same operations using formally verified building blocks (FPBits<T>, DyadicFloat<N>, BigInt<N>) with exhaustive test coverage. A recent refactoring effort (#147386) made these routines available as free-standing, header-only C++ utilities. This project replaces the legacy compiler-rt FP builtins with thin C++ wrappers that call into LLVM libc's verified routines, gated behind a CMake flag so the change is transparent and non-disruptive.

Project details

Contributor

Mohamed Emad

Mentors

Not available

Technologies

Not listed in the archive