public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114107] New: poor vectorization at -O3 when dealing with arrays of different multiplicity, good with -O2
@ 2024-02-25 23:40 nathanael.schaeffer at gmail dot com
  2024-02-25 23:46 ` [Bug target/114107] " pinskia at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: nathanael.schaeffer at gmail dot com @ 2024-02-25 23:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114107
           Summary: poor vectorization at -O3 when dealing with arrays of
                    different multiplicity, good with -O2
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nathanael.schaeffer at gmail dot com
  Target Milestone: ---

A simple loop multiplying two arrays, with different multiplicity fails to
vectorize efficiently with -O3.
Target is AVX x86_64.
The loop is the following, where 4 consecutive values in data are multiplied by
the same factor :

    for (int i=0; i<n; i++) {
     for (int k=0; k<4; k++) data[4*i+k] *= factor[i];
    }

See the very poor generated assembly with -O3 on godbolt, while 
the correct solution of a simple vbroadcastsd is generated by gcc 12.1+ with
-O2 

https://godbolt.org/z/fWj34bbhq

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

end of thread, other threads:[~2024-06-13  7:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-25 23:40 [Bug tree-optimization/114107] New: poor vectorization at -O3 when dealing with arrays of different multiplicity, good with -O2 nathanael.schaeffer at gmail dot com
2024-02-25 23:46 ` [Bug target/114107] " pinskia at gcc dot gnu.org
2024-02-25 23:56 ` pinskia at gcc dot gnu.org
2024-02-26  0:12 ` nathanael.schaeffer at gmail dot com
2024-02-26  0:13 ` nathanael.schaeffer at gmail dot com
2024-02-26  0:27 ` pinskia at gcc dot gnu.org
2024-02-26  0:34 ` nathanael.schaeffer at gmail dot com
2024-02-26  2:51 ` liuhongt at gcc dot gnu.org
2024-02-26  3:28 ` liuhongt at gcc dot gnu.org
2024-02-26  7:42 ` nathanael.schaeffer at gmail dot com
2024-02-26  7:49 ` nathanael.schaeffer at gmail dot com
2024-02-26  7:54 ` liuhongt at gcc dot gnu.org
2024-02-26  8:13 ` nathanael.schaeffer at gmail dot com
2024-02-26  9:10 ` [Bug tree-optimization/114107] " rguenth at gcc dot gnu.org
2024-02-26 14:40 ` rguenth at gcc dot gnu.org
2024-06-13  6:22 ` cvs-commit at gcc dot gnu.org
2024-06-13  7:13 ` 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).