Keith Riddell writes: <begin extract> One thought - your method gives equal treatment to all return codes If 80% or 90% are zero, then adding a zero test up front would speed the process for zero return <end extract/>
This is a common misapprehension. It would be the case for a nested if-then-else implementation, one of the form if rc = 0 then... else if rc= 4 then ... else if rc= 8 then ... ... else ... which is test-order sensitive. Prefixing a branch-table implementation with an ad hoc test for zero in fact slow things down. --jg On 8/28/12, Keith Riddell <kridd...@tibco.com> wrote: > One thought - your method gives equal treatment to all return codes > If 80% or 90% are zero, then adding a zero test up front would speed the > process for zero return > > -----Original Message----- > From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] > On Behalf Of Brent Longborough > Sent: Tuesday, August 28, 2012 2:26 AM > To: ASSEMBLER-LIST@LISTSERV.UGA.EDU > Subject: Fwd: Re: which instructions should I use? > > Sorry, that wasn't the best (unoptimised branch order), besides being wrong > and using the wrong register. I must be having a bad hair day. > Here's the amended version: > > * -------------------------------------------------------- > 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 R15,R0 Check RC within limits > BL RC_TREE(,R15) OK: go handle the RC > B BAD_RC Bad: go handle > * > 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 >