<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - AArch64 backend does not handle contract math."
   href="https://bugs.llvm.org/show_bug.cgi?id=35091">35091</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AArch64 backend does not handle contract math.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: AArch64
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yyc1992@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Test case:

```
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-gnu"

define double @f1(double, double, double) {
  %4 = call double @llvm.fmuladd.f64(double %0, double %1, double %2)
  ret double %4
}

define double @f2(double, double, double) {
  %4 = fmul contract double %0, %1
  %5 = fadd contract double %4, %2
  ret double %5
}

declare double @llvm.fmuladd.f64(double %a, double %b, double %c)
```

According to LangRef, the two function should be the same and should both use
fma or mul and add depending on what the backend think is faster. However,
running with `llc -O3` only the first one generates an fma instruction and the
second one uses a mul and an add.

ARM backend might have the same issue.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>