> > <snip>
> > Referring to your 3-instruction example directly above, > > LHI is no better than SR, for it cannot be executed until the > > ST has completed. The shortest instructions are therefore > > to be preferred. > > Perhaps I did not identify my information source clearly > enough. The hardware designer who provided the response I > quoted is Tim Slegel, IBM Distinquished Engineer, a lead > hardware processor designer for several generations of > IBM mainframe machines. It seems unlikely that you would > be more expert in the internal implementation of these > machines than he is. > > > Jim Mulder z/OS System Test IBM Corp. Poughkeepsie, NY > I guess the "problem" is that this is just counter intuitive. But given the hardware of today, I don't even bother to try to understand why one instruction is a better performer than another. The impact of pipelining and concurrent execution of specific "micro ops" (not the right term, but I don't know the right term) makes trying to optimize at the individual instruction level a waste of time, IMO. I would guess that the difference in time to "clear a register to 0" using any single instruction likely will not be significant. More significant would be the algorithm used to perform a "logical function". E.g. I need to sort something, using a bubble sort vs. quick sort vs. heap sort is more likely to have a greater effect on the time. And which to use is likely to be data dependent. Sorting 20 elements, bubble sort is OK. Sorting 20,000 elements which are "random", quick sort. Sorting 20,000 elements which are already _almost_ in order, heap sort is a good choice (because quick sort is _slow_ on data is is already "almost sorted"). But it is nice to have some idea of relative speed of an instruction, especially given things like one instruction being dependent (and so not overlapped) on a preceding instruction. Perhaps that is a decent reason to use an optimizing compiler such as C/C++, especially Metal C since you can "embed" HLASM code inside it. I really wish that IBM would, like GCC, allow embedding HLASM in a normal C program. Yes, it could "mess up" some optimizations. In lieu of this, I wish that C had a better "system interface" in its run time. Such as being able to do ENQ/DEQ (or ISGENQ) or VSMLIST et al. While I'm wishing, I wish it were free too <grin/>. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! <>< John McKown
