This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Remove mode argument from gen_rtx_SET
- From: Richard Sandiford <richard dot sandiford at arm dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: "Franz dot Sirl-kernel\ at lauterbach dot com" <Franz dot Sirl-kernel at lauterbach dot com>, "segher\ at kernel dot crashing dot org" <segher at kernel dot crashing dot org>, "gcc-patches\ at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 09 May 2015 10:52:12 +0100
- Subject: Re: Remove mode argument from gen_rtx_SET
- Authentication-results: sourceware.org; auth=none
- References: <87ioc4vct9 dot fsf at e105548-lin dot cambridge dot arm dot com> <554C90BE dot 5080105 at lauterbach dot com> <20150508115747 dot GA11371 at gate dot crashing dot org> <554CB17E dot 4040406 at lauterbach dot com> <877fsjupyh dot fsf at e105548-lin dot cambridge dot arm dot com> <201505081642 dot t48Ggwbp001371 at greed dot delorie dot com>
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