about summary refs log tree commit diff
path: root/sysdeps/i386/i486
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-03-21 08:03:25 +0000
committerUlrich Drepper <drepper@redhat.com>2003-03-21 08:03:25 +0000
commit5a3ab2fc180056cb14eaeae0f571421be81e371b (patch)
treeaf48122e19c238a39db145412a11b1b551d472e6 /sysdeps/i386/i486
parent18627f615b80b51778a65cf588f2741ad5f9b0a7 (diff)
downloadglibc-5a3ab2fc180056cb14eaeae0f571421be81e371b.tar.gz
glibc-5a3ab2fc180056cb14eaeae0f571421be81e371b.tar.xz
glibc-5a3ab2fc180056cb14eaeae0f571421be81e371b.zip
Update.
2003-03-21  Ulrich Drepper  <drepper@redhat.com>

	* cancellation.c: Adjust for new form of compare&exchange macros.
	* cleanup_defer.c: Likewise.
	* init.c: Likewise.
	* libc-cancellation.c: Likewise.
	* old_pthread_cond_broadcast.c: Likewise.
	* old_pthread_cond_signal.c: Likewise.
	* old_pthread_cond_timedwait.c: Likewise.
	* old_pthread_cond_wait.c: Likewise.
	* pthread_cancel.c: Likewise.
	* pthread_create.c: Likewise.
	* pthread_detach.c: Likewise.
	* pthread_join.c: Likewise.
	* pthread_key_delete.c: Likewise.
	* pthread_setcancelstate.c: Likewise.
	* pthread_setcanceltype.c: Likewise.
	* pthread_timedjoin.c: Likewise.
	* pthread_tryjoin.c: Likewise.
	* sysdeps/pthread/createthread.c: Likewise.
Diffstat (limited to 'sysdeps/i386/i486')
-rw-r--r--sysdeps/i386/i486/bits/atomic.h49
1 files changed, 23 insertions, 26 deletions
diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h
index e22e560a38..2255e19f8e 100644
--- a/sysdeps/i386/i486/bits/atomic.h
+++ b/sysdeps/i386/i486/bits/atomic.h
@@ -55,23 +55,23 @@ typedef uintmax_t uatomic_max_t;
 #endif
 
 
-#define __arch_compare_and_exchange_8_acq(mem, newval, oldval) \
-  ({ unsigned char ret;							      \
-     __asm __volatile (LOCK "cmpxchgb %b2, %1; setne %0"		      \
+#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
+  ({ __typeof (*mem) ret;						      \
+     __asm __volatile (LOCK "cmpxchgb %b2, %1"				      \
 		       : "=a" (ret), "=m" (*mem)			      \
 		       : "q" (newval), "1" (*mem), "0" (oldval));	      \
      ret; })
 
-#define __arch_compare_and_exchange_16_acq(mem, newval, oldval) \
-  ({ unsigned char ret;							      \
-     __asm __volatile (LOCK "cmpxchgw %w2, %1; setne %0"		      \
+#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
+  ({ __typeof (*mem) ret;						      \
+     __asm __volatile (LOCK "cmpxchgw %w2, %1"				      \
 		       : "=a" (ret), "=m" (*mem)			      \
 		       : "r" (newval), "1" (*mem), "0" (oldval));	      \
      ret; })
 
-#define __arch_compare_and_exchange_32_acq(mem, newval, oldval) \
-  ({ unsigned char ret;							      \
-     __asm __volatile (LOCK "cmpxchgl %2, %1; setne %0"			      \
+#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
+  ({ __typeof (*mem) ret;						      \
+     __asm __volatile (LOCK "cmpxchgl %2, %1"				      \
 		       : "=a" (ret), "=m" (*mem)			      \
 		       : "r" (newval), "1" (*mem), "0" (oldval));	      \
      ret; })
@@ -83,37 +83,34 @@ typedef uintmax_t uatomic_max_t;
    really going to be used the code below can be used on Intel Pentium
    and later, but NOT on i486.  */
 #if 1
-# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
+# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
   (abort (), 0)
 #else
 # ifdef __PIC__
-#  define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
-  ({ unsigned char ret;							      \
-     int ignore;							      \
-     __asm __volatile ("xchgl %3, %%ebx\n\t"				      \
-		       LOCK "cmpxchg8b %2, %1\n\t"			      \
-		       "setne %0\n\t"					      \
-		       "xchgl %3, %%ebx"				      \
-		       : "=a" (ret), "=m" (*mem), "=d" (ignore)		      \
+#  define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+  ({ __typeof (*mem) ret;						      \
+     __asm __volatile ("xchgl %2, %%ebx\n\t"				      \
+		       LOCK "cmpxchg8b %1\n\t"			      \
+		       "xchgl %2, %%ebx"				      \
+		       : "=A" (ret), "=m" (*mem)			      \
 		       : "DS" (((unsigned long long int) (newval))	      \
 			       & 0xffffffff),				      \
 			 "c" (((unsigned long long int) (newval)) >> 32),     \
-			 "1" (*mem), "0" (((unsigned long long int) (oldval)) \
+			 "1" (*mem), "a" (((unsigned long long int) (oldval)) \
 					  & 0xffffffff),		      \
-			 "2" (((unsigned long long int) (oldval)) >> 32));    \
+			 "d" (((unsigned long long int) (oldval)) >> 32));    \
      ret; })
 # else
 #  define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
-  ({ unsigned char ret;							      \
-     int ignore;							      \
-     __asm __volatile (LOCK "cmpxchg8b %2, %1; setne %0"		      \
-		       : "=a" (ret), "=m" (*mem), "=d" (ignore)		      \
+  ({ __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),    \
-			 "1" (*mem), "0" (((unsigned long long int) (oldval)) \
+			 "1" (*mem), "a" (((unsigned long long int) (oldval)) \
 					  & 0xffffffff),		      \
-			 "2" (((unsigned long long int) (oldval)) >> 32));    \
+			 "d" (((unsigned long long int) (oldval)) >> 32));    \
      ret; })
 # endif
 #endif