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

            Bug ID: 111782
           Summary: [11/12/13/14 Regression] Extra move in complex double
                    multiplication
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

The testcase:
    __complex double
    foo (__complex double a, __complex double b)
    {
      return a * b;
    }

With GCC trunk at -Ofast I see on aarch64:
foo(double _Complex, double _Complex):
        fmov    d31, d1
        fmul    d1, d1, d2
        fmadd   d1, d0, d3, d1
        fmul    d31, d31, d3
        fnmsub  d0, d0, d2, d31
        ret

with GCC 10 the codegen used to be tighter:
foo(double _Complex, double _Complex):
        fmul    d4, d1, d3
        fmul    d5, d1, d2
        fmadd   d1, d0, d3, d5
        fnmsub  d0, d0, d2, d4
        ret

There's an extra fmov emitted on trunk.
I noticed this regressed with the GCC 11 series

Reply via email to