From 3e170f0a06a4cf975859badcc09eae042be23346 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 30 Aug 2017 18:07:45 +0000 Subject: [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 --- test/CodeGen/WebAssembly/atomics.ll | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/CodeGen/WebAssembly/atomics.ll (limited to 'test/CodeGen/WebAssembly') 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 +} -- cgit v1.2.3