I agree on clarity, although BCTR is shorter, but why an equated symbol?
 
-- 
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
עַם יִשְׂרָאֵל חַי
נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר




________________________________________
From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> on behalf 
of Charles Mills <charl...@mcn.org>
Sent: Thursday, July 10, 2025 12:55 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU <ASSEMBLER-LIST@LISTSERV.UGA.EDU>
Subject: Re: Food for thought.


External Message: Use Caution


I prefer AHI to LA because of clarity. Faster or slower? IDK. Sets the CC, 
which might make it slower.

AHI is definitely preferable to BCTR IMHO because (a.) the intent is MUCH 
clearer and (b.) it takes an equated symbol.

Charles

-----Original Message-----
From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> On Behalf 
Of Mark Hammack
Sent: Thursday, July 10, 2025 9:40 AM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Food for thought.

Is there any advantage to using:

LA  Rx,1(,Rx)  vs.
AHI Rx,1

Back in the old days (I started on S/370 with MVS right before XA came out), to 
increment a register, you had to use option 1.  Now, either will work.  I 
prefer the latter because I think it is clearer what you intend but since it 
sets the CC flags, I'm not sure it is any "better" and may be
(slightly) slower.

Really, the same question can be asked about:

BCTR Rx,0 vs.
AHI  Rx,-1

and

LA   Rx,value
LHI  Rx,value

Same thing, the latter is much clearer, especially for new-to-assembler 
programmers. In the LA vs LHI case, LA is limited to 4095 whereas LHI can go to 
32767 so there is an advantage in some situations.

IDK, maybe it's the closet C programmer in me...




*Mark Hammack*


Reply via email to