[ARM] Emit clrex in the expanded cmpxchg fail block.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Tue, 22 Sep 2015 17:22:58 +0000 (17:22 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Tue, 22 Sep 2015 17:22:58 +0000 (17:22 +0000)
commit16a661561f56335ea1b0260fb33322ac92dbcf01
tree9cba242fb5ed00d3b55d416b122eb67da9c42b16
parentee629d83953a0a66d95ae3ed1cc88f2cb0e0d163
[ARM] Emit clrex in the expanded cmpxchg fail block.

ARM counterpart to r248291:

In the comparison failure block of a cmpxchg expansion, the initial
ldrex/ldxr will not be followed by a matching strex/stxr.
On ARM/AArch64, this unnecessarily ties up the execution monitor,
which might have a negative performance impact on some uarchs.

Instead, release the monitor in the failure block.
The clrex instruction was designed for this: use it.

Also see ARMARM v8-A B2.10.2:
"Exclusive access instructions and Shareable memory locations".

Differential Revision: http://reviews.llvm.org/D13033

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248294 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMISelLowering.h
test/CodeGen/ARM/atomic-cmp.ll
test/CodeGen/ARM/atomic-cmpxchg.ll
test/CodeGen/ARM/atomic-op.ll
test/CodeGen/ARM/atomic-ops-v8.ll
test/CodeGen/ARM/cmpxchg-weak.ll
test/Transforms/AtomicExpand/ARM/atomic-expansion-v7.ll
test/Transforms/AtomicExpand/ARM/atomic-expansion-v8.ll
test/Transforms/AtomicExpand/ARM/cmpxchg-weak.ll