Skip to content

ABI for float builtins depends on target features #112885

Open
@beetrees

Description

@beetrees

When LLVM needs to call a builtin (such as __truncdfhf2 or __addtf3), it will use whatever ABI is the default for the target features of the function that is currently being compiled. This means that on targets where the ABI of float types is target-feature dependant (e.g. the ABI of half changes of 32-bit x86 depending on whether sse2 is enabled, and the ABI of fp128 changes on PowerPC depending on whether vsx is enabled), LLVM will call the same builtin function using two different incompatible ABIs.

The simplest solution to this seems to be extending the target-abi module flag to allow frontends to specify which float ABI gets used for function calls independent of the target features of a function. Other solutions include allowing the frontend to override the names of builtin functions on a per-function-being-compiled level.

Related Rust issues: rust-lang/rust#131819, rust-lang/rust#125109

Metadata

Metadata

Assignees

No one assigned

    Labels

    ABIApplication Binary Interfaceclang:headersHeaders provided by Clang, e.g. for intrinsicsfloating-pointFloating-point math

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions