Should not that be   LA     R5,0(,RG) ???

And... where can I find one of those machines? :-)

On 2/8/2022 12:58, Dave Clark wrote:
"IBM Mainframe Assembler List" <[email protected]> wrote on
02/08/2022 11:23:03 AM:
I use instructions for what they do, not for their motivation or
nomenclature.

         I would never begrudge another programmer their choices in getting
their job done.  Then again, I love it when I look at someone else's code
and I don't have to guess what it does or what was intended -- in
particular, my own, after many years since I originally wrote it.  So, I
like to write my code to be as self-documenting as possible.

         Now, both of the following *do* (as you said) nearly the same
thing.

LA   R5,0(,16)

LHI  R5,16

         But not only will the first one yield different results depending
upon the current addressing mode, but will also *require* you to look
elsewhere to determine what is being done with those results.  Why do you
have to look elsewhere?  Because you have to determine if the original
writer intended it for addressing, or not.

         The second one, on the other hand (and without looking anywhere
else), leaves no doubt in your mind that the original writer wanted
nothing more than a signed-halfword value as the one and only possible
result.

         The same goes for the following two instructions.  If I'm dealing
with an address, then I'll use the first one.  If I'm dealing with a
counter, then I'll use the second one.  Why?  Because, again, the second
one has only one result where the results of the first one depend upon
addressing mode.

BCTR R5,0

SHI  R5,1

         So, where possible, I *do* use instructions that make my intent
more obvious and I'll not apologize for that.


Sincerely,

Dave Clark

Reply via email to