From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10168 invoked by alias); 17 Jun 2008 17:11:31 -0000 Received: (qmail 10160 invoked by uid 22791); 17 Jun 2008 17:11:30 -0000 X-Spam-Check-By: sourceware.org Received: from yw-out-1718.google.com (HELO yw-out-1718.google.com) (74.125.46.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 17 Jun 2008 17:11:13 +0000 Received: by yw-out-1718.google.com with SMTP id 5so2954190ywm.26 for ; Tue, 17 Jun 2008 10:11:05 -0700 (PDT) Received: by 10.150.186.21 with SMTP id j21mr13206536ybf.86.1213722664937; Tue, 17 Jun 2008 10:11:04 -0700 (PDT) Received: by 10.150.152.8 with HTTP; Tue, 17 Jun 2008 10:11:04 -0700 (PDT) Message-ID: Date: Tue, 17 Jun 2008 17:31:00 -0000 From: "Gunnar Von Boehn" To: "Andreas Schwab" Subject: Re: Fix for GCC Bugzilla Bug 36133 Cc: gcc-patches@gcc.gnu.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-06/txt/msg01090.txt.bz2 Hi Andreas, Please have a look at the MOTOROLA 68k Programming model (M68000PRM) for a definition of how the flags are set by the shift instructions. ie. Page 218 for the LSL, LSR instructions: Bit X =97 Set according to the last bit shifted out of the operand; unaffected for a shift count of zero. N =97 Set if the result is negative; cleared otherwise. Z =97 Set if the result is zero; cleared otherwise. V =97 Always cleared. C =97 Set according to the last bit shifted out of the operand; cleared for a shift count of zero. Lets compare how the flags are set to how the flags would be set by the otherwise used TST instruction: p 296 TST X =97 Not affected. N =97 Set if the operand is negative; cleared otherwise. Z =97 Set if the operand is zero; cleared otherwise. V =97 Always cleared. C =97 Always cleared. As you can see the flags N Z V are set 100% the same way by LSX and TST. Do you agree with me that the flags N,Z,V are those that will be used by BC= C? Isn't it true that GCC does not allow the user to generate BCC instructions which use the carry flag? Kind regards Gunnar von Boehn On Tue, Jun 17, 2008 at 1:53 PM, Andreas Schwab wrote: > "Gunnar Von Boehn" writes: > >> Please apply the patch and recompile. >> GCC is now aware that the LSR instruction does set the CC already and >> will not create the unneeded TST. > > That does not look correct, see the comment in notice_update_cc: > > case ASHIFT: case ASHIFTRT: case LSHIFTRT: > case ROTATE: case ROTATERT: > /* These instructions always clear the overflow bit, and set > the carry to the bit shifted out. */ > /* ??? We don't currently have a way to signal carry not valid, > nor do we check for it in the branch insns. */ > CC_STATUS_INIT; > break; > > Andreas. > > -- > Andreas Schwab, SuSE Labs, schwab@suse.de > SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany > PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different." >