From: Simon Marlow Date: Wed, 29 Jul 2009 07:53:07 +0000 (+0000) Subject: enable the x86-specific versions of atomic_inc()/atomic_dec() X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=1b6914d8a2ad53353651acf62a21a305e9b83876 enable the x86-specific versions of atomic_inc()/atomic_dec() --- diff --git a/includes/SMP.h b/includes/SMP.h index 7592abb..b753842 100644 --- a/includes/SMP.h +++ b/includes/SMP.h @@ -185,14 +185,14 @@ cas(StgVolatilePtr p, StgWord o, StgWord n) EXTERN_INLINE StgWord atomic_inc(StgVolatilePtr p) { -#if 0 // defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH) +#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH) StgWord r; r = 1; __asm__ __volatile__ ( "lock\nxadd %0,%1": "+r" (r), "+m" (*p): ); - return r; + return r+1; #else StgWord old, new; do { @@ -206,14 +206,14 @@ atomic_inc(StgVolatilePtr p) EXTERN_INLINE StgWord atomic_dec(StgVolatilePtr p) { -#if 0 //defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH) +#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH) StgWord r; r = (StgWord)-1; __asm__ __volatile__ ( "lock\nxadd %0,%1": "+r" (r), "+m" (*p): ); - return r; + return r-1; #else StgWord old, new; do {