From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22048 invoked by alias); 1 Apr 2015 13:10:09 -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 21981 invoked by uid 48); 1 Apr 2015 13:10:05 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/65651] Redundant cmp with zero instruction in loop for x86 target. Date: Wed, 01 Apr 2015 13:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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: 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: 2015-04/txt/msg00047.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65651 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |uros at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- Well, there is a significant difference between the two testcases, one uses the result of the comparison just in == 0 test, thus CCZmode is appropriate, the other uses it in two comparisons, one == 0 test and one < 0 test. For combine to match *sub_2 insn, it has to match ix86_match_ccmode (insn, CCGOCmode) where CCGOCmode stands for: Add CCGOC to indicate comparisons against zero that allows unspecified garbage in the Carry and Overflow flag. This mode is used to simulate comparisons of (a-b) and (a+b) against zero using sub/cmp/add operations. But the jle instruction tests ZF || SF <> OF and thus it isn't appropriate. So the question is if the CCGOC test isn't too restrictive, say if CCGCmode would be sufficient (but then we'd still need to arrange for the CCGCmode to be used, rather than CCmode), or if the optimization you are looking for is simply not possible.