From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26471 invoked by alias); 20 Mar 2015 12:01:05 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26446 invoked by uid 48); 20 Mar 2015 12:01:01 -0000 From: "linux at carewolf dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65492] New: Bad optimization in -O3 on SSE intrinsics Date: Fri, 20 Mar 2015 12:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: linux at carewolf dot com X-Bugzilla-Status: UNCONFIRMED 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 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg02101.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65492 Bug ID: 65492 Summary: Bad optimization in -O3 on SSE intrinsics Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: linux at carewolf dot com After investigating a loop using SSE intrinsics that was significantly faster in clang than in gcc, I discovered gcc had the same performance as clang in -O2, and only performed signficantly worse in -O3. Disabling all the switches mentioned in the documentation as activates by -O3 (or enabling them for -O2), doesn't fully account for the difference, but the switch -f(no-)tree-loop-vectorize accounts for roughly half of it. I have attached the files I used to test it. Using gcc -O2 or clang -O2 or -O3, it times in at 1.8s on my machine. Using g++ (4.9 or 5.0) -O3 it times in at 2.5s. Using -O3 -fno-tree-loop-vectorize it runs in 2.3s, and -O2 -ftree-vectorize at 2.25s. Using callgrind, it seems the performance difference is mainly spend on the accessing integers in the vector union.