Re: Add 1, Subtract 1

2021-03-11 Thread robin51
On 2021-03-12 00:41, Peter Relson wrote: To add to what Charles M posted, Don't forget that LA in AMODE 31 always zeroes bit 32, and LA in AMODE 24 zeroes bits 32-39 of the 64-bit GR. That's another way that they are not functionally equivalent, if that difference matters to you. A good rule

Re: Add 1, Subtract 1

2021-03-11 Thread robin51
On 2021-03-12 00:38, Paul Gilmartin wrote: On 2021-03-10, at 22:10:14, robi...@dodo.com.au wrote: ... 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

Re: Add 1, Subtract 1

2021-03-11 Thread Seymour J Metz
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Add 1, Subtract 1 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?

Re: Add 1, Subtract 1

2021-03-11 Thread Peter Relson
To add to what Charles M posted, Don't forget that LA in AMODE 31 always zeroes bit 32, and LA in AMODE 24 zeroes bits 32-39 of the 64-bit GR. That's another way that they are not functionally equivalent, if that difference matters to you. A good rule of thumb is that when you have equivalent

Re: Add 1, Subtract 1

2021-03-11 Thread Seymour J Metz
: Add 1, Subtract 1 1. "Instruction speed" is not exactly a concept anymore due to pipelining. An instruction can take literally zero effective time because it overlaps with something else such as a wait for cache. "Does an AHI or an LA take longer?" is no longer a question that ha

Re: Add 1, Subtract 1

2021-03-11 Thread Paul Gilmartin
On 2021-03-10, at 22:10:14, robi...@dodo.com.au wrote: > ... >> >> 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

Re: Add 1, Subtract 1

2021-03-10 Thread Mike Hochee
Actually, I think 'small' means a 12 bit unsigned binary integer for LA and 20 bits for LAY. And with LAY you can simply express the displacement as a negative. >> 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

Re: Add 1, Subtract 1

2021-03-10 Thread robin51
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

Re: Add 1, Subtract 1

2021-03-10 Thread Paul Gilmartin
> 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? > >

Re: Add 1, Subtract 1

2021-03-10 Thread Mark Hammack
er List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU > ] > On Behalf Of Schmitt, Michael > Sent: Wednesday, March 10, 2021 3:26 PM > To: ASSEMBLER-LIST@LISTSERV.UGA.EDU > Subject: Add 1, Subtract 1 > > 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? >

Re: Add 1, Subtract 1

2021-03-10 Thread Robin Vowels
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

Re: Add 1, Subtract 1

2021-03-10 Thread Charles Mills
021 5:00 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: Add 1, Subtract 1 Hi Michael, You may want to check out the IBM Z optimization primers if you're super serious about this. Here's a link, and I believe there's a z15 version as well in 2020... https://community.ibm.com/HigherLogic/Sy

Re: Add 1, Subtract 1

2021-03-10 Thread Charles Mills
Sorry: LHI in the below should be AHI, of course. Charles -Original Message- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of Charles Mills Sent: Wednesday, March 10, 2021 4:56 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: Add 1, Subtract 1

Re: Add 1, Subtract 1

2021-03-10 Thread Mike Hochee
@LISTSERV.UGA.EDU] On Behalf Of Schmitt, Michael Sent: Wednesday, March 10, 2021 6:26 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Add 1, Subtract 1 Caution! This message was sent from outside your organization. I was taught long ago to add 1 to a register using LA r#,1(,r#) and to subtract 1 using BCTR r

Re: Add 1, Subtract 1

2021-03-10 Thread Steve Smith
If you have to ask, it doesn't matter. sas On Wed, Mar 10, 2021 at 6:27 PM Schmitt, Michael wrote: > 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? >

Re: Add 1, Subtract 1

2021-03-10 Thread Charles Mills
ailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of Schmitt, Michael Sent: Wednesday, March 10, 2021 3:26 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Add 1, Subtract 1 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 us

Add 1, Subtract 1

2021-03-10 Thread Schmitt, Michael
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?