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

    <tr>
        <th>Summary</th>
        <td>
            `__builtin_fmodf` is not tail-called when using `-ffast-math`
        </td>
    </tr>

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

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

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

<pre>
    https://godbolt.org/z/83cTWb7T6
```cpp
float f(float x, float y) {
    return __builtin_fmodf(x, y);
}
```
With `-O3`, this emits
```llvm
define dso_local noundef float @f(float, float)(float noundef %x, float noundef %y) local_unnamed_addr {
entry:
  %call = tail call float @fmodf(float noundef %x, float noundef %y) #3
  ret float %call
}
```
With `-O3 -ffast-math`:
```llvm
define dso_local noundef nofpclass(nan inf) float @f(float, float)(float noundef nofpclass(nan inf) %x, float noundef nofpclass(nan inf) %y) local_unnamed_addr {
entry:
  %fmod = frem fast float %x, %y
  ret float %fmod
}
```
Is this intentional? Seems like a missed optimization. `__builtin_remainderf` always tail-calls.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE1v4zgM_TX0hUigyF_xwYe2WQN72sMW6DGQbSrWriwFltxM-usHkpOmLdrBdIAAsSh-vPdIUTinDoaohvwe8l0iZj_Yqf5LOTIn8UxJa_tzPXh_dJDeAW-ANwfbt1b7tZ0OwJsX4M027R6f2vKxALYDdgcFW37d8bhYpLbCowS-Xb5-AH_A5fMMvEIo7xdHRMSJ_DwZ3O_bWWmvzF6Otg-xMSr4Q3pxh3L3oeRyfFJ-QCjY6p802PgD-kE5pFF59yFA6-dxMfUklSHsnd1r2wmNxs6mJ3kBChl7JfAKP4C5krq6A8_f8HtjjVRj6v1sjBip34u-n27syfjpHHS-aAE874TWCOkOvVAa4-kG56LLd8oDT9Nr-on8NdlS6LdFxZWUwvnVKPwQ7q-Qv6OqsfLYaeEc8K0RBpWRAeA3xf4iy-cifO38J60J8sfWyIlGDHrc1IzFY97PtA6Rv9b6b7dMrDKejFfWCA1pg_8SjQ61-p9Q4Kicox7t0atRvYjgtQ79uT2ciUahTE-ThIKh0CdxdnGQVqHbbp30ddpXaSUSqjflJq8yVlRZMtSyZG3HJYmMpVmeb1lRybITlG8LwUTFE1VzxjOWb8oN22zSbF1mMhMFZXkhRJV3BWQsFNfrMAlhVSTKuZnqiuebPNGiJe3i0uHc0AnjJXAedtBUh5hVOx8cZEwr590ti1deU_2O5fIMCobKobH-RpB6PA1kcHbKHOLkvpvaZJ70x9Wm_DC3686OwJs4w8vf6jjZ_6jzwJuI1AFvIpOfAQAA__9oc5rH">