<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/112885>112885</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            ABI for float builtins depends on target features
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          beetrees
      </td>
    </tr>
</table>

<pre>
    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](https://godbolt.org/z/Kav7dcaeM), and [the ABI of `fp128` changes on PowerPC depending on whether `vsx` is enabled](https://godbolt.org/z/najh8cfd8)), 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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE-P2ygU_zTk8pTIxonHOfgw01Gk1bbaqqp2jxWGR6DCEMEjmdlPvwJ70m23e-klf7Dfj98_ECnZs0cc2eGJHZ43IpMJcZwQKSKmzRTU6_iXQQ_v3__5ATyiSkABpHAOBEzZOrIeGB9SlgZEAtY3X75QzF4qbTRnfQMhLqtCKdId6xvGj4y_A0tws85BTgg3IwivGOHx6TewCcggKNQiOwIdYv1PIp6RQKOgHDFB0HVZZy_JBg9kBJVZmWNET-4VJrT-DDLMF-tQ7eCzsQlmFD4tL5ehCprgZjBixSsMggbtgiCg1wumSqi-t103B4UX9Ep4Ktpxd94BOzz9a5r1jRFOF_nSCH9e6HZ8O1mCl6FfAQq94MvmZLDalBJW02wC9GJyqNjhm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