Here's another form of branch table combining compare and branches. Just thought it was interesting and one reason why I love assembler. So many possibilities.
XR R0,R0 INCREMENT = 0 LR R1,R0 BCTR R1,0 SET COMPARE = -1 JXLE R15,R0,LBL_RC_MINUS Label taken if <= -1 LA R1,MAX_RC SET COMPARE = MAX_RC JXH R15,R0,LBL_RC_GT_MAX Label taken if > MAX_RC B BRTAB(R15) BRTAB DS 0H J LABEL_RC0 J LABEL_RC4 J LABEL_RC8 J LABEL_RC12 -----Original Message----- From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> On Behalf Of Seymour J Metz Sent: Tuesday, November 23, 2021 17:12 To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: Base-less macros CAUTION: This message was sent from outside the company. Do not click links or open attachments unless you recognize the sender and know the content is safe. In light of subsequent messages, yes. ________________________________________ From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> on behalf of Tony Thigpen <t...@vse2pdf.com> Sent: Tuesday, November 23, 2021 1:33 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: Base-less macros I think Martin is really commenting that if you only have 3 branch possibilities, then the overhead of the validation is greater than just doing three Test-and-branch instruction pairs. I don't know about others, but I don't usually use a branch table unless I have 8 or more values. Many of my branch tables have 100+ entries. Tony Thigpen Seymour J Metz wrote on 11/23/21 12:31 PM: > ? > > What is a shorter way to do the error checking? > > > -- > Shmuel (Seymour J.) Metz > http://mason.gmu.edu/~smetz3 > > ________________________________________ > From: IBM Mainframe Assembler List [ASSEMBLER-LIST@LISTSERV.UGA.EDU] > on behalf of Martin Ward [mar...@gkc.org.uk] > Sent: Tuesday, November 23, 2021 12:27 PM > To: ASSEMBLER-LIST@LISTSERV.UGA.EDU > Subject: Re: Base-less macros > > On 23/11/2021 17:12, Seymour J Metz wrote: >> LTR R15,R15 >> JM BADIX >> CHI R15,LIMIT >> JH BADIX >> TML R15,3 >> JNZ BADIX >> J *+4(R15) >> BRTAB EQU * >> J RC0ROUTINE >> J RC4ROUTINE >> J RC8ROUTINE >> LIMIT EQU *-BRTAB > > Three test and branch instruction pairs plus two unconditional branch > instructions, all to avoid executing a sequence of up to three test > and branch instruction pairs :-) > > -- > Martin > > Dr Martin Ward | Email: mar...@gkc.org.uk | > http://secure-web.cisco.com/1Pzh0mz_8aE1yk4Zn65QdgWKxjXTYuplR0LTSWVThm > 5eBwv_XGYMaTUu-chekxBfi6Q9025E8Qko7Tv2AfAq4VKpPXZJATEnvK9yfCADRqS-MqJ- > 9CwXhQPcVAUaaVJisVYqePQcB1EgYhTEXUg6EMsRZGoSZYmbdXVC6DKXq6U8r16EOSntjB > Uqgbf2JkfOl98-JPqYFjgE8_O2ukkHD0bNk7EcYVFjZpL1RJqnISm5qT4Y1PLZTFqF7W4R > LN3SouhBZKmQy9KILd6gufPlqfnEZ6XXLr886LHYJ7D4RI2pkwR_tUPju4DD8dBYH0dI5v > bdm4BN1zPlh0lAnJdlARc5rcXUCQ658_9kIqdQ2ssUV8SW7IqhNvqBrN5QJARIDeNc6W-Q > -LfKdo7Pk9GyTpPv0B3hR9SkveNdRnWPBZDBmkTzbbHhclfSRqf0xnmsZ/http%3A%2F%2 > Fwww.gkc.org.uk G.K.Chesterton site: > http://secure-web.cisco.com/1OoGY6MPQRndcjIvC1a1r8dwvjRs0IiXumRn9B23l7 > Qi4vovkS4Ad8DCdEzjy7ZIxLBepUzkEB_3bndzCEBbgp6ItZFwrsQSie-z0aU7oWtR4pD- > YS5UwnfKWFfEM53hm7XEj8GMpX_xgRvBYE6TI0wql6IHyekYniK7_TXAPyRNm18FqTVb_E > Xc24xGkuM4ixs2eE2TlFlZFIZKuIvQCgjZs600JXzVB2Caqp-MsKzLomt4z2p5Y3oxjZF9 > k0tWw8BKgGSN-e2OHTuv1dZfxbT7sMdFq0_P0TneTPOkY5JnRjmQK04uRe9mgyNatqGClU > iwzLK4C7cShMxI2X-pM21gz0CRfnAG77jKiBGCgCVy-6Qak1MF7G9FPhX9rdPIB8sOIEru > uQuHWc0VVU9Ps4UvPqQIKmmIbtqJ76rIR9-r-TwsRyxErjP4aJaZlW7MQ/http%3A%2F%2 > Fwww.gkc.org.uk%2Fgkc | Erdos number: 4 > ------------------------------------------- NOTICE: This email and all attachments are confidential, may be proprietary, and may be privileged or otherwise protected from disclosure. They are intended solely for the individual or entity to whom the email is addressed. However, mistakes sometimes happen in addressing emails. If you believe that you are not an intended recipient, please stop reading immediately. Do not copy, forward, or rely on the contents in any way. Notify the sender and/or Imperva, Inc. by telephone at +1 (650) 832-6006 and then delete or destroy any copy of this email and its attachments. The sender reserves and asserts all rights to confidentiality, as well as any privileges that may apply. Any disclosure, copying, distribution or action taken or omitted to be taken by an unintended recipient in reliance on this message is prohibited and may be unlawful. Please consider the environment before printing this email.