[PATCH] D19800: [PR27599] [SystemZ] [SelectionDAG] Fix extension of atomic cmpxchg result.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 07:42:17 PDT 2016


dsanders accepted this revision.
dsanders added a reviewer: dsanders.
dsanders added a comment.
This revision is now accepted and ready to land.

LGTM with the tests changes.


================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2871
@@ -2857,3 +2870,3 @@
 
-    Results.push_back(LHS.getValue(0));
+    Results.push_back(ExtRes.getValue(0));
     Results.push_back(Success);
----------------
That makes sense to me. ATOMIC_CMP_SWAP_WITH_SUCCESS is always a strong operation so it's not strange to ignore the success result.

================
Comment at: test/CodeGen/SystemZ/cmpxchg-05.ll:5-11
@@ +4,9 @@
+
+; CHECK-LABEL: f1
+; CHECK: llgcr %r2, [[RES:%r[0-9]+]]
+define zeroext i8 @f1(i8* nocapture, i8 zeroext, i8 zeroext) {
+  %cx = cmpxchg i8* %0, i8 %1, i8 %2 seq_cst seq_cst
+  %res = extractvalue { i8, i1 } %cx, 0
+  ret i8 %res
+}
+
----------------
This should check that the zero extend and comparison is not emitted in this test (and likewise below).

I think there should also be a test that doesn't ignore the success result to check the comparison is as expected and also one that zero extends the success result to check that multiple zero extends don't occur.


Repository:
  rL LLVM

http://reviews.llvm.org/D19800





More information about the llvm-commits mailing list