[llvm-commits] [llvm-gcc-4.2] r117934 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Bob Wilson bob.wilson at apple.com
Mon Nov 1 10:37:23 PDT 2010


Author: bwilson
Date: Mon Nov  1 12:37:23 2010
New Revision: 117934

URL: http://llvm.org/viewvc/llvm-project?rev=117934&view=rev
Log:
Use a store-only memory barrier before atomic intrinsics for ARM/Darwin.
We need to make sure that all previous stores have completed before the
load-exclusive instruction, but preceding loads don't matter.  There is
still a full memory barrier after the store-exclusive instruction succeeds,
so from the user's perspective, the atomic builtins are still full memory
barriers.  Radar 8601999.

I don't know so much about synchronization on other targets besides ARM, and
since there was already a separate version of the barriers for ARM/Darwin,
I've only changed that version.  It seems like this change would apply to
other targets as well, but I don't know for sure.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=117934&r1=117933&r2=117934&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Nov  1 12:37:23 2010
@@ -5343,7 +5343,7 @@
   // The gcc builtins are also full memory barriers.
   // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
 #if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
-  EmitMemoryBarrier(true, true, true, true, false);
+  EmitMemoryBarrier(false, false, true, true, false);
 #else
   EmitMemoryBarrier(true, true, true, true, true);
 #endif
@@ -5386,7 +5386,7 @@
   // The gcc builtins are also full memory barriers.
   // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
 #if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
-  EmitMemoryBarrier(true, true, true, true, false);
+  EmitMemoryBarrier(false, false, true, true, false);
 #else
   EmitMemoryBarrier(true, true, true, true, true);
 #endif
@@ -5919,7 +5919,7 @@
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
 #if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
-    EmitMemoryBarrier(true, true, true, true, false);
+    EmitMemoryBarrier(false, false, true, true, false);
 #else
     EmitMemoryBarrier(true, true, true, true, true);
 #endif
@@ -5966,7 +5966,7 @@
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
 #if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
-    EmitMemoryBarrier(true, true, true, true, false);
+    EmitMemoryBarrier(false, false, true, true, false);
 #else
     EmitMemoryBarrier(true, true, true, true, true);
 #endif
@@ -6013,7 +6013,7 @@
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
 #if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
-    EmitMemoryBarrier(true, true, true, true, false);
+    EmitMemoryBarrier(false, false, true, true, false);
 #else
     EmitMemoryBarrier(true, true, true, true, true);
 #endif
@@ -6060,7 +6060,7 @@
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
 #if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
-    EmitMemoryBarrier(true, true, true, true, false);
+    EmitMemoryBarrier(false, false, true, true, false);
 #else
     EmitMemoryBarrier(true, true, true, true, true);
 #endif
@@ -6107,7 +6107,7 @@
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
 #if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
-    EmitMemoryBarrier(true, true, true, true, false);
+    EmitMemoryBarrier(false, false, true, true, false);
 #else
     EmitMemoryBarrier(true, true, true, true, true);
 #endif
@@ -6154,7 +6154,7 @@
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
 #if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
-    EmitMemoryBarrier(true, true, true, true, false);
+    EmitMemoryBarrier(false, false, true, true, false);
 #else
     EmitMemoryBarrier(true, true, true, true, true);
 #endif





More information about the llvm-commits mailing list