[AArch64][RISCV] Make sure isel correctly honors failure orderings.
authorEli Friedman <efriedma@quicinc.com>
Thu, 27 May 2021 20:35:59 +0000 (13:35 -0700)
committerEli Friedman <efriedma@quicinc.com>
Fri, 28 May 2021 19:47:40 +0000 (12:47 -0700)
commit0b3b0a727ad6bac089a57e3625dd9dbf4e6f5bde
tree9af1809b4bf2370631ff5640f01ffcbfd98bac3d
parent1a0e5d561ceb0af7a9ad356b0663dabac09d110f
[AArch64][RISCV] Make sure isel correctly honors failure orderings.

If a cmpxchg specifies acquire or seq_cst on failure, make sure we
generate code consistent with that ordering even if the success ordering
is not acquire/seq_cst.

At one point, it was ambiguous whether this sort of construct was valid,
but the C++ standad and LLVM now accept arbitrary combinations of
success/failure orderings.

This doesn't address the corresponding issue in AtomicExpand. (This was
reported as https://bugs.llvm.org/show_bug.cgi?id=33332 .)

Fixes https://bugs.llvm.org/show_bug.cgi?id=50512.

Differential Revision: https://reviews.llvm.org/D103284
12 files changed:
llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
llvm/include/llvm/CodeGen/MachineMemOperand.h
llvm/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic-128.ll
llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll
llvm/test/CodeGen/AArch64/atomic-ops-lse.ll
llvm/test/CodeGen/RISCV/atomic-cmpxchg.ll
llvm/utils/TableGen/CodeGenDAGPatterns.cpp