From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13939 invoked by alias); 1 Aug 2011 21:00:07 -0000 Received: (qmail 13890 invoked by uid 22791); 1 Aug 2011 21:00:05 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Aug 2011 20:59:52 +0000 From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/49939] New: [avr] Skip 2-word instructions if applicable X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: gjl 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-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 01 Aug 2011 21:00:00 -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 X-SW-Source: 2011-08/txt/msg00109.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49939 Summary: [avr] Skip 2-word instructions if applicable Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: gjl@gcc.gnu.org CC: eric.weddington@atmel.com Target: avr Curent avr-gcc from trunk compiles this C code char c; void foo (char a, char b) { if (a) c = b; } with -Os to foo: tst r24 ; 7 *cmpqi/1 [length = 1] breq .L1 ; 8 branch [length = 1] sts c,r22 ; 10 *movqi/3 [length = 2] .L1: ret ; 19 return [length = 1] which could be smarter using a CPSE skip instruction instead like so: foo: cpse r24, __zero_reg__ sts c,r22 .L1: ret At current, avr-gcc just emits skips over 1-word instructions. As of http://gcc.gnu.org/viewcvs?view=revision&revision=177049 avr-gcc now knows if it is also legal to skip 2-word instructions.