I suspect that all of the RR instructions used to clear a register have the same performance.
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 עַם יִשְׂרָאֵל חַי נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר ________________________________________ From: IBM Mainframe Assembler List <[email protected]> on behalf of Paul Gilmartin <[email protected]> Sent: Tuesday, February 10, 2026 12:58 PM To: [email protected] <[email protected]> Subject: Re: Half-word Counter in Storage -- Best Practice External Message: Use Caution On 2/9/26 11:48, David Clark wrote: > If a half-word counter has to be in storage (to save on registers) and must > start at zero, which is better or which would you prefer to do as a best > practice? > ... There are multiple ways to clear a register. What is the best one? > ...simply clear storage? > > XC STRGLEN,STRGLEN FOR USED STRING LENGTH COUNTER > > ...or clear a register and save to storage? > > XR R5,R5 STARTING AT ZERO > STH R5,STRGLEN SET USED STRING LENGTH COUNTER > > ...or use an immediate value and save to storage? > > LHI R5,0 STARTING AT ZERO > STH R5,STRGLEN SET USED STRING LENGTH COUNTER -- gil
