This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Further LRA subreg handling issues
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Matthew Fortune <Matthew dot Fortune at imgtec dot com>
- Cc: gcc at gcc dot gnu dot org, Vladimir Makarov <vmakarov at redhat dot com>, Richard Sandiford <rdsandiford at googlemail dot com>, "Jeff Law <law at redhat dot com> (law at redhat dot com)" <law at redhat dot com>
- Date: Thu, 26 Jan 2017 16:42:06 +0100
- Subject: Re: [RFC] Further LRA subreg handling issues
- Authentication-results: sourceware.org; auth=none
- References: <6D39441BF12EF246A7ABCE6654B0235380B2A969@HHMAIL01.hh.imgtec.org> <12173989.GHYlAhQvjj@polaris> <6D39441BF12EF246A7ABCE6654B0235380B3A93A@HHMAIL01.hh.imgtec.org>
> However in lra-constraints.c:simplify_operand_subreg it quite happily
> performs a reload using the outer mode in this case and only drops down to
> the inner mode if the outer mode reload would be slower than the inner.
> Presumably this is safe for non WORD_REGISTER_OPERATIONS targets as the
> junk upper bits in registers will be ignored; On WORD_REGISTER_OPERATIONS
> targets then the narrower-than-word mode load will take care of any
> 'magic' needed to set the upper bits to a safe value in register.
Yes, I was leaning to the same conclusion before reading your second message.
> So my thinking is that at least WORD_REGISTER_OPERATIONS targets should
> always reload the inner mode for the case mentioned above much like the same
> is required for normal subregs. Does that seem reasonable? Have I
> misunderstood the paradoxical subreg case entirely?
No, this is correct, see find_reloads:
/* We must force a reload of paradoxical SUBREGs
of a MEM because the alignment of the inner value
may not be enough to do the outer reference. On
big-endian machines, it may also reference outside
On machines that extend byte operations and we have a
SUBREG where both the inner and outer modes are no wider
than a word and the inner mode is narrower, is integral,
and gets extended when loaded from memory, combine.c has
made assumptions about the behavior of the machine in such
register access. If the data is, in fact, in memory we
must always load using the size assumed to be in the
register and let the insn do the different-sized
This is doubly true if WORD_REGISTER_OPERATIONS. In
this case eliminate_regs has left non-paradoxical
subregs for push_reload to see. Make sure it does
by forcing the reload.