Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RISCV] Strengthen atomic ordering for sequentially consistent stores
This is a similar change to one proposed for GCC: https://inbox.sourceware.org/gcc-patches/[email protected]/ The changes in this patch are based on the proposal by Hans Boehm to more closely match the intended semantics for sequentially consistent stores and to allow some platforms to avoid an ABI break when switching to more performant atomic instructions. Platforms that have already compiled code using the existing mappings will also have more time to gradually replace that code in preparation of the switch. Further details can be found in the psABI proposal: riscv-non-isa/riscv-elf-psabi-doc#378. This patch implements a mapping that is stronger than the one outlined in table A.6 of the RISC-V unprivileged spec to be future compatible with table A.7 of the same document. The related discussion can be found at https://lists.riscv.org/g/tech-unprivileged/topic/risc_v_memory_model_topics/92916241 The major change to RISC-V code generation is that we will now emit a trailing fence for sequentially consistent stores. The new code sequence should have the following form: ``` fence rw,w; s{b|h|w|d}; fence rw,rw; ``` Other changes and optimizations like using amoswap will be handled separately. Reviewed By: asb Differential Revision: https://reviews.llvm.org/D149486
- Loading branch information