diff options
| author | Alex Bradbury <asb@lowrisc.org> | 2018-06-13 11:58:46 +0000 |
|---|---|---|
| committer | Alex Bradbury <asb@lowrisc.org> | 2018-06-13 11:58:46 +0000 |
| commit | dc790dd5d0eda1a22388824bd518045bc57741c1 (patch) | |
| tree | 4ebf3a8737d7fc0c8ef162d98c7bbc2d8411a5ba /llvm/test/CodeGen/RISCV/atomic-fence.ll | |
| parent | 0f8df3e35ab3c7a763ea93699ad5572363441e6a (diff) | |
| download | bcm5719-llvm-dc790dd5d0eda1a22388824bd518045bc57741c1.tar.gz bcm5719-llvm-dc790dd5d0eda1a22388824bd518045bc57741c1.zip | |
[RISCV] Codegen support for atomic operations on RV32I
This patch adds lowering for atomic fences and relies on AtomicExpandPass to
lower atomic loads/stores, atomic rmw, and cmpxchg to __atomic_* libcalls.
test/CodeGen/RISCV/atomic-* are modelled on the exhaustive
test/CodeGen/PPC/atomics-regression.ll, and will prove more useful once RV32A
codegen support is introduced.
Fence mappings are taken from table A.6 in the current draft of version 2.3 of
the RISC-V Instruction Set Manual, which incorporates the memory model changes
and definitions contributed by the RISC-V Memory Consistency Model task group.
Differential Revision: https://reviews.llvm.org/D47587
llvm-svn: 334590
Diffstat (limited to 'llvm/test/CodeGen/RISCV/atomic-fence.ll')
| -rw-r--r-- | llvm/test/CodeGen/RISCV/atomic-fence.ll | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/RISCV/atomic-fence.ll b/llvm/test/CodeGen/RISCV/atomic-fence.ll new file mode 100644 index 00000000000..174977d98d6 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/atomic-fence.ll @@ -0,0 +1,41 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32I %s +; RUN: llc -mtriple=riscv32 -mattr=+a -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32I %s + +define void @fence_acquire() nounwind { +; RV32I-LABEL: fence_acquire: +; RV32I: # %bb.0: +; RV32I-NEXT: fence r, rw +; RV32I-NEXT: ret + fence acquire + ret void +} + +define void @fence_release() nounwind { +; RV32I-LABEL: fence_release: +; RV32I: # %bb.0: +; RV32I-NEXT: fence rw, w +; RV32I-NEXT: ret + fence release + ret void +} + +define void @fence_acq_rel() nounwind { +; RV32I-LABEL: fence_acq_rel: +; RV32I: # %bb.0: +; RV32I-NEXT: fence.tso +; RV32I-NEXT: ret + fence acq_rel + ret void +} + +define void @fence_seq_cst() nounwind { +; RV32I-LABEL: fence_seq_cst: +; RV32I: # %bb.0: +; RV32I-NEXT: fence rw, rw +; RV32I-NEXT: ret + fence seq_cst + ret void +} |

