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)
commit984ee6544580453320597d496f2a67adec8d1e93
treef453f399972a362f1a91ffecd2357eff2cbcd39f
parent46b3076cd0b1e57e16cfe4ecaa517eb78863a92a
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210523 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
test/CodeGen/X86/cmpxchg-i1.ll [new file with mode: 0644]