summaryrefslogtreecommitdiff
path: root/test/interp/atomic-rmw-and.txt
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-09-20 09:49:58 -0700
committerGitHub <noreply@github.com>2017-09-20 09:49:58 -0700
commit447e6f752b157d0a9951525a045d862e62d9b88c (patch)
tree2484ab5841f35fa50127f6dd83460f943a202fb6 /test/interp/atomic-rmw-and.txt
parentc71918746e06d2afffc46b3da5e3f2c024cc4b92 (diff)
downloadwabt-447e6f752b157d0a9951525a045d862e62d9b88c.tar.gz
wabt-447e6f752b157d0a9951525a045d862e62d9b88c.tar.bz2
wabt-447e6f752b157d0a9951525a045d862e62d9b88c.zip
Add Atomic instructions (#633)
This adds support for all atomic instructions, enabled via the `--enable-threads` flag. It supports all tools: parsing text, decoding binary, validation, and interpreting. It does not currently ensure that the memory is marked as shared; that flag is not supported in wabt yet.
Diffstat (limited to 'test/interp/atomic-rmw-and.txt')
-rw-r--r--test/interp/atomic-rmw-and.txt110
1 files changed, 110 insertions, 0 deletions
diff --git a/test/interp/atomic-rmw-and.txt b/test/interp/atomic-rmw-and.txt
new file mode 100644
index 00000000..6dee152d
--- /dev/null
+++ b/test/interp/atomic-rmw-and.txt
@@ -0,0 +1,110 @@
+;;; TOOL: run-interp
+;;; FLAGS: --enable-threads
+(module
+ (memory 1)
+
+ ;; i32
+
+ (func (export "i32.atomic.rmw8_u.and-result") (result i32)
+ i32.const 0 i32.const 1000000 i32.store
+ i32.const 0 i32.const 64 i32.atomic.rmw8_u.and)
+
+ (func (export "i32.atomic.rmw8_u.and-memory") (result i32)
+ i32.const 0 i32.const 1000000 i32.store
+ i32.const 0 i32.const 64 i32.atomic.rmw8_u.and drop
+ i32.const 0 i32.load8_u)
+
+ (func (export "i32.atomic.rmw16_u.and-result") (result i32)
+ i32.const 0 i32.const 1000000 i32.store
+ i32.const 0 i32.const 64 i32.atomic.rmw16_u.and)
+
+ (func (export "i32.atomic.rmw16_u.and-memory") (result i32)
+ i32.const 0 i32.const 1000000 i32.store
+ i32.const 0 i32.const 64 i32.atomic.rmw16_u.and drop
+ i32.const 0 i32.load16_u)
+
+ (func (export "i32.atomic.rmw.and-result") (result i32)
+ i32.const 0 i32.const 1000000 i32.store
+ i32.const 0 i32.const 64 i32.atomic.rmw.and)
+
+ (func (export "i32.atomic.rmw.and-memory") (result i32)
+ i32.const 0 i32.const 1000000 i32.store
+ i32.const 0 i32.const 64 i32.atomic.rmw.and drop
+ i32.const 0 i32.load)
+
+
+ ;; i64
+
+ (func (export "i64.atomic.rmw8_u.and-result") (result i64)
+ i32.const 0 i64.const 10000000000 i64.store
+ i32.const 0 i64.const 64 i64.atomic.rmw8_u.and)
+
+ (func (export "i64.atomic.rmw8_u.and-memory") (result i64)
+ i32.const 0 i64.const 10000000000 i64.store
+ i32.const 0 i64.const 64 i64.atomic.rmw8_u.and drop
+ i32.const 0 i64.load8_u)
+
+ (func (export "i64.atomic.rmw16_u.and-result") (result i64)
+ i32.const 0 i64.const 10000000000 i64.store
+ i32.const 0 i64.const 1024 i64.atomic.rmw16_u.and)
+
+ (func (export "i64.atomic.rmw16_u.and-memory") (result i64)
+ i32.const 0 i64.const 10000000000 i64.store
+ i32.const 0 i64.const 1024 i64.atomic.rmw16_u.and drop
+ i32.const 0 i64.load16_u)
+
+ (func (export "i64.atomic.rmw32_u.and-result") (result i64)
+ i32.const 0 i64.const 10000000000 i64.store
+ i32.const 0 i64.const 1024 i64.atomic.rmw32_u.and)
+
+ (func (export "i64.atomic.rmw32_u.and-memory") (result i64)
+ i32.const 0 i64.const 10000000000 i64.store
+ i32.const 0 i64.const 1024 i64.atomic.rmw32_u.and drop
+ i32.const 0 i64.load32_u)
+
+ (func (export "i64.atomic.rmw.and-result") (result i64)
+ i32.const 0 i64.const 10000000000 i64.store
+ i32.const 0 i64.const 1024 i64.atomic.rmw.and)
+
+ (func (export "i64.atomic.rmw.and-memory") (result i64)
+ i32.const 0 i64.const 10000000000 i64.store
+ i32.const 0 i64.const 1024 i64.atomic.rmw.and drop
+ i32.const 0 i64.load)
+
+
+ ;; Test bad alignment
+
+ (func (export "bad_align-i32.atomic.rmw16_u.and")
+ i32.const 1 i32.const 0 i32.atomic.rmw16_u.and drop)
+ (func (export "bad_align-i32.atomic.rmw.and")
+ i32.const 2 i32.const 0 i32.atomic.rmw.and drop)
+
+ (func (export "bad_align-i64.atomic.rmw16_u.and")
+ i32.const 1 i64.const 0 i64.atomic.rmw16_u.and drop)
+ (func (export "bad_align-i64.atomic.rmw32_u.and")
+ i32.const 2 i64.const 0 i64.atomic.rmw32_u.and drop)
+ (func (export "bad_align-i64.atomic.rmw.and")
+ i32.const 4 i64.const 0 i64.atomic.rmw.and drop)
+
+)
+(;; STDOUT ;;;
+i32.atomic.rmw8_u.and-result() => i32:64
+i32.atomic.rmw8_u.and-memory() => i32:64
+i32.atomic.rmw16_u.and-result() => i32:16960
+i32.atomic.rmw16_u.and-memory() => i32:64
+i32.atomic.rmw.and-result() => i32:1000000
+i32.atomic.rmw.and-memory() => i32:64
+i64.atomic.rmw8_u.and-result() => i64:0
+i64.atomic.rmw8_u.and-memory() => i64:0
+i64.atomic.rmw16_u.and-result() => i64:58368
+i64.atomic.rmw16_u.and-memory() => i64:1024
+i64.atomic.rmw32_u.and-result() => i64:1410065408
+i64.atomic.rmw32_u.and-memory() => i64:1024
+i64.atomic.rmw.and-result() => i64:10000000000
+i64.atomic.rmw.and-memory() => i64:1024
+bad_align-i32.atomic.rmw16_u.and() => error: atomic memory access is unaligned
+bad_align-i32.atomic.rmw.and() => error: atomic memory access is unaligned
+bad_align-i64.atomic.rmw16_u.and() => error: atomic memory access is unaligned
+bad_align-i64.atomic.rmw32_u.and() => error: atomic memory access is unaligned
+bad_align-i64.atomic.rmw.and() => error: atomic memory access is unaligned
+;;; STDOUT ;;)