[PATCH] V7, #4 of 7, Add explicit (0),1 to @pcrel references

Alan Modra amodra@gmail.com
Tue Nov 26 05:57:00 GMT 2019


On Mon, Nov 25, 2019 at 07:05:02PM -0600, Segher Boessenkool wrote:
> On Mon, Nov 25, 2019 at 05:52:29PM -0500, Michael Meissner wrote:
> > If you write:
> > 
> > 	paddi 10,9,foo@pcrel
> > 
> > The assembler will interpret this as:
> > 
> > 	paddi 10,9,(.-foo),0

foo-. actually.

> > I.e. it will add the difference from current instruction to foo and register 2
> > and place it in register 10.  But it will not add the current location for the
> > paddi.
> > 
> > Of course it might make sense if the assembler could flag the first line as an
> > error, and if you really wanted to write that, you should use:
> > 
> > 	paddi 10,9,foo@pcrel,0
> 
> Does it ever make sense to allow @pcrel on anything that is not prefixed
> and R=1?  (Cc: Alan).

Probably not, but we might want something similar to generate the high
part of a 64-bit pcrel offset.

   pli 11,(foo-1f)@highera34
   sldi 11,11,34
1: pla 12,foo@pcrel
   add 12,11,12

We don't have the necessary relocs at the moment, and in any case we
might be better off with other code sequences.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Gcc-patches mailing list