public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: DJ Delorie <dj@redhat.com>
Cc: "Franz.Sirl-kernel\@lauterbach.com"
	<Franz.Sirl-kernel@lauterbach.com>,
	 "segher\@kernel.crashing.org" <segher@kernel.crashing.org>,
	 "gcc-patches\@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: Remove mode argument from gen_rtx_SET
Date: Sat, 09 May 2015 09:52:00 -0000	[thread overview]
Message-ID: <87zj5e13jn.fsf@e105548-lin.cambridge.arm.com> (raw)
In-Reply-To: <201505081642.t48Ggwbp001371@greed.delorie.com> (DJ Delorie's	message of "Fri, 8 May 2015 17:42:58 +0100")

DJ Delorie <dj@redhat.com> writes:
>> ; This pattern is identical to the truncsipsi2 pattern except
>> ; that it uses a SUBREG instead of a TRUNC.  It is needed in
>> ; order to prevent reload from converting (set:SI (SUBREG:PSI (SI)))
>> ; into (SET:PSI (PSI)).
>> 
>> I'm not sure what that's supposed to mean (what's an SI set of a PSI
>> subreg?), but I suspect removing the mode would lose information,
>> so I left it alone.
>
> MSP430 has 20-bit registers (PSImode-sized).  One register can hold an
> HI or PSI sized value, but if you have an SI value it's stored as two
> HI registers.
>
> Thus, a PSImode value in a register is *not* just the 20 LSB of an
> SImode value.  Also, a PSImode subset of an SI value is stored
> different than a PSImode value on its own.
>
> Thus, consider code like this:
>
> (set (reg:SI 1)
>      (subreg:PSI (reg:SI 2)))
>
> (set (reg:PSI 1)
>      (reg:PSI 2))
>
> On most architectures, you'd say "these do the same thing" but on
> MSP430 they don't.

What I was confused about is that the first set isn't valid rtl.
The SET_SRC and SET_DEST always have to have the same mode
(or VOIDmode in the case of a CONST_INT, etc., where the mode
is implicitly the same as the SET_DEST).  So wouldn't it have
to be:

  (set (reg:SI 1)
       (subreg:SI (reg:PSI 2)))

or:

  (set (reg:PSI 1)
       (subreg:PSI (reg:SI 2)))

?

Thanks,
Richard

  reply	other threads:[~2015-05-09  9:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07 11:37 Richard Sandiford
2015-05-07 13:36 ` Jeff Law
2015-05-07 14:00   ` Richard Sandiford
2015-05-07 15:05     ` Jeff Law
2015-05-08 10:32 ` Franz Sirl
2015-05-08 11:58   ` Segher Boessenkool
2015-05-08 12:52     ` Franz Sirl
2015-05-08 14:03       ` Richard Sandiford
2015-05-08 16:43         ` DJ Delorie
2015-05-09  9:52           ` Richard Sandiford [this message]
2015-05-11 16:55             ` DJ Delorie

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=87zj5e13jn.fsf@e105548-lin.cambridge.arm.com \
    --to=richard.sandiford@arm.com \
    --cc=Franz.Sirl-kernel@lauterbach.com \
    --cc=dj@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    /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).