This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove mode argument from gen_rtx_SET


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]