public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Gunnar Von Boehn" <gunnar@genesi-usa.com>
To: "Andreas Schwab" <schwab@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Fix for GCC Bugzilla Bug 36133
Date: Tue, 17 Jun 2008 17:31:00 -0000	[thread overview]
Message-ID: <b989d750806171011j1717346ao3b4fa723197ab495@mail.gmail.com> (raw)
In-Reply-To: <je7iconupp.fsf@sykes.suse.de>

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 — Set according to the last bit shifted out of the operand;
unaffected for a shift
    count of zero.
N — Set if the result is negative; cleared otherwise.
Z — Set if the result is zero; cleared otherwise.
V — Always cleared.
C — 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 — Not affected.
N — Set if the operand is negative; cleared otherwise.
Z — Set if the operand is zero; cleared otherwise.
V — Always cleared.
C — 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 BCC?
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 <schwab@suse.de> wrote:
> "Gunnar Von Boehn" <gunnar@genesi-usa.com> 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ße 5, 90409 Nürnberg, Germany
> PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>

  reply	other threads:[~2008-06-17 17:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 13:33 Gunnar Von Boehn
2008-06-17 12:33 ` Andreas Schwab
2008-06-17 17:31   ` Gunnar Von Boehn [this message]
2008-06-17 19:21     ` Andreas Schwab
2008-06-19 12:50       ` Gunnar Von Boehn
2008-06-24 16:15         ` Gunnar Von Boehn
2008-06-25 19:05           ` Andreas Schwab
2008-06-27 13:02             ` Gunther Nikl
2008-06-27 13:48               ` Andreas Schwab
     [not found]               ` <b989d750806300851s6ff51ad3j4d8b3e6da6fe2599@mail.gmail.com>
2008-07-01  9:03                 ` Fwd: " Gunnar Von Boehn
2008-06-27 13:57           ` Andreas Krebbel
2008-06-27 14:12             ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b989d750806171011j1717346ao3b4fa723197ab495@mail.gmail.com \
    --to=gunnar@genesi-usa.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).