On 2021-03-12 00:38, Paul Gilmartin wrote:
On 2021-03-10, at 22:10:14, robi...@dodo.com.au wrote:
    ...

You can use LA to subtract 1 if you have a negative value
in a base register, subject to the same limit.

Why would you do that, when BCTR R,0 will do it for free
with even zero as the source register (you get true -1
as a result). And besides, BCTR requires only 2 bytes,
LA needs 4.

What if you want to subtract 42?

What if you don't?
BCTR was designed for decrementing 1 for loop control
and for the special case when 1 was decremented (without branch).
That was useful in conjunction with the EX instruction.

I saw this done in some naively machine-generated code
targeted for s/370, which had only LA as an immediate
instruction.  The code dedicated a pair of base registers
for -4096 and -8192 to facilitate addressing control
block prefixes.  I suspect the author was most familiar
with PDP-11.

The code worked.

Dodgy, in general and not much good when the result is negative.

Reply via email to