I doubt whether there is much difference between methods of
zeroing a register now.  I would assume that if you want the
condition code preserved, LHI is best, otherwise use XR, but SR
on modern hardware probably takes the same time as XR anyway.
I would expect current hardware to detect XR with identical
operands and to treat it as a "Zero this register" instruction.

Back in the mists of time, XR was a bad idea because some
machines (370/135 comes to mind) handled it byte by byte as a
logical operation, and SR could be slower than SLR, especially
when fixed point overflow was enabled, so SLR was preferred.
However, the condition code following SLR reg,reg is 2 rather
than 0 which could be confusing.  So a common approach was to
define a macro to do it, which could be updated to whatever was
best at the time.

Jonathan Scott, HLASM
IBM Hursley, UK

Reply via email to