Unless performance is an issue, I generally opt for simplicity. If performance 
is an issue I encapsulate it in a macro that generates different code for 
different processors.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Assembler List [[email protected]] on behalf 
of Dan Greiner [[email protected]]
Sent: Tuesday, October 20, 2020 11:42 PM
To: [email protected]
Subject: Re: Conditional MVCL macro?

One of the questions that I always ask in response to concerns about whether 
one instruction is better than another is, "Do you ever expect to recoup the 
number of instructions needed to reassemble, rebind, and retest the code?"

Assuming that the answer is "Yes, this code is executed a gazillion times a 
second," then I would ask whether the data being moved are (a) going to be 
manipulated by the CPU in the near future, or (b) on its way to an output 
buffer that the CPU won't touch again.

If (a), then the question of how much data is being moved comes into question. 
If you're moving a small amount of data (say, less than 4K), then one or more 
MVCs is probably a good choice. If you're moving a gazillion bytes of data 
(i.e., more than the CPU's cache size), then (by default) you're assured that 
whatever was last moved is what's in the cache when the instruction completes 
(which may or may not be what you intended) ... so the answer implicitly looks 
more like (b).

To assert control over whether MVCL wipes out the cache, check out the 
discussion of the special pad characters X'B0' and X'B8' used by the 
instruction on page 7-291 (RHC) of the "z/Architecture Principles of Operation" 
(SA22-7821-12); similarly for MVCLE, see page 7-296 (LHC). Additionally, both 
instructions provide a special pad character (X'B1'), determining whether the 
instruction can perform multiple access references to the data (which is really 
only interesting if other CPUs are simultaneously observing the same locations 
in memory).

Kevin Shum's seminal work on processor optimization, "IBM z Systems Processor 
Optimization Primer" (which discusses MVCL and MVCLE), can be found at 
https://community.ibm.com/HigherLogic/System/DownloadDocumentFile.ashx?DocumentFileKey=d1cdb394-0159-464c-92a3-3f74f8c545c4&forceDialog=0.

Reply via email to