From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5576 invoked by alias); 19 May 2013 09:43:10 -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 5543 invoked by uid 48); 19 May 2013 09:43:07 -0000 From: "glisse at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/25290] PHI-OPT could be rewritten so that is uses fold Date: Sun, 19 May 2013 09:43: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.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: glisse at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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-05/txt/msg01259.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25290 Marc Glisse changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |glisse at gcc dot gnu.org --- Comment #6 from Marc Glisse --- I assume it would help with this? int f(int a,int b){ return (a<0)&(b<0); } int g(int a,int b){ return (a<0)?(b<0):0; } int h(int a,int b){ if (a<0) return (b<0); return 0; } where (on x86) we turn g into f, but we don't notice that h is the same. In asm, that is: movl %esi, %eax andl %edi, %eax shrl $31, %eax ((a<0)&(b<0) is later optimized to (a&b)<0) vs shrl $31, %esi xorl %eax, %eax testl %edi, %edi cmovs %esi, %eax