This is an archive of the discontinued LLVM Phabricator instance.

[AArch64/ARM] Emit clrex in the ll/sc-expanded cmpxchg no-store path.
ClosedPublic

Authored by ab on Sep 21 2015, 2:52 PM.

Details

Summary

In the comparison failure path 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".

Diff Detail

Repository
rL LLVM

Event Timeline

ab updated this revision to Diff 35311.Sep 21 2015, 2:52 PM
ab retitled this revision from to [AArch64/ARM] Emit clrex in the ll/sc-expanded cmpxchg no-store path..
ab updated this object.
ab added reviewers: t.p.northover, jmolloy.
ab added a subscriber: llvm-commits.
t.p.northover accepted this revision.Sep 22 2015, 9:06 AM
t.p.northover edited edge metadata.

Thanks Ahmed, this looks fine to me!

Tim.

This revision is now accepted and ready to land.Sep 22 2015, 9:06 AM
This revision was automatically updated to reflect the committed changes.