When AtomicOrdering is release or stronger, use
amswap_db.[w/d] $zero, $a1, $a0
instead of
dbar 0 st.[w/d] $a0, $a1, 0
Thanks to @xry111 for the suggestion: https://reviews.llvm.org/D128901#3626635
Paths
| Differential D129838
[LoongArch] Optimize the atomic store with amswap_db.[w/d] ClosedPublic Authored by gonglingqin on Jul 15 2022, 12:23 AM.
Details Summary When AtomicOrdering is release or stronger, use amswap_db.[w/d] $zero, $a1, $a0 instead of dbar 0 st.[w/d] $a0, $a1, 0 Thanks to @xry111 for the suggestion: https://reviews.llvm.org/D128901#3626635
Diff Detail
Event Timeline
Comment Actions I'm not sure about the changes (they are a little bit too much and I must admit I'm relatively weak at memory models) but the test case changes are good. I'd leave the LGTM to someone else for now...
This revision is now accepted and ready to land.Aug 21 2022, 8:00 PM Closed by commit rGe9a4b8e39783: [LoongArch] Optimize the atomic store with amswap_db.[w/d] (authored by gonglingqin). · Explain WhyAug 23 2022, 2:14 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 454750 llvm/lib/Target/LoongArch/LoongArchISelLowering.h
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
llvm/test/CodeGen/LoongArch/ir-instruction/load-store-atomic.ll
llvm/test/Transforms/AtomicExpand/LoongArch/load-store-atomic.ll
|
No need to use else after return.