From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 201BE3858D28; Sun, 24 Apr 2022 14:25:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 201BE3858D28 From: "mtzguido at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/105363] New: -ftree-slp-vectorize decreases performance significantly (x64) Date: Sun, 24 Apr 2022 14:25:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mtzguido at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2022 14:25:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105363 Bug ID: 105363 Summary: -ftree-slp-vectorize decreases performance significantly (x64) Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mtzguido at gmail dot com Target Milestone: --- Created attachment 52857 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52857&action=3Dedit Source file and outputs Hello, I found this example where using -O2 (which implies -ftree-slp-vectorize) decreases performance by about 4x wrt -O1. I've pinned it down to the -ftree-slp-vectorize, and -O3 -fno-tree-slp-vectorize works very well. $ gcc bug_opt.c -O3 -o bug_opt-O3 $ time ./bug_opt-O3 real 0m6.627s user 0m6.619s sys 0m0.005s $ gcc bug_opt.c -O3 -fno-tree-slp-vectorize -o bug_opt-O3-novec $ time ./bug_opt-O3-novec real 0m1.703s user 0m1.701s sys 0m0.000s I've verified this with the current HEAD (1ceddd7497) and with 11.2 (though= in that version -O2 does not imply -ftree-slp-vectorize, so the problem starts= to appear at -O3). I've minimized the example into a pretty basic insertion sort. I have not checked the generated assembly. I'm attaching the .c source, which has some more comments with timings. Also attaching my /proc/cpuinfo, and the temp files generated with -O3. I imagine the .o and binary is not too helpful, but can send them if needed. Thanks, Guido=