On 2012-01-10 05:48, Eitan Adler wrote:
On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney<j...@funkthat.com> wrote:
Last time I did benchmarking on this ~10 years ago, it was slower to
use xor instead of using assignments...
I'd be shocked if the compiler didn't optimize this away to an XCHG.
Even with our ancient gcc 4.2 (on i386):
VGLLine:
[...]
movl 12(%ebp), %edx
movl 16(%ebp), %eax
movl $1, -56(%ebp)
xchgl %eax, %edx
movl %edx, 12(%ebp)
movl 24(%ebp), %edx
movl %eax, 16(%ebp)
movl %ecx, %eax
xchgl %edx, %esi
movl %edx, 24(%ebp)
movl -84(%ebp), %edx
xchgl %eax, %edx
movl %eax, -80(%ebp)
movl %edx, -84(%ebp)
With clang, the corresponding local variables seem to have been
optimized away entirely (or rather, moved around).
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"