https://bugs.llvm.org/show_bug.cgi?id=35091

            Bug ID: 35091
           Summary: AArch64 backend does not handle contract math.
           Product: libraries
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedb...@nondot.org
          Reporter: yyc1...@gmail.com
                CC: llvm-bugs@lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to