From 418679e69b256f1307d5884117f22b6b57dcf3ea Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sat, 4 Aug 2007 21:00:43 +0000 Subject: Cleanup asm constraints (+ operand is both read and written by the instruction) and clobbers. The xchg instruction always asserts the lock signal. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@562765 13f79535-47bb-0310-9956-ffa450edef68 --- atomic/unix/ia32.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'atomic') diff --git a/atomic/unix/ia32.c b/atomic/unix/ia32.c index 191298c4a..3826f9275 100644 --- a/atomic/unix/ia32.c +++ b/atomic/unix/ia32.c @@ -83,10 +83,9 @@ APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint { 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 @@ APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with) { 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 -- cgit v1.2.1