On 2021-03-11 15:56, Paul Gilmartin wrote:
On 2021-03-10, at 18:21:11, Robin Vowels wrote:
From: "Schmitt, Michael"
Sent: Thursday, March 11, 2021 10:26 AM
I was taught long ago to add 1 to a register using LA r#,1(,r#)
and to subtract 1 using BCTR r#,0.
Is the fastest way now to use AHI r#,1 and AHI r#,-1?
LA and BCTR are good when you don't want to change the CC.
BCTR R,0 is specially good because it needs only 2 bytes.
LA is good fir small values.
"Small" means when you can tolerate truncation to 24 or 31 bits.
You can use LA to subtract 1 if you have a negative value
in a base register, subject to the same limit.
Why would you do that, when BCTR R,0 will do it for free
with even zero as the source register (you get true -1
as a result). And besides, BCTR requires only 2 bytes,
LA needs 4.