https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118506

            Bug ID: 118506
           Summary: Missing FMA for `(a + 1.0) * b`
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-*-*

Take:
```
double f(double a, double b)
{
  return (a + 1) * b;
}
double g(double a, double b)
{
  return a*b + b;
}
```

We should turn that into a fma with -Ofast but we don't.
We produce:
f:
        fmul    d0, d0, d1
        fadd    d0, d0, d1
        ret
g:
        fmul    d0, d0, d1
        fadd    d0, d0, d1
        ret

Reply via email to