llvm-project
llvm-project copied to clipboard
[AArch64] cmpxchg not using Armv8.1-a instructions at -O0
| Bugzilla Link | 35072 |
| Resolution | FIXED |
| Resolved on | May 27, 2021 11:52 |
| Version | trunk |
| OS | All |
| Attachments | reproducer |
| CC | @Arnaud-de-Grandmaison-ARM,@efriedma-quic,@fhahn,@smithp35 |
Extended Description
The Armv8.1-a target has a compare-and-swap (CAS) instruction which is used to implement cmpxchg operation of LLVM IR. However, at -O0 the code generator is still emitting a long code sequence to emulate this instruction.
LLVM should use CAS even at -O0.
A reproducer that show the behaviour is attached. Compile using: llc -mattr=+v8.1a cmpxchg.ll -O[0|2]
We correctly produce cas on trunk.