public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Zidlicky <rz@linux-m68k.org>
To: Gunther Nikl <gni@gecko.de>
Cc: Bernardo Innocenti <bernie@develer.com>,
	Jim Wilson <wilson@specifixinc.com>,
	Richard Henderson <rth@redhat.com>,
	gcc@gcc.gnu.org
Subject: Re: [rz@linux-m68k.org: Re: m68k, extendqidi2 problem]
Date: Wed, 17 Mar 2004 22:35:00 -0000	[thread overview]
Message-ID: <20040317221131.GA9136@linux-m68k.org> (raw)
In-Reply-To: <20040317121732.GA15578@lorien.int.gecko.de>

On Wed, Mar 17, 2004 at 01:17:32PM +0100, Gunther Nikl wrote:
> > +      if (TARGET_68020 || TARGET_COLDFIRE)
> > +        return "move%.w %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
> > +      else
> > +        return "move%.w %1,%2\;ext%.w %0\;ext%.l %2\;move%.l %2,%0\;smi %0";
> 
>   Why "ext%.w %0"? Shouldn't it be "ext%.w %2"? Then I don't understand
>   the "move%.l %2,%0 in the else case and the extbl after smi in the if
>   case.

extb.l takes a byte and extends to long. ext.w extends byte to 16 bit.
It would work but needs an extra insn

> > +   return "move%.w %1,%2\;ext%.w %0\;ext%.l %2\;move%.l %2,%0\;smi %0";
                                ^^^^^^^^^

Thinking more about your question.. does that look like yet another bug
in the same pattern ?! 

So lets assume

> > +   return "move%.w %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";

..  makes more sense to me. The "move.l %2,%0" will set or clear upper 24
bits, smi the lower 8 bits of the high word register. Pure curiosity, why
isn't the same trick used in the 68020 branch?

Has that pattern ever been used before? Any more bugs in it?
I have now tried to convert it to "%R" notation.. 

(define_insn "extendqidi2"
  [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
        (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
  ""
{
  CC_STATUS_INIT;
  if (ADDRESS_REG_P(operands[1]))
    {
      if (TARGET_68020 || TARGET_COLDFIRE)
        return "move%.w %1,%R0\;extb%.l %R0\;smi %0\;extb%.l %0";
      else
        return "move%.w %1,%R0\;ext%.w %R0\;ext%.l %R0\;move%.l %R0,%0\;smi %0";
    }
  else
    {
      if (TARGET_68020 || TARGET_COLDFIRE)
        return "move%.b %1,%R0\;extb%.l %R0\;smi %0\;extb%.l %0";
      else
        return "move%.b %1,%R0\;ext%.w %R0\;ext%.l %R0\;move%.l %R0,%0\;smi %0";
    }
})



Richard

  parent reply	other threads:[~2004-03-17 22:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-17 11:02 Richard Zidlicky
2004-03-17 12:20 ` Gunther Nikl
2004-03-17 20:58   ` Jim Wilson
2004-03-17 22:35   ` Richard Zidlicky [this message]
2004-03-17 23:22     ` Jim Wilson
2004-03-18 10:47       ` Andreas Schwab
2004-03-18  9:57     ` Gunther Nikl

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=20040317221131.GA9136@linux-m68k.org \
    --to=rz@linux-m68k.org \
    --cc=bernie@develer.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gni@gecko.de \
    --cc=rth@redhat.com \
    --cc=wilson@specifixinc.com \
    /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).