diff options
author | Derek Schuff <dschuff@google.com> | 2017-08-30 18:07:45 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2017-08-30 18:07:45 +0000 |
commit | 18ba1928436d719fd4a93dbdd0113c7698f9c2e7 (patch) | |
tree | 12613f2a368804b6751a12b58fe0281345122140 /llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td | |
parent | 05782218abd549e0c1bc77032fa9b55526371cfd (diff) | |
download | bcm5719-llvm-18ba1928436d719fd4a93dbdd0113c7698f9c2e7.tar.gz bcm5719-llvm-18ba1928436d719fd4a93dbdd0113c7698f9c2e7.zip |
[WebAssembly] Add target feature for atomics
Summary:
This tracks the WebAssembly threads feature proposal at
https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md
Differential Revision: https://reviews.llvm.org/D37300
llvm-svn: 312145
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td index 64415658ed8..fd50f59c44b 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td @@ -12,19 +12,23 @@ /// //===----------------------------------------------------------------------===// -// TODO: Implement atomic instructions. - -//===----------------------------------------------------------------------===// -// Atomic fences -//===----------------------------------------------------------------------===// - -// TODO: add atomic fences here... - //===----------------------------------------------------------------------===// // Atomic loads //===----------------------------------------------------------------------===// -// TODO: add atomic loads here... +let Defs = [ARGUMENTS] in { +// TODO: add the rest of the atomic loads +// TODO: factor out 0xfe atomic prefix? +def ATOMIC_LOAD_I32 : ATOMIC_I<(outs I32:$dst), + (ins P2Align:$p2align, offset32_op:$off, I32:$addr), + [], "i32.atomic.load\t$dst, ${off}(${addr})${p2align}", + 0xfe10>; +} // Defs = [ARGUMENTS] + +// Select loads with no constant offset. +let Predicates = [HasAtomics] in { +def : Pat<(i32 (atomic_load I32:$addr)), (ATOMIC_LOAD_I32 0, 0, $addr)>; +} //===----------------------------------------------------------------------===// // Atomic stores @@ -45,3 +49,4 @@ // Store-release-exclusives. // And clear exclusive. + |