From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8323 invoked by alias); 11 Dec 2013 06:16:23 -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 8222 invoked by uid 48); 11 Dec 2013 06:16:17 -0000 From: "law at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/45685] [4.7/4.8/4.9 Regression] missed conditional move opportunity in loop Date: Wed, 11 Dec 2013 06:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.6.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: law at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: law at redhat dot com X-Bugzilla-Target-Milestone: 4.7.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: 2013-12/txt/msg00933.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45685 --- Comment #26 from Jeffrey A. Law --- Looking at this again, I think there's another solution. Basically we've got conditional negation occurring in both loops. There's a reasonably good sequence to turn that into straight line code. result = (input ^ -cond) + cond Will negate the input when cond is true. It looks a bit ugly, but significantly helps simplify the first loop where we go from 23 insns down to just 18 insns. It helps the second loop as well, but the results aren't as dramatic. >>From an implementation standpoint, it fits quite well into the existing phi-opt code structure.