summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2019-02-13 22:25:18 +0000
committerThomas Lively <tlively@google.com>2019-02-13 22:25:18 +0000
commitbba3f06d05e33ff113e17f85c34aa87c94d619e7 (patch)
tree69aa8dcb991760a392020c71da2cef5be936992c /llvm/test
parent436fb2bd82a7816798b4f0c128b3be6760e49bbe (diff)
downloadbcm5719-llvm-bba3f06d05e33ff113e17f85c34aa87c94d619e7.tar.gz
bcm5719-llvm-bba3f06d05e33ff113e17f85c34aa87c94d619e7.zip
[WebAssembly] memory.fill
Summary: memset lowering, fix argument types in memcpy lowering, and test encodings. Depends on D57736. Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57791 llvm-svn: 353986
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/WebAssembly/bulk-memory.ll45
-rw-r--r--llvm/test/MC/WebAssembly/bulk-memory-encodings.s18
2 files changed, 63 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/bulk-memory.ll b/llvm/test/CodeGen/WebAssembly/bulk-memory.ll
index 68ce3e40fa3..b7b34bdfdcd 100644
--- a/llvm/test/CodeGen/WebAssembly/bulk-memory.ll
+++ b/llvm/test/CodeGen/WebAssembly/bulk-memory.ll
@@ -14,6 +14,10 @@ declare void @llvm.memmove.p0i8.p0i8.i8(i8*, i8*, i8, i1)
declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i1)
declare void @llvm.memmove.p0i32.p0i32.i32(i32*, i32*, i32, i1)
+declare void @llvm.memset.p0i8.i8(i8*, i8, i8, i1)
+declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i1)
+declare void @llvm.memset.p0i32.i32(i32*, i8, i32, i1)
+
; CHECK-LABEL: memcpy_i8:
; NO-BULK-MEM-NOT: memory.copy
; BULK-MEM-NEXT: .functype memcpy_i8 (i32, i32, i32) -> ()
@@ -34,6 +38,16 @@ define void @memmove_i8(i8* %dest, i8* %src, i8 zeroext %len) {
ret void
}
+; CHECK-LABEL: memset_i8:
+; NO-BULK-MEM-NOT: memory.fill
+; BULK-MEM-NEXT: .functype memset_i8 (i32, i32, i32) -> ()
+; BULK-MEM-NEXT: memory.fill 0, $0, $1, $2
+; BULK-MEM-NEXT: return
+define void @memset_i8(i8* %dest, i8 %val, i8 zeroext %len) {
+ call void @llvm.memset.p0i8.i8(i8* %dest, i8 %val, i8 %len, i1 0)
+ ret void
+}
+
; CHECK-LABEL: memcpy_i32:
; NO-BULK-MEM-NOT: memory.copy
; BULK-MEM-NEXT: .functype memcpy_i32 (i32, i32, i32) -> ()
@@ -54,6 +68,16 @@ define void @memmove_i32(i32* %dest, i32* %src, i32 %len) {
ret void
}
+; CHECK-LABEL: memset_i32:
+; NO-BULK-MEM-NOT: memory.fill
+; BULK-MEM-NEXT: .functype memset_i32 (i32, i32, i32) -> ()
+; BULK-MEM-NEXT: memory.fill 0, $0, $1, $2
+; BULK-MEM-NEXT: return
+define void @memset_i32(i32* %dest, i8 %val, i32 %len) {
+ call void @llvm.memset.p0i32.i32(i32* %dest, i8 %val, i32 %len, i1 0)
+ ret void
+}
+
; CHECK-LABEL: memcpy_1:
; CHECK-NEXT: .functype memcpy_1 (i32, i32) -> ()
; CHECK-NEXT: i32.load8_u $push[[L0:[0-9]+]]=, 0($1)
@@ -74,6 +98,16 @@ define void @memmove_1(i8* %dest, i8* %src) {
ret void
}
+; CHECK-LABEL: memset_1:
+; NO-BULK-MEM-NOT: memory.fill
+; BULK-MEM-NEXT: .functype memset_1 (i32, i32) -> ()
+; BULK-MEM-NEXT: i32.store8 0($0), $1
+; BULK-MEM-NEXT: return
+define void @memset_1(i8* %dest, i8 %val) {
+ call void @llvm.memset.p0i8.i32(i8* %dest, i8 %val, i32 1, i1 0)
+ ret void
+}
+
; CHECK-LABEL: memcpy_1024:
; NO-BULK-MEM-NOT: memory.copy
; BULK-MEM-NEXT: .functype memcpy_1024 (i32, i32) -> ()
@@ -95,3 +129,14 @@ define void @memmove_1024(i8* %dest, i8* %src) {
call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1024, i1 0)
ret void
}
+
+; CHECK-LABEL: memset_1024:
+; NO-BULK-MEM-NOT: memory.fill
+; BULK-MEM-NEXT: .functype memset_1024 (i32, i32) -> ()
+; BULK-MEM-NEXT: i32.const $push[[L0:[0-9]+]]=, 1024
+; BULK-MEM-NEXT: memory.fill 0, $0, $1, $pop[[L0]]
+; BULK-MEM-NEXT: return
+define void @memset_1024(i8* %dest, i8 %val) {
+ call void @llvm.memset.p0i8.i32(i8* %dest, i8 %val, i32 1024, i1 0)
+ ret void
+}
diff --git a/llvm/test/MC/WebAssembly/bulk-memory-encodings.s b/llvm/test/MC/WebAssembly/bulk-memory-encodings.s
new file mode 100644
index 00000000000..7047d6428af
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/bulk-memory-encodings.s
@@ -0,0 +1,18 @@
+# RUN: llvm-mc -show-encoding -triple=wasm32-unkown-unknown -mattr=+bulk-memory < %s | FileCheck %s
+
+main:
+ .functype main () -> ()
+
+ # CHECK: memory.init 3, 0 # encoding: [0xfc,0x08,0x03,0x00]
+ memory.init 3, 0
+
+ # CHECK: data.drop 3 # encoding: [0xfc,0x09,0x03]
+ data.drop 3
+
+ # CHECK: memory.copy 0, 0 # encoding: [0xfc,0x0a,0x00,0x00]
+ memory.copy 0, 0
+
+ # CHECK: memory.fill 0 # encoding: [0xfc,0x0b,0x00]
+ memory.fill 0
+
+ end_function
OpenPOWER on IntegriCloud