You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by da...@apache.org on 2007/08/04 23:00:43 UTC
svn commit: r562765 - /apr/apr/trunk/atomic/unix/ia32.c
Author: davi
Date: Sat Aug 4 14:00:43 2007
New Revision: 562765
URL: http://svn.apache.org/viewvc?view=rev&rev=562765
Log:
Cleanup asm constraints (+ operand is both read and written by the instruction)
and clobbers. The xchg instruction always asserts the lock signal.
Modified:
apr/apr/trunk/atomic/unix/ia32.c
Modified: apr/apr/trunk/atomic/unix/ia32.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/atomic/unix/ia32.c?view=diff&rev=562765&r1=562764&r2=562765
==============================================================================
--- apr/apr/trunk/atomic/unix/ia32.c (original)
+++ apr/apr/trunk/atomic/unix/ia32.c Sat Aug 4 14:00:43 2007
@@ -83,10 +83,9 @@
{
apr_uint32_t prev = val;
- asm volatile ("lock; xchgl %0, %1"
- : "=r" (prev)
- : "m" (*(mem)), "0"(prev)
- : "memory");
+ asm volatile ("xchgl %0, %1"
+ : "=r" (prev), "+m" (*mem)
+ : "0" (prev));
return prev;
}
@@ -112,15 +111,13 @@
{
void *prev;
#if APR_SIZEOF_VOIDP == 4
- asm volatile ("lock; xchgl %2, %1"
- : "=a" (prev), "=m" (*mem)
- : "r" (with), "m" (*mem)
- : "memory");
+ asm volatile ("xchgl %2, %1"
+ : "=a" (prev), "+m" (*mem)
+ : "0" (with));
#elif APR_SIZEOF_VOIDP == 8
- asm volatile ("lock; xchgq %q2, %1"
- : "=a" (prev), "=m" (*mem)
- : "r" ((unsigned long)with), "m" (*mem)
- : "memory");
+ asm volatile ("xchgq %q2, %1"
+ : "=a" (prev), "+m" (*mem)
+ : "r" ((unsigned long)with));
#else
#error APR_SIZEOF_VOIDP value not supported
#endif