On Thu, Nov 14, 2019 at 05:51:14PM -0500, Michael Meissner wrote:
> In some of my previous work, I had make a mistake forgetting that the PADDI
> instruction did not allow adding a PC-relative reference to a register (you 
> can
> either load up a PC-relative address without adding a register, or you can add
> a register to a constant).  The assembler allowed the instruction, but it
> didn't do what I expected.

So, what was the instruction?

> --- gcc/config/rs6000/rs6000.c        (revision 278175)
> +++ gcc/config/rs6000/rs6000.c        (working copy)
> @@ -13241,7 +13241,10 @@ print_operand_address (FILE *file, rtx x
>        if (SYMBOL_REF_P (x) && !SYMBOL_REF_LOCAL_P (x))
>       fprintf (file, "@got");
>  
> -      fprintf (file, "@pcrel");
> +      /* Specifically add (0),1 to catch uses where a @pcrel was added to a 
> an
> +      address with a base register, since the hardware does not support
> +      adding a base register to a PC-relative address.  */
> +      fprintf (file, "@pcrel(0),1");

But this is print_operand_address, it shouldn't know anything about
specific instructions, it certainly shouldn't print commas and other
fields.

Can you fix this in the caller?


Segher

Reply via email to