From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4777 invoked by alias); 25 Jan 2015 17:42:30 -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 4422 invoked by uid 48); 25 Jan 2015 17:41:47 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/59533] [SH] Missed cmp/pz opportunity Date: Sun, 25 Jan 2015 17:42: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-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo 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: 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-01/txt/msg02784.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59533 --- Comment #7 from Oleg Endo --- If a shll is followed by a cbranch: unsigned int test_09_0 (int x, unsigned int y, unsigned int z) { return ~(x >> 31) ? y : z; } shll r4 bf .L4 mov r6,r5 .L4: rts mov r5,r0 it's better to use cmp/pz and invert the branch condition. Combine is looking for the following pattern: Failed to match this instruction: (set (pc) (if_then_else (ge (reg:SI 4 r4 [ x ]) (const_int 0 [0])) (label_ref:SI 17) (pc))) One option could be adding a pattern like: (define_insn_and_split "*cbranch" [(set (pc) (if_then_else (match_operand 0 "treg_set_expr") (label_ref (match_operand 1)) (pc))) (clobber (reg:SI T_REG))]