Basically two parts to this fix:
- Stop using AtomicExpand to expand cmpxchg i128
- Fix AArch64ExpandPseudoInsts to use a correct expansion. In particular, we can't exit the loop until an stxp succeeds; otherwise, the load can tear.
Paths
| Differential D106039
[AArch64] Fix i128 cmpxchg using ldxp/stxp. ClosedPublic Authored by efriedma on Jul 14 2021, 11:25 PM.
Details Summary Basically two parts to this fix:
Diff Detail
Event TimelineHerald added subscribers: danielkiss, jfb, hiraditya, kristof.beyls. · View Herald TranscriptJul 14 2021, 11:25 PM Comment Actions This made my brain melt a little... anyway, from Section B 2.2.1 of Arm ARM: When the Store-Exclusive of a Load-Exclusive/Store-Exclusive pair instruction To atomically load two 64-bit quantities, perform a Load-Exclusive And it looks like this is what we are doing. Ordering changes also LGTM. This revision is now accepted and ready to land.Jul 20 2021, 3:19 AM This revision was landed with ongoing or failed builds.Jul 20 2021, 12:38 PM Closed by commit rG843c61405881: [AArch64] Fix i128 cmpxchg using ldxp/stxp. (authored by efriedma). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 360237 llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64InstrAtomics.td
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic-128.ll
llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmpxchg-128.mir
llvm/test/CodeGen/AArch64/arm64-atomic-128.ll
llvm/test/CodeGen/AArch64/atomicrmw-O0.ll
|
This was unused. I deleted it in 2b79a4eeb101bc9662427353187e35b9bc9da116 to pacify -Wunused-but-set-variable