X86: elide comparisons after cmpxchg instructions.
authorTim Northover <tnorthover@apple.com>
Tue, 10 Jun 2014 10:49:07 +0000 (10:49 +0000)
committerTim Northover <tnorthover@apple.com>
Tue, 10 Jun 2014 10:49:07 +0000 (10:49 +0000)
commit84ad29ca1fdb6a0ec357065e05bffcfd135ed410
treea246c09989a79b17f794fce2020326dbec12368e
parent908180574e6d09eba543b77e76b01c06865c78ff
X86: elide comparisons after cmpxchg instructions.

The C++ and C semantics of the compare_and_swap operations actually
require us to return a boolean "success" value. In LLVM terms this
means a second comparison of the output of "cmpxchg" against the input
desired value.

However, x86's "cmpxchg" instruction sets all flags for the comparison
formed, so we can skip any secondary comparison. (N.b. this isn't true
for cmpxchg8b/16b, which only set ZF).

rdar://problem/13201607

llvm-svn: 210523
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/test/CodeGen/X86/cmpxchg-i1.ll [new file with mode: 0644]