[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:
>>http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/include/SDL_endian.h.diff?r1=1.11&r2=1.12
>>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.

Stephane







More information about the SDL mailing list