about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-21 11:14:51 +0000
committerRoland McGrath <roland@gnu.org>2003-03-21 11:14:51 +0000
commit26f24355d47367d01a04fca2226675e763cded29 (patch)
tree96112da8a3c2b0644994ace7f36832704e8a830f
parent4541b483a9b242529bcc1c8d72d29cbd2b445873 (diff)
downloadglibc-26f24355d47367d01a04fca2226675e763cded29.tar.gz
glibc-26f24355d47367d01a04fca2226675e763cded29.tar.xz
glibc-26f24355d47367d01a04fca2226675e763cded29.zip
2003-03-21 Roland McGrath <roland@redhat.com>
	* sysdeps/i386/i486/bits/atomic.h
	(__arch_compare_and_exchange_val_64_acq): Rewrite abort-calling
	version of the macro to avoid compile-time warnings.
	[! __PIC__] (__arch_compare_and_exchange_64_acq): Rename to above.
	(__arch_compare_and_exchange_bool_64_acq): New macro.
	(atomic_exchange_and_add, atomic_add): Fix name and usage of it.
	(atomic_increment, atomic_decrement): Likewise.
-rw-r--r--sysdeps/i386/i486/bits/atomic.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h
index 035905b782..502d392270 100644
--- a/sysdeps/i386/i486/bits/atomic.h
+++ b/sysdeps/i386/i486/bits/atomic.h
@@ -84,7 +84,7 @@ typedef uintmax_t uatomic_max_t;
    and later, but NOT on i486.  */
 #if 1
 # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-  (abort (), 0)
+  ({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); })
 #else
 # ifdef __PIC__
 #  define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
@@ -101,13 +101,13 @@ typedef uintmax_t uatomic_max_t;
 			 "d" (((unsigned long long int) (oldval)) >> 32));    \
      ret; })
 # else
-#  define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
+#  define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
   ({ __typeof (*mem) ret;						      \
      __asm __volatile (LOCK "cmpxchg8b %1"				      \
 		       : "=A" (ret), "=m" (*mem)			      \
 		       : "b" (((unsigned long long int) (newval))	      \
 			      & 0xffffffff),				      \
-			  "c" (((unsigned long long int) (newval)) >> 32),    \
+			 "c" (((unsigned long long int) (newval)) >> 32),    \
 			 "m" (*mem), "a" (((unsigned long long int) (oldval)) \
 					  & 0xffffffff),		      \
 			 "d" (((unsigned long long int) (oldval)) >> 32));    \
@@ -159,8 +159,9 @@ typedef uintmax_t uatomic_max_t;
 	 __typeof (mem) memp = (mem);					      \
 	 do								      \
 	   result = *memp;						      \
-	 while (__arch_compare_and_exchange_64_acq (memp, result + addval,    \
-						    result));		      \
+	 while (__arch_compare_and_exchange_val_64_acq (memp,		      \
+							result + addval,      \
+							result) == result);   \
        }								      \
      result; })
 
@@ -189,9 +190,8 @@ typedef uintmax_t uatomic_max_t;
 		__typeof (mem) memp = (mem);				      \
 		do							      \
 		  oldval = *memp;					      \
-		while (__arch_compare_and_exchange_64_acq (memp,	      \
-							   oldval + addval,   \
-							   oldval));	      \
+		while (__arch_compare_and_exchange_val_64_acq		      \
+		       (memp, oldval + addval, oldval) == oldval);	      \
 	      }								      \
 	    })
 
@@ -253,8 +253,8 @@ typedef uintmax_t uatomic_max_t;
 		__typeof (mem) memp = (mem);				      \
 		do							      \
 		  oldval = *memp;					      \
-		while (__arch_compare_and_exchange_64_acq (memp, oldval + 1,  \
-							   oldval));	      \
+		while (__arch_compare_and_exchange_val_64_acq		      \
+		       (memp, oldval + 1, oldval) == oldval);		      \
 	      }								      \
 	    })
 
@@ -297,8 +297,8 @@ typedef uintmax_t uatomic_max_t;
 		__typeof (mem) memp = (mem);				      \
 		do							      \
 		  oldval = *memp;					      \
-		while (__arch_compare_and_exchange_64_acq (memp, oldval - 1,  \
-							   oldval));	      \
+		while (__arch_compare_and_exchange_val_64_acq		      \
+		       (memp, oldval - 1, oldval) == oldval); 		      \
 	      }								      \
 	    })