This is the mail archive of the gcc@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: simplify_subreg vs gen_rtx_SUBREG vis WORDS_BIG_ENDIAN


DJ Delorie <dj@redhat.com> writes:

> In expmed.c I see code like this:
>
>       if (REG_P (xop0) && GET_MODE (xop0) != op_mode)
> 	xop0 = gen_rtx_SUBREG (op_mode, xop0, 0);
>
> However, this is wrong for big-endian targets (h8300-elf in my case)
> because '0' is not the offset of the LSB of the register when it's a
> pseudo and op_mode is smaller than xop0's mode.  IIRC simplify_subreg
> does endian adjustments where gen_rtx_SUBREG does not, however,
> simplify_subreg may return NULL_RTX.
>
> What's the "right thing" to do here, these days?  I've temporarily put
> in a function to special case the failing case, but it seems...
> inelegant.  Is there a missing assumption somewhere?

One thing to do is to call simplify_gen_subreg.  I don't know why this
code still calls gen_rtx_SUBREG.  It's pretty old code.

But I don't think that will help.  I think this code is simply
incorrect.  It seems to assume that op_mode is at least as large as
GET_MODE (xop0), probably because that will be the case on the m68k.

Ian


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