On 27 December 2015 at 14:47, Skip Robinson <jo.skip.robin...@att.net> wrote:
> As a newbie, I got curious about the relative speed of these strategies:
>
> 1. L R15, COUNTER
> 2. A R15,=F(+1)
> 3. ST R15, COUNTER
>
> 1. L R15, COUNTER
> 2. LA R15,1(,R15)
> 3. ST R15, COUNTER
>
> I asked my manager, who encouraged me to delve into the manual Shmuel cites.
> I decided that LA was faster because there was no storage access. The
> program ran like a banshee. It ran so fast that it was used to benchmark new
> hardware. Really!
>
> It wasn't till later that I pondered a basic flaw. As written, the program
> could not handle a counter greater than 16M because it ran in 24 bit mode.

There's a third model for this very common operation:

LA    R15,1
A     R15,COUNTER
ST    R15,COUNTER

This handles the full 31-bit range and maintains the advantage of the
LA not referencing storage, but brings the ST closer in
time/cycles/etc. to the A, which could conceivably make it wait for
the result of the A, whereas the LA could perhaps have its result
ready faster.

Nonetheless it in some sense looks "wrong", I suppose because we are
thinking of COUNTER as needing to have something added to it, and not
1 as needing to have something added to *it*, however much we know
addition to be commutative.

> Moral: whether or not size matters, speed is certainly not a simple metric.

Indeed.

Tony H.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to