This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: simplify_subreg vs gen_rtx_SUBREG vis WORDS_BIG_ENDIAN
- From: Ian Lance Taylor <iant at google dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 24 Oct 2008 22:55:51 -0700
- Subject: Re: simplify_subreg vs gen_rtx_SUBREG vis WORDS_BIG_ENDIAN
- References: <200810250246.m9P2kFRj012199@greed.delorie.com>
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