swap (a, b) - test

Michael Meissner meissner@cygnus.com
Mon Jan 5 14:13:00 GMT 1998


ak@muc.de (Andi Kleen) writes:

> __asm__("xchg %1,%0" ...); might be faster on x86 too.

Only if both operands are in registers.  Xchg with a memory operand, sets the
LOCK prefix which can slow down the reference.

-- 
Michael Meissner, Cygnus Solutions (Massachusetts office)
4th floor, 955 Massachusetts Avenue, Cambridge, MA 02139, USA
meissner@cygnus.com,	617-354-5416 (office),	617-354-7161 (fax)



More information about the Gcc mailing list