This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: generic and i386 bswap improvements


On Fri, Feb 16, 2007 at 10:58:44AM +0100, Uros Bizjak wrote:
> 
> Ugh... My mind was somewhere else. Of course we need moves to
> temporary as we are _swapping_ registers, not _moving_ them. Sorry for
> this slip of mind.

   But you could use xchgl instead of three movl instructions and a
temporary:

	xchgl	%eax, %edx
	(bswap %eax)
	(bswap %edx)
	ret

   I don't know about the speed of xchgl vs. 3*movl, but it is shorter and
doesn't need a scratch register.

-- 
Rask Ingemann Lambertsen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]