Hi Aaron,

On Sat, Oct 27, 2018 at 11:20:01AM -0500, Aaron Sawdey wrote:
> --- gcc/config/rs6000/rs6000.md       (revision 265393)
> +++ gcc/config/rs6000/rs6000.md       (working copy)
> @@ -2512,9 +2512,27 @@
>    if (TARGET_POWERPC64 && TARGET_LDBRX)
>      {
>        if (MEM_P (src))
> -     emit_insn (gen_bswapdi2_load (dest, src));
> +        {
> +          rtx addr = XEXP (src, 0);
> +          if (!legitimate_indirect_address_p (addr, reload_completed)
> +              && !legitimate_indexed_address_p (addr, reload_completed))

Should you use indexed_or_indirect operand instead here?

> +            {
> +              addr = force_reg (Pmode, addr);
> +              src = replace_equiv_address_nv (src, addr);
> +            }
> +       emit_insn (gen_bswapdi2_load (dest, src));
> +        }

You could maybe make this a utility routine as well (in rs6000.c)...
Something like force_indexed_or_indirect_mem.  So this code will be just

      if (MEM_P (src))
        force_indexed_or_indirect_mem (src);

then.

Could you try those things please?


Segher

Reply via email to