]> granicus.if.org Git - libatomic_ops/commitdiff
Define double-wide ordered loads/stores for x86
authorIvan Maidanski <ivmai@mail.ru>
Mon, 7 Jan 2013 16:17:49 +0000 (20:17 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 7 Jan 2013 16:17:49 +0000 (20:17 +0400)
* src/Makefile.am (atomic_ops/sysdeps/loadstore/ordered_loads_only.h,
atomic_ops/sysdeps/loadstore/ordered_stores_only.h): Generate
primitives for AO_double_t as well (from the template).
* src/atomic_ops/sysdeps/gcc/x86.h: Move include of ordered_except_wr.h
(together with the comment) to the end of the file to be after
inclusion of double_atomic_load_store.h (because the former uses the
primitives defined the latter).
* src/atomic_ops/sysdeps/msftc/x86.h: Likewise.
* src/atomic_ops/sysdeps/sunc/x86.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h: Regenerate.
* src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h: Likewise.

src/Makefile.am
src/atomic_ops/sysdeps/gcc/x86.h
src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h
src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h
src/atomic_ops/sysdeps/msftc/x86.h
src/atomic_ops/sysdeps/sunc/x86.h

index eaa580c60f518b80dd215605d8278605db8332ce..f4a66bc9d95f0024e66d831d793ccd60dffcc947 100644 (file)
@@ -107,6 +107,7 @@ atomic_ops/sysdeps/loadstore/ordered_loads_only.h: \
        sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? >> $@
        sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? >> $@
        sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g $? >> $@
+       sed -e s:XSIZE:double:g -e s:XCTYPE:AO_double_t:g $? >> $@
 
 atomic_ops/sysdeps/loadstore/ordered_stores_only.h: \
         atomic_ops/sysdeps/loadstore/ordered_stores_only.template
@@ -114,6 +115,7 @@ atomic_ops/sysdeps/loadstore/ordered_stores_only.h: \
        sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? >> $@
        sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? >> $@
        sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g $? >> $@
+       sed -e s:XSIZE:double:g -e s:XCTYPE:AO_double_t:g $? >> $@
 
 atomic_ops/sysdeps/loadstore/acquire_release_volatile.h: \
         atomic_ops/sysdeps/loadstore/acquire_release_volatile.template
index 6f9953dac8628fe1657f5c89d5fdff8d413e046e..60bdfb3c18ebb8d57c1108a304b99e79c63ba9c8 100644 (file)
 
 #include "../all_aligned_atomic_load_store.h"
 
-/* Real X86 implementations, except for some old 32-bit WinChips,       */
-/* appear to enforce ordering between memory operations, EXCEPT that    */
-/* a later read can pass earlier writes, presumably due to the visible  */
-/* presence of store buffers.                                           */
-/* We ignore both the WinChips and the fact that the official specs     */
-/* seem to be much weaker (and arguably too weak to be usable).         */
-
-#include "../ordered_except_wr.h"
-
 #include "../test_and_set_t_is_char.h"
 
 #if defined(__x86_64__) && !defined(AO_USE_PENTIUM4_INSTRS)
@@ -341,3 +332,11 @@ AO_fetch_compare_and_swap_full(volatile AO_t *addr, AO_t old_val,
 # endif /* AO_WEAK_DOUBLE_CAS_EMULATION && !AO_CMPXCHG16B_AVAILABLE */
 
 #endif /* x86_64 && !ILP32 */
+
+/* Real X86 implementations, except for some old 32-bit WinChips,       */
+/* appear to enforce ordering between memory operations, EXCEPT that    */
+/* a later read can pass earlier writes, presumably due to the visible  */
+/* presence of store buffers.                                           */
+/* We ignore both the WinChips and the fact that the official specs     */
+/* seem to be much weaker (and arguably too weak to be usable).         */
+#include "../ordered_except_wr.h"
index ae8baa98b38742283f2a93ae227e477640bbf619..785219499b1b6d6490c7550f86113a40c01a26e2 100644 (file)
 # define AO_load_acquire(addr) AO_load_read(addr)
 # define AO_HAVE_load_acquire
 #endif /* AO_HAVE_load */
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef AO_HAVE_double_load
+  AO_INLINE AO_double_t
+  AO_double_load_read(const volatile AO_double_t *addr)
+  {
+    AO_double_t result = AO_double_load(addr);
+
+    AO_compiler_barrier();
+    return result;
+  }
+# define AO_HAVE_double_load_read
+
+# define AO_double_load_acquire(addr) AO_double_load_read(addr)
+# define AO_HAVE_double_load_acquire
+#endif /* AO_HAVE_double_load */
index 1fe145b22825f3ac406567c153cf47baea00ccc3..df1986e4e469a90ec452a11e8bd7e3c56f8efdb7 100644 (file)
 # define AO_store_release(addr, val) AO_store_write(addr, val)
 # define AO_HAVE_store_release
 #endif /* AO_HAVE_store */
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#if defined(AO_HAVE_double_store)
+  AO_INLINE void
+  AO_double_store_write(volatile AO_double_t *addr, AO_double_t val)
+  {
+    AO_compiler_barrier();
+    AO_double_store(addr, val);
+  }
+# define AO_HAVE_double_store_write
+
+# define AO_double_store_release(addr, val) AO_double_store_write(addr, val)
+# define AO_HAVE_double_store_release
+#endif /* AO_HAVE_double_store */
index 3d31c322d82dd017445e9ba0f4f637ecbf481565..7c2995a4e38e55bc8753d91f8a997b0e998e8a4f 100644 (file)
 
 #include "../all_aligned_atomic_load_store.h"
 
-/* Real X86 implementations, except for some old WinChips, appear       */
-/* to enforce ordering between memory operations, EXCEPT that a later   */
-/* read can pass earlier writes, presumably due to the visible          */
-/* presence of store buffers.                                           */
-/* We ignore both the WinChips, and the fact that the official specs    */
-/* seem to be much weaker (and arguably too weak to be usable).         */
-
-#include "../ordered_except_wr.h"
-
 #include "../test_and_set_t_is_char.h"
 
 #if defined(AO_ASSUME_VISTA) && !defined(AO_ASSUME_WINDOWS98)
@@ -142,3 +133,11 @@ AO_test_and_set_full(volatile AO_TS_t *addr)
 #endif /* AO_ASSUME_VISTA */
 
 #define AO_T_IS_INT
+
+/* Real X86 implementations, except for some old WinChips, appear       */
+/* to enforce ordering between memory operations, EXCEPT that a later   */
+/* read can pass earlier writes, presumably due to the visible          */
+/* presence of store buffers.                                           */
+/* We ignore both the WinChips, and the fact that the official specs    */
+/* seem to be much weaker (and arguably too weak to be usable).         */
+#include "../ordered_except_wr.h"
index a7468bb403e7ff8ef28bff15d374d4753b5309eb..006d53e8c26a6d9990d10816f932b88c8b8d48fd 100644 (file)
 
 #include "../all_aligned_atomic_load_store.h"
 
-/* Real X86 implementations, except for some old 32-bit WinChips,       */
-/* appear to enforce ordering between memory operations, EXCEPT that    */
-/* a later read can pass earlier writes, presumably due to the visible  */
-/* presence of store buffers.                                           */
-/* We ignore both the WinChips and the fact that the official specs     */
-/* seem to be much weaker (and arguably too weak to be usable).         */
-
-#include "../ordered_except_wr.h"
-
 #include "../test_and_set_t_is_char.h"
 
 #if !defined(AO_USE_PENTIUM4_INSTRS) && !defined(__i386)
@@ -231,3 +222,11 @@ AO_fetch_compare_and_swap_full(volatile AO_t *addr, AO_t old_val,
 # endif /* !AO_CMPXCHG16B_AVAILABLE */
 
 #endif /* x64 */
+
+/* Real X86 implementations, except for some old 32-bit WinChips,       */
+/* appear to enforce ordering between memory operations, EXCEPT that    */
+/* a later read can pass earlier writes, presumably due to the visible  */
+/* presence of store buffers.                                           */
+/* We ignore both the WinChips and the fact that the official specs     */
+/* seem to be much weaker (and arguably too weak to be usable).         */
+#include "../ordered_except_wr.h"