On 2 June 2014 19:56, Robin Vowels <[email protected]> wrote:
> From: "Tony Harminc" <[email protected]>
> Sent: Tuesday, June 03, 2014 3:30 AM

>> Is LHI Rn,0 faster than SR Rn,Rn? I'd expect them to be the same, but
>> SR is half the size, and so lessens the amount of i-cache used.
>
> XR Rn,Rn is faster than SR.

I doubt it. Perhaps on much older machines, but I have little doubt
that modern machines have special cases for most or all common ways of
zeroing a register, e.g. SR Rn, Rn and XR Rn, Rn and LA Rn,0 and LHI
Rn,0 . And of course these are just the 32-bit versions. Yes, of
course there are many more ways of zeroing a register, but I doubt
there's much of a business case for optimizing things like LAY for
this.

> But does it matter?
> Such an instruction should be executed only once, and once only.
> It shouldn't be in the loop.

Well that surely depends on what the loop is doing.

Tony H.

Reply via email to