Re: PowerPC assembler question

2013-06-16 Thread Benjamin Herrenschmidt
On Sun, 2013-06-16 at 16:30 +1000, Erik de Castro Lopo wrote: > Been busy, but I'm back looking at this. > > David Laight wrote: > > > With a scratch register there are some two instruction sequences. > > Reusing the destination register something like: > > > > addis %r30,%r31,hi(.label - 1

Re: PowerPC assembler question

2013-06-15 Thread Erik de Castro Lopo
Been busy, but I'm back looking at this. David Laight wrote: > With a scratch register there are some two instruction sequences. > Reusing the destination register something like: > > addis %r30,%r31,hi(.label - 1b) > lwzx%r30,lo(.label - 1b)(%r30) > I've managed to convert th

Re: PowerPC assembler question

2013-06-10 Thread Benjamin Herrenschmidt
On Mon, 2013-06-10 at 21:14 +1000, Erik de Castro Lopo wrote: > Benjamin Herrenschmidt wrote: > > > No, this loads a 32-bit value (16-bit would be lhz). > > My understanding so far (which may be wrong) is that it loads a > 32 bit value but it loads it from a memory location that needs > to be wit

RE: PowerPC assembler question

2013-06-10 Thread David Laight
> > Note: It's more readable if you use the register names, ie: > > > > lwz %r30, .label - (1b)(%r31) > > > > The form of lwz is > > > > lwz dest_reg, offset(address_reg) > > > > So it will load a 32-bit value from memory at the address contained in > > r31 offset by ".label - 1b" w

Re: PowerPC assembler question

2013-06-10 Thread Erik de Castro Lopo
Benjamin Herrenschmidt wrote: > No, this loads a 32-bit value (16-bit would be lhz). My understanding so far (which may be wrong) is that it loads a 32 bit value but it loads it from a memory location that needs to be within +/- 32k of the instriction doing the load. The reason I think this is b

Re: PowerPC assembler question

2013-06-09 Thread Benjamin Herrenschmidt
On Mon, 2013-06-10 at 09:01 +1000, Erik de Castro Lopo wrote: > Hi all, > > I'm trying to fix a problem in the PowerPC backend of the Glasgow > Haskell Compiler (GHC) and have a problem with the following > instruction form: > > lwz 30, .label - (1b)(31) > > Reading the documentation I c