Nice!

I got to thinking it would be nice to have a "store different" instruction (or 
make store behave this way automatically under the covers) which would 
invalidate the cache only if what it were storing were different from what was 
in memory already.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of John McKown
Sent: Monday, February 17, 2014 6:37 AM
To: [email protected]
Subject: Re: Branch (was: Performance question - adding)

Combining the thoughts engendered from about three replies, I wonder if
avoiding a branch as follows (on a processor which supports the
instructions) would perform better than branching.

LT  R0,CURRENT #LOAD CURRENT AND SET CC
SPM R1 #SAVE CC FROM LT
A R0,SUM #ADD SUM TO IT
IPM R1 #RESTORE CC FROM LT
STOC R0,SUM,NZ #STORE SUM ONLY IF CC OF LT WAS NZ

Basically this loads CURRENT into R0, setting the CC based on its value.
Then saves the CC in R1. Adds the SUM value into R0. Restores the CC from
the LT, because the Add destroyed it. Then only stores the result in SUM if
the CC is "Not Zero", as set by the LT. I don't know if this code avoid the
"cache thrashing" mention by Ed. I don't know if the CPU needs to "lock"
the cache line if the STOC is a NOP due to the CC being zero (from the LT)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to