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 | 3e170f0a06a4cf975859badcc09eae042be23346 (patch) | |
tree | e5256990b108ef1b17383d10ed50de749609b1ff /test/CodeGen/WebAssembly | |
parent | 69e607f200faf0384a737bd8db69f29e51e1b378 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/WebAssembly')
-rw-r--r-- | test/CodeGen/WebAssembly/atomics.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/WebAssembly/atomics.ll b/test/CodeGen/WebAssembly/atomics.ll new file mode 100644 index 00000000000..1845187f505 --- /dev/null +++ b/test/CodeGen/WebAssembly/atomics.ll @@ -0,0 +1,19 @@ +; RUN: not llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt +; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -mattr=+atomics | FileCheck %s + +; Test that atomic loads are assembled properly. + +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown-wasm" + +; CHECK-LABEL: load_i32_atomic: +; CHECK-NEXT: .param i32{{$}} +; CHECK-NEXT: .result i32{{$}} +; CHECK-NEXT: get_local $push[[L0:[0-9]+]]=, 0{{$}} +; CHECK-NEXT: i32.atomic.load $push[[NUM:[0-9]+]]=, 0($pop[[L0]]){{$}} +; CHECK-NEXT: return $pop[[NUM]]{{$}} + +define i32 @load_i32_atomic(i32 *%p) { + %v = load atomic i32, i32* %p seq_cst, align 4 + ret i32 %v +} |