Re: NOP instruction

Gabriel Paubert (paubert@iram.es)
Tue, 15 Dec 1998 14:26:12 +0100 (MET)


On Tue, 15 Dec 1998, Tigran Aivazian wrote:

>
>
> On Tue, 15 Dec 1998, Gabriel Paubert wrote:
> > Actually the Intel nop is coded as xchg [e]ax,[e]ax since the 8088. On the
> > 386, it took exactly the same time as xchg [e]ax with any other register
> > and was slow. From the 486 or Pentium, I can't remember, the NOP is
> > optimized and much faster than the actual xchg instructions.
> Besides xchg is atomic (which is why it is used in locking primitives (at least
> on some systems)) and is to be avoided whenever possible.
>

True, but here we are referring to the xchg between registers, and more
specifically the short form xchg[wl] (0x90 to 0x97 opcode, exchanging
%[e]ax with any other of the "general purpose" registers) which do not
imply bus operation nor any locking whatsoever. Even the long form won't
perform any locking if you don't use any memory operands (xchgb %ah,%al
has no short form for example).

Gabriel.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/