public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/97984] New: [10/11 Regression] Worse code for -O3 than -O2 on aarch64 vector multiply-add
@ 2020-11-25 11:49 ktkachov at gcc dot gnu.org
  2020-11-25 12:59 ` [Bug tree-optimization/97984] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2020-11-25 11:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97984
           Summary: [10/11 Regression] Worse code for -O3 than -O2 on
                    aarch64 vector multiply-add
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

The code:
void x (long * __restrict a, long * __restrict b)
{
  a[0] *= b[0];
  a[1] *= b[1];
  a[0] += b[0];
  a[1] += b[1];
}

at -O2 generates:
x:
        ldp     x4, x3, [x0]
        ldp     x2, x1, [x1]
        madd    x2, x2, x4, x2
        madd    x1, x1, x3, x1
        stp     x2, x1, [x0]
        ret

whereas at -O3 it does:
x:
        ldp     x2, x3, [x0]
        ldr     x4, [x1]
        ldr     q1, [x1]
        mul     x2, x2, x4
        ldr     x4, [x1, 8]
        fmov    d0, x2
        ins     v0.d[1], x3
        mul     x1, x3, x4
        ins     v0.d[1], x1
        add     v0.2d, v0.2d, v1.2d
        str     q0, [x0]
        ret

which is clearly inferior.
GCC 9 used to generate the good code for both -O2 and -O3

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

end of thread, other threads:[~2023-07-07 10:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 11:49 [Bug tree-optimization/97984] New: [10/11 Regression] Worse code for -O3 than -O2 on aarch64 vector multiply-add ktkachov at gcc dot gnu.org
2020-11-25 12:59 ` [Bug tree-optimization/97984] " rguenth at gcc dot gnu.org
2021-01-14  9:47 ` [Bug target/97984] " rguenth at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-11-22  0:49 ` pinskia at gcc dot gnu.org
2021-12-08 14:24 ` marxin at gcc dot gnu.org
2021-12-08 19:51 ` pinskia at gcc dot gnu.org
2021-12-09 10:05 ` marxin at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07 10:38 ` [Bug target/97984] [11 " rguenth 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).