public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113458] New: Missed SLP for reduction of multiplication/addition with promotion
@ 2024-01-17 20:29 pinskia at gcc dot gnu.org
  2024-01-17 21:08 ` [Bug tree-optimization/113458] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-17 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113458
           Summary: Missed SLP for reduction of multiplication/addition
                    with promotion
           Product: gcc
           Version: 14.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:
```
int f(short *a, signed char *b)
{
        int sum = 0;
        sum += a[0]*b[0];
        sum += a[1]*b[1];
        sum += a[2]*b[2];
        sum += a[3]*b[3];
        return sum;
}
```

This is not SLPed with GCC.

With `-fno-vect-cost-model` it is but in a very inefficient way.

LLVM produces:
```
        ldr     s0, [x1]
        ldr     d1, [x0]
        sshll   v0.8h, v0.8b, #0 // promote to short
        smull   v0.4s, v0.4h, v1.4h //multiply 2 shorts to ints
        addv    s0, v0.4s // do the reduction
        fmov    w0, s0
```

Which GCC should be to produce this too.

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

end of thread, other threads:[~2024-01-21 22:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17 20:29 [Bug tree-optimization/113458] New: Missed SLP for reduction of multiplication/addition with promotion pinskia at gcc dot gnu.org
2024-01-17 21:08 ` [Bug tree-optimization/113458] " pinskia at gcc dot gnu.org
2024-01-18  5:13 ` liuhongt at gcc dot gnu.org
2024-01-18  8:05 ` rguenth at gcc dot gnu.org
2024-01-18  8:10 ` rguenth at gcc dot gnu.org
2024-01-18  8:36 ` [Bug target/113458] " pinskia at gcc dot gnu.org
2024-01-19  0:33 ` liuhongt at gcc dot gnu.org
2024-01-19 21:41 ` pinskia at gcc dot gnu.org
2024-01-19 22:56 ` pinskia at gcc dot gnu.org
2024-01-20  0:41 ` pinskia at gcc dot gnu.org
2024-01-20  8:09 ` pinskia at gcc dot gnu.org
2024-01-21 22:14 ` pinskia 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).