Add a peephole to fuse cmpxchg w/ later cmp+branch.
The cmpxchg instruction already sets ZF for comparing the return value
vs the expected value. So there is no need to compare eq again.
Lots of pexes-in-the-wild have this pattern. Some compare against
a constant, some compare against a variable.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3882
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/413903002
diff --git a/crosstest/test_sync_atomic.h b/crosstest/test_sync_atomic.h
index a88cd73..ce24a07 100644
--- a/crosstest/test_sync_atomic.h
+++ b/crosstest/test_sync_atomic.h
@@ -22,8 +22,9 @@
FOR_ALL_RMWOP_TYPES(X)
#undef X
-#define X(type) \
- type test_val_cmp_swap(volatile type *ptr, type oldval, type newval);
+#define X(type) \
+ type test_val_cmp_swap(volatile type *ptr, type oldval, type newval); \
+ type test_val_cmp_swap_loop(volatile type *ptr, type oldval, type newval);
ATOMIC_TYPE_TABLE
#undef X