On Mon, Sep 6, 2021 at 12:40 PM Richard Earnshaw <rearn...@arm.com> wrote: > > > GCC was recently changed to prevent simplify_subreg from simplifying > a subreg of a mem when the mode of the new mem would have stricter alignment > constraints than the inner mem already has when the target requires > STRICT_ALIGNMENT. > > However, such targets may have specialist patterns that can handle > unaligned accesses and this restriction turns out to be unduly restrictive. > So limit this restriction to only apply when the inner mem is naturally > aligned to the inner mode.
Hmm, I think this can end up either generating wrong code or recog fails. The specific combination of alignment and mode of 'op' has been validated to be supported, replacing the mode with sth else would need re-validation of the combination. I'm not sure we can for example just query movmisalign support here and hope for LRA to reload the mem with that. So - where do you run into this? Is it possible to catch the situation on a higher level where more context as in the whole insn is visible? Thanks, Richard. > > gcc/ChangeLog: > > PR target/102125 > * simplify-rtx.c (simplify_context::simplify_subreg): Allow > simplifying (subreg (mem())) when the inner mem is already > misaligned for its type. > --- > gcc/simplify-rtx.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >