summaryrefslogtreecommitdiff
path: root/test/lit/validation
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2022-03-19 02:29:35 +0000
committerGitHub <noreply@github.com>2022-03-19 02:29:35 +0000
commitd2f54b40e736cdee2a0ff9fc15e9323ccb9d7c20 (patch)
tree3f6c5dafbf558d29e0bf72a33be973d55d6c10ef /test/lit/validation
parent88c2e4377df7dbe65bc8ef629ea409cd9df6a860 (diff)
downloadbinaryen-d2f54b40e736cdee2a0ff9fc15e9323ccb9d7c20.tar.gz
binaryen-d2f54b40e736cdee2a0ff9fc15e9323ccb9d7c20.tar.bz2
binaryen-d2f54b40e736cdee2a0ff9fc15e9323ccb9d7c20.zip
Add support for extended-const proposal (#4529)
See https://github.com/WebAssembly/extended-const
Diffstat (limited to 'test/lit/validation')
-rw-r--r--test/lit/validation/extended-const.wast24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/lit/validation/extended-const.wast b/test/lit/validation/extended-const.wast
new file mode 100644
index 000000000..4269ca2b7
--- /dev/null
+++ b/test/lit/validation/extended-const.wast
@@ -0,0 +1,24 @@
+;; Test that shared memory requires atomics
+
+;; RUN: not wasm-opt %s 2>&1 | filecheck %s --check-prefix NO-EXTENDED
+;; RUN: wasm-opt %s --enable-extended-const -o - -S | filecheck %s --check-prefix EXTENDED
+
+;; NO-EXTENDED: unexpected false: global init must be valid
+;; NO-EXTENDED: unexpected false: memory segment offset should be reasonable
+
+;; EXTENDED: (import "env" "global" (global $gimport$0 i32))
+;; EXTENDED: (global $1 i32 (i32.add
+;; EXTENDED: (global.get $gimport$0)
+;; EXTENDED: (i32.const 42)
+;; EXTENDED: ))
+;; EXTENDED: (data (i32.sub
+;; EXTENDED: (global.get $gimport$0)
+;; EXTENDED: (i32.const 10)
+;; EXTENDED: ) "hello world")
+
+(module
+ (memory 1 1)
+ (import "env" "global" (global i32))
+ (global i32 (i32.add (global.get 0) (i32.const 42)))
+ (data (i32.sub (global.get 0) (i32.const 10)) "hello world")
+)