]> granicus.if.org Git - libatomic_ops/commitdiff
2008-01-03 Hans Boehm <Hans.Boehm@hp.com>
authorhboehm <hboehm>
Fri, 4 Jan 2008 00:45:32 +0000 (00:45 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 25 Jul 2011 12:03:24 +0000 (16:03 +0400)
(Merge from separate atomic_ops tree)
* src/atomic_ops/sysdeps/gcc/x86.h: Define correct macro for
double-width cas, and fix its implementation.
* doc/README.txt: Clarify use of _full.  Add more warnings about
data dependencies.

ChangeLog
doc/README.txt
src/atomic_ops/sysdeps/gcc/x86.h

index aa079ec3a108e5e044a1d87bd55de8049e040218..ce3afe9950843b0cedc3110e03c4c4ba6672bc12 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-03 Hans Boehm <Hans.Boehm@hp.com>
+       (Merge from separate atomic_ops tree)
+       * src/atomic_ops/sysdeps/gcc/x86.h: Define correct macro for
+       double-width cas, and fix its implementation.
+       * doc/README.txt: Clarify use of _full.  Add more warnings about
+       data dependencies.
+
 2008-01-02 Hans Boehm <Hans.Boehm@hp.com>
        * src/atomic_ops/sysdeps/gcc/powerpc.h (AO_load_acquire): Add
        %X1 modifier to support indexed addressing.
index fa8f07edbf5d75440eac065997a4317c57208f28..e7c2f0d1c5bd4900d727b31dc4c5e8961d6f6d0b 100644 (file)
@@ -154,6 +154,8 @@ _read: Subsequent reads must become visible after reads included in
 _write: Earlier writes become visible before writes during or after
         the atomic operation.  Rarely useful for clients?
 _full: Ordered with respect to both earlier and later memops.
+       AO_store_full or AO_nop_full are the normal ways to force a store
+       to be ordered with respect to a later load.
 _release_write: Ordered with respect to earlier writes.  This is
                normally implemented as either a _write or _release
                barrier.
@@ -163,7 +165,11 @@ _dd_acquire_read: Ordered with respect to later reads that are data
               second value, with the expectation that the second
               read is ordered after the first one.  On most architectures,
               this is equivalent to no barrier.  (This is very
-              hard to define precisely.  It should probably be avoided.)
+              hard to define precisely.  It should probably be avoided.
+              A major problem is that optimizers tend to try to
+              eliminate dependencies from the generated code, since
+              dependencies force the hardware to execute the code
+              serially.)
 _release_read: Ordered with respect to earlier reads.  Useful for
               implementing read locks.  Can be implemented as _release,
               but not as _read, since _read groups the current operation
index 27e047e580231adfb5666b89f66b2109c1bafd16..0b344a7ed48da05668bb77050eb95e67f43030ec 100644 (file)
@@ -141,13 +141,17 @@ AO_compare_double_and_swap_double_full(volatile AO_double_t *addr,
                                       AO_t new_val1, AO_t new_val2) 
 {
   char result;
+  register AO_t nv1 asm("%ebx") = new_val1;
+       /* The above hack seems to avoid a gcc error complaining        */
+       /* that ebx is unavailable.                                     */
+
   __asm__ __volatile__("lock; cmpxchg8b %0; setz %1"
                       : "=m"(*addr), "=q"(result)
-                      : "m"(*addr), "d" (old_val1), "a" (old_val2),
-                        "c" (new_val1), "b" (new_val2) : "memory");
+                      : "m"(*addr), "a" (old_val1), "d" (old_val2),
+                        "b" (nv1), "c" (new_val2) : "memory");
   return (int) result;
 }
 
-#define AO_HAVE_double_compare_and_swap_full
+#define AO_HAVE_compare_double_and_swap_double_full
 
 #include "../ao_t_is_int.h"