public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/111782] New: [11/12/13/14 Regression] Extra move in complex double multiplication
@ 2023-10-12  9:43 ktkachov at gcc dot gnu.org
  2023-10-12 10:46 ` [Bug middle-end/111782] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2023-10-12  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/111782] [11/12/13/14 Regression] Extra move in complex double multiplication
  2023-10-12  9:43 [Bug middle-end/111782] New: [11/12/13/14 Regression] Extra move in complex double multiplication ktkachov at gcc dot gnu.org
@ 2023-10-12 10:46 ` rguenth at gcc dot gnu.org
  2023-10-12 21:42 ` [Bug rtl-optimization/111782] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-12 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.5
           Keywords|                            |needs-bisection

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move in complex double multiplication
  2023-10-12  9:43 [Bug middle-end/111782] New: [11/12/13/14 Regression] Extra move in complex double multiplication ktkachov at gcc dot gnu.org
  2023-10-12 10:46 ` [Bug middle-end/111782] " rguenth at gcc dot gnu.org
@ 2023-10-12 21:42 ` pinskia at gcc dot gnu.org
  2023-10-12 21:55 ` [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move in double argument and multiplication and return pinskia at gcc dot gnu.org
  2024-03-07 21:05 ` [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move with arguments and returns and still using the argument for the last statement law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-12 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ra
   Last reconfirmed|                            |2023-10-12
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, the first difference in the IR between the 10 and 11 is reload
(LRA).

I suspect this is only an argument register allocation issue.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move in double argument and multiplication and return
  2023-10-12  9:43 [Bug middle-end/111782] New: [11/12/13/14 Regression] Extra move in complex double multiplication ktkachov at gcc dot gnu.org
  2023-10-12 10:46 ` [Bug middle-end/111782] " rguenth at gcc dot gnu.org
  2023-10-12 21:42 ` [Bug rtl-optimization/111782] " pinskia at gcc dot gnu.org
@ 2023-10-12 21:55 ` pinskia at gcc dot gnu.org
  2024-03-07 21:05 ` [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move with arguments and returns and still using the argument for the last statement law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-12 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13/14 Regression]    |[11/12/13/14 Regression]
                   |Extra move in complex       |Extra move in double
                   |double argument and         |argument and multiplication
                   |multiplication              |and return

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is another testcase without complex (or even needing -ffast-math) being
involved:
```
struct cmplx
{
  double r;
  double i;
};

struct cmplx
f(double ar, double ai, double br, double bi, __complex double *r)
{
  double t = ai * bi;
  double t1 = ai * br;
  double t2 = ar * bi + t1;
  double t3 = ar * br - t;
  return (struct cmplx){t3,t2};
}
```

This only shows up wih both arguments and returns and using the same registers.
I am 99% sure this does not show up that much really either.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move with arguments and returns and still using the argument for the last statement
  2023-10-12  9:43 [Bug middle-end/111782] New: [11/12/13/14 Regression] Extra move in complex double multiplication ktkachov at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-10-12 21:55 ` [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move in double argument and multiplication and return pinskia at gcc dot gnu.org
@ 2024-03-07 21:05 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 21:05 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
                 CC|                            |law at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-07 21:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-12  9:43 [Bug middle-end/111782] New: [11/12/13/14 Regression] Extra move in complex double multiplication ktkachov at gcc dot gnu.org
2023-10-12 10:46 ` [Bug middle-end/111782] " rguenth at gcc dot gnu.org
2023-10-12 21:42 ` [Bug rtl-optimization/111782] " pinskia at gcc dot gnu.org
2023-10-12 21:55 ` [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move in double argument and multiplication and return pinskia at gcc dot gnu.org
2024-03-07 21:05 ` [Bug rtl-optimization/111782] [11/12/13/14 Regression] Extra move with arguments and returns and still using the argument for the last statement law at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).