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

    <tr>
        <th>Summary</th>
        <td>
            [AArch64] -Ofast worsens optimisation of fnmadd pattern
        </td>
    </tr>

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

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

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

<pre>
    ```cpp
float fnmadd(float a, float b, float c)
{
        return -(a * c + b);
}
```
With `-O3`, LLVM outputs this:
```asm
fnmadd(float, float, float):                           // @fnmadd(float, float, float)
        fnmadd  s0, s0, s2, s1
        ret
```
`-Ofast` instead outputs this:
```asm
fnmadd(float, float, float):                           // @fnmadd(float, float, float)
        fmadd   s0, s2, s0, s1
        fneg    s0, s0
        ret
```
See also [Godbolt comparison](https://godbolt.org/z/Kc8TT4hre)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVUk1vnDAQ_TXmMtqVMV-7Bw5sV8khqSq1UXu2wYAjg5FtErW_voNZmmyUSLkWGfMGe2bee7Ywze-S5HQd9TQReia0arXhHtpx4E1D2GENOWFfYIXiBdaEHdckUpwugB6t9LMdYYfJHAiroMb5tOQdSbJtK84XsPVfw1_K94DR7luy_MNO9_c_v4KZ_TR7B75XjiTVm1Tuhgv1K9L_eL4CyKCCjx_CbnAASelnSoWeW-qaAOAC68vMwhxf70R_3tUeZLfceQSgRuclb_4L5avwa830PeXtKDuAVx59ypcfUgLXzgDJTremEUbjzTPDxK1yZiTZGbn23k_BnyCjW3ftje0w-oPvXX14eEh7K5F91JRJc0yOPPLKa1li2aqydZ-nWAvWI4BnY50cHZjJq0E57pUZwbTbMU_ce2nHaLa6fNMbb_As9kgQA62fts9usuZR1mjfjXJulg5BlhUsi_qSiVzEom1pE2eJKGqexm3SpkVDsySvGxlpLqR2C1PC2CifIZRAjIwjVTLKGM1YzhKW0XzPZRGjwDitmUwPRYqHKgeu9H7hsZgS2TJQEnPncFEr593LIndOdaMMxiz1-ex7Y8tbLqyS-jt_UtJGgUAZBPwFtXc0HQ">