From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31649 invoked by alias); 6 Oct 2012 13:31:15 -0000 Received: (qmail 31622 invoked by uid 48); 6 Oct 2012 13:31:00 -0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54829] bad optimization: sub followed by cmp w/ zero (ARM) Date: Sat, 06 Oct 2012 13:31:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-10/txt/msg00534.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54829 H.J. Lu changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|bad optimization: sub |bad optimization: sub |followed by cmp w/ zero |followed by cmp w/ zero |(x86 & ARM) |(ARM) --- Comment #2 from H.J. Lu 2012-10-06 13:31:00 UTC --- i386.md has (define_insn "*cmp_minus_1" [(set (reg FLAGS_REG) (compare (minus:SWI (match_operand:SWI 0 "nonimmediate_operand" "m,") (match_operand:SWI 1 "" ",m")) (const_int 0)))] "ix86_match_ccmode (insn, CCGOCmode)" "cmp{}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "")]) Since cmp will also set OF and CF flags, it can't be used for GT and LE which checks OF.