[PATCH] Atomics: emit cmpxchg instructions with weaker failure-order

JF Bastien jfb at chromium.org
Wed Mar 12 09:40:46 PDT 2014



================
Comment at: lib/CodeGen/CGAtomic.cpp:281
@@ +280,3 @@
+    SI->addCase(CGF.Builder.getInt32(1), AcquireBB);
+    SI->addCase(CGF.Builder.getInt32(2), AcquireBB);
+  }
----------------
Wouldn't it be better to use AtomicOrderingKind here instead of the values? Same a few lines below, and around ~700.

================
Comment at: test/CodeGen/atomic-ops.c:346
@@ +345,3 @@
+  // CHECK-DAG: cmpxchg {{.*}} seq_cst acquire
+  // CHECK-DAG: cmpxchg {{.*}} seq_cst seq_cst
+}
----------------
Shouldn't you also check that the cases are correct here?

================
Comment at: lib/CodeGen/CGAtomic.cpp:269
@@ +268,3 @@
+
+  // Emit all the different atomics
+  CGF.Builder.SetInsertPoint(MonotonicBB);
----------------
I'd repeat the comment from below too:

  // MonotonicBB is arbitrarily chosen as the default case; in practice, this
  // doesn't matter unless someone is crazy enough to use something that
  // doesn't fold to a constant for the ordering.


http://llvm-reviews.chandlerc.com/D3053



More information about the cfe-commits mailing list