From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23936 invoked by alias); 23 Jul 2011 10:09:47 -0000 Received: (qmail 23923 invoked by uid 22791); 23 Jul 2011 10:09:46 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_GJ 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; Sat, 23 Jul 2011 10:09:31 +0000 From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/39386] [avr] different computation results for O1 and O0 executables X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org 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: CC Known to fail 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 Date: Sat, 23 Jul 2011 10:09: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-07/txt/msg01919.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39386 Georg-Johann Lay changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gjl at gcc dot gnu.org Known to fail| | --- Comment #10 from Georg-Johann Lay 2011-07-23 10:08:33 UTC --- The problem arises from the following insns: *ashlqi3 ashlhi3 ashlsi3 ashrqi3 ashrhi3 ashrsi3 *lshrqi3 lshrhi3 lshrsi3 For variable shifts the first constraint alternative is "=r,0,r" avr.c:out_shift_with_cnt() reads else if (register_operand (operands[2], QImode)) { if (reg_unused_after (insn, operands[2])) op[3] = op[2]; else { op[3] = tmp_reg_rtx; if (!len) strcat (str, (AS2 (mov,%3,%2) CR_TAB)); } } so that in the very rare, pathological case of op0 = op1 = op2 and op2 is unused after the insn, wrong code gets generated. Fix is: if (reg_unused_after (insn, operands[2]) && !reg_overlap_mentioned_p (operands[0], operands[2])) or something like that.