Old habits die hard... I still just use    LA  1,256    although now I
might just code it as    LA   1,256(,0)

 :)

Notice in the example where there was a   USING 0,9   that the assembler
ends up choosing the highest numbered register (9 versus 0 in this case)
when more than one USING is in effect *and* the displacement would be the
same - that is why R9 is picked over the implied USING of "register"
zero...   - working as designed.


On Fri, 8 Nov 2019 at 17:49, Charles Mills <charl...@mcn.org> wrote:

> 1.. Wow. I did not know that, and I have been coding S/360 and follow-ons
> assembler since 1968. That would be an obscure bug-introducer.
>
> 2. I would argue that the preferred way (now -- not in 1968!) of loading a
> constant 256 into R2 is LHI R2,256. Avoids the problem below, is arguable\y
> more straightforward (no "address" anywhere in the picture) and might be
> faster on some machines.
>
> Charles
>
>
> -----Original Message-----
> From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU]
> On Behalf Of Bob Raicer
> Sent: Friday, November 8, 2019 1:15 PM
> To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
> Subject: Re: Questionable Instructions in Obtaining EAX documentation
>
> Well, the statement from Peter Relson (and others) which is
> essentially:
> ----------
> LA R1,1 is exactly equivalent to LA R1,1(0).  Just look at the
> generated object code.
> ----------
> is not totally true.  It all depends upon which USINGs are in effect.
>
> Take a peek at the following example (admittedly a bit unusual, but
> perfectly legitimate).
>
>     Loc   Object Code      Addr1    Addr2    Stmt   Source Statement
> 00000000                00000000 00000008      1 EXAMPLE  CSECT ,
>                      R:9 00000000               2          USING 0,9
> 00000000 4120 9100               00000100      3          LA 2,256
> 00000004 4120 0100               00000100      4          LA 2,256(,0)
>                                                 5          END   ,
>
> If the intent is to place a truly non-relocatable value (e.g., a
> constant) into a GPR (which IS the intent of this example), then I
> believe the coding style of statement 4 is the preferred way to go; it
> is explicit and unambiguous.  This applies to many other instructions
> which use base+displacement operands (examples:  SLL, SRL, SLDL)
> which are not interpreted as address values.
>

Reply via email to