For those of us who still have to use coal-fired 360s, it was good, at
last, to see Tony's contribution, standing out head-and-shoulders above
the rest.

But even Tony's is slightly overkill. NR sets the condition code, so you
don't need the Load-and-test:

* --------------------------------------------------------
         LA    R0,3          Mask for multiple of 4
         NR    R0,R15        Check multiple of 4
         BNZ   BAD_RC        Not so: error
*
         LA    R0,BIG_RC     Lowest invalid RC
         CLR   R0,R3         Check RC within limits
         BL    BAD_RC        Not so: error
*
         B     RC_TREE(,R3)  OK: go handle the RC
*
RC_TREE  B     RC0           No error
         B     RC4           Record not found (whatever)
         B     RC8           Zombie attack
         B     RC12          Gross security breach
BIG_RC   EQU   *-RC_TREE     Bigger RCs are invalid
* --------------------------------------------------------

Brent Longborough

> -----Original Message -----
>
> Date:    Mon, 27 Aug 2012 13:19:10 -0400
> From:    Tony Thigpen <t...@vse2pdf.com>
> Subject: Re: which instructions should I use?
>
> Your code requires 2 scratch registers. The following uses just 1
> scratch register and does not require literal storage:
>
>    LA R0,3
>    NR R0,R15
>    LTR R0,R0
>    BNZ BAD_RC
>
> (I still have to use code that works on boxes without the jump
> instructions.)
>
> Tony Thigpen

Reply via email to