[SDL] amd64 [un]fixes in SDL_endian.h

Stephane Marchesin stephane.marchesin at wanadoo.fr
Tue Jan 25 08:35:53 PST 2005

Albert Cahalan wrote:

>On Sat, 2005-01-22 at 00:40 -0500, Mike Frysinger wrote:
>>the netbsd fix imported here:
>>made our problems go away nicely (i was able to reproduce original build 
>>failures and confirm the fix on an amd64 dev box)
>Doesn't a recent gcc know to use that instruction anyway?
>I think you can just get rid of the assembly code. The code
>might even run faster, since gcc would have more information
>about the code.
It might be true that removing it might be faster, but the reason is not 
that gcc has more or less "information about the code".

The reason is that xchg is an implicitly locking instruction when 
working with memory operands, which could be costly on smp.
That's why I suggested a fix putting "r" instead of "q", btw : to force 
the use of a register at all times and thus avoid the memory operand.


More information about the SDL mailing list