Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Mar 2005 21:04:32 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 74210 for review
Message-ID:  <200503312104.j2VL4WcC066967@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=74210

Change 74210 by jhb@jhb_slimer on 2005/03/31 21:03:35

	Revert more gcc memory clobber changes and fix a "+m" constraint
	that was left around.  I think I'm going to mostly punt on trying
	to relax the "memory" clobbers for now (except on amd64 where
	membars weren't implemented _at all_) and do that later.  Instead,
	I'm focusing on 1) changing atomic_ptr() to use uintptr_t because
	it makes things much simpler, and 2) removing +m constraints since
	+ is only supposed to be used with registers according to gcc info.

Affected files ...

.. //depot/projects/smpng/sys/alpha/include/atomic.h#20 edit
.. //depot/projects/smpng/sys/i386/include/atomic.h#30 edit

Differences ...

==== //depot/projects/smpng/sys/alpha/include/atomic.h#20 (text+ko) ====

@@ -208,7 +208,7 @@
 		"ldiq %1,0\n\t"		/* value to store */
 		"stq_c %1,%2\n\t"	/* attempt to store */
 		"beq %1,1b\n"		/* if the store failed, spin */
-		: "=&r"(result), "=&r"(temp), "+m" (*addr)
+		: "=&r"(result), "=&r"(temp), "=m" (*addr)
 		: "m" (*addr)
 		: "memory");
 #endif
@@ -222,7 +222,6 @@
 {									\
 	atomic_##NAME##_##WIDTH(p, v);					\
 	alpha_mb(); 							\
-	__asm __volatile("" ::: "memory");				\
 }									\
 									\
 static __inline void							\
@@ -263,7 +262,6 @@
 							\
 	v = *p;						\
 	alpha_mb();					\
-	__asm __volatile("" ::: "memory");		\
 	return (v);					\
 }							\
 							\
@@ -340,7 +338,6 @@
 
 	retval = atomic_cmpset_32(p, cmpval, newval);
 	alpha_mb();
-	__asm __volatile("" ::: "memory");
 	return (retval);
 }
 
@@ -358,7 +355,6 @@
 
 	retval = atomic_cmpset_64(p, cmpval, newval);
 	alpha_mb();
-	__asm __volatile("" ::: "memory");
 	return (retval);
 }
 

==== //depot/projects/smpng/sys/i386/include/atomic.h#30 (text+ko) ====

@@ -271,48 +271,34 @@
 
 #if !defined(WANT_FUNCTIONS)
 
-/* Acquire variants that add a "memory" clobber. */
-#define	ATOMIC_ACQ(NAME, TYPE)				\
-static __inline void					\
-atomic_##NAME##_acq_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
-{							\
-	atomic_##NAME##_##TYPE(p, v);			\
-	__asm __volatile("" ::: "memory");		\
-}							\
-struct __hack
-
-ATOMIC_ACQ(set,		char);
-ATOMIC_ACQ(clear,	char);
-ATOMIC_ACQ(add,		char);
-ATOMIC_ACQ(subtract,	char);
-
-ATOMIC_ACQ(set,		short);
-ATOMIC_ACQ(clear,	short);
-ATOMIC_ACQ(add,		short);
-ATOMIC_ACQ(subtract,	short);
-
-ATOMIC_ACQ(set,		int);
-ATOMIC_ACQ(clear,	int);
-ATOMIC_ACQ(add,		int);
-ATOMIC_ACQ(subtract,	int);
-
-#define	atomic_cmpset_acq_int		atomic_cmpset_int
-
-/* Release variants are identical to the normal ones. */
+/* Acquire and release variants are identical to the normal ones. */
+#define	atomic_set_acq_char		atomic_set_char
 #define	atomic_set_rel_char		atomic_set_char
+#define	atomic_clear_acq_char		atomic_clear_char
 #define	atomic_clear_rel_char		atomic_clear_char
+#define	atomic_add_acq_char		atomic_add_char
 #define	atomic_add_rel_char		atomic_add_char
+#define	atomic_subtract_acq_char	atomic_subtract_char
 #define	atomic_subtract_rel_char	atomic_subtract_char
 
+#define	atomic_set_acq_short		atomic_set_short
 #define	atomic_set_rel_short		atomic_set_short
+#define	atomic_clear_acq_short		atomic_clear_short
 #define	atomic_clear_rel_short		atomic_clear_short
+#define	atomic_add_acq_short		atomic_add_short
 #define	atomic_add_rel_short		atomic_add_short
+#define	atomic_subtract_acq_short	atomic_subtract_short
 #define	atomic_subtract_rel_short	atomic_subtract_short
 
+#define	atomic_set_acq_int		atomic_set_int
 #define	atomic_set_rel_int		atomic_set_int
+#define	atomic_clear_acq_int		atomic_clear_int
 #define	atomic_clear_rel_int		atomic_clear_int
+#define	atomic_add_acq_int		atomic_add_int
 #define	atomic_add_rel_int		atomic_add_int
+#define	atomic_subtract_acq_int		atomic_subtract_int
 #define	atomic_subtract_rel_int		atomic_subtract_int
+#define atomic_cmpset_acq_int		atomic_cmpset_int
 #define atomic_cmpset_rel_int		atomic_cmpset_int
 
 /* Read the current value and store a zero in the destination. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503312104.j2VL4WcC066967>