summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2024-05-15 12:53:31 -0700
committerGitHub <noreply@github.com>2024-05-15 12:53:31 -0700
commit2b60f8a212c0e744d0dbf3346498b08c9a27a39e (patch)
treeee80a2e5a894c2af40972c269f2bb69089e9fdc0 /test
parent2cc5e06549a4019eeed7303bfab32b95c32507bc (diff)
downloadbinaryen-2b60f8a212c0e744d0dbf3346498b08c9a27a39e.tar.gz
binaryen-2b60f8a212c0e744d0dbf3346498b08c9a27a39e.tar.bz2
binaryen-2b60f8a212c0e744d0dbf3346498b08c9a27a39e.zip
Add table64 lowering pass (#6595)
Changes to wasm-validator.cpp here are mostly for consistency between elem and data segment validation.
Diffstat (limited to 'test')
-rw-r--r--test/lit/help/wasm-opt.test2
-rw-r--r--test/lit/help/wasm2js.test2
-rw-r--r--test/lit/passes/table64-lowering-features.wast64
-rw-r--r--test/lit/validation/extended-const.wast4
4 files changed, 70 insertions, 2 deletions
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test
index 6dafe2c62..fd8bc5b1e 100644
--- a/test/lit/help/wasm-opt.test
+++ b/test/lit/help/wasm-opt.test
@@ -505,6 +505,8 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --symbolmap (alias for print-function-map)
;; CHECK-NEXT:
+;; CHECK-NEXT: --table64-lowering lower 64-bit tables 32-bit ones
+;; CHECK-NEXT:
;; CHECK-NEXT: --translate-to-exnref translate old Phase 3 EH
;; CHECK-NEXT: instructions to new ones with
;; CHECK-NEXT: exnref
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test
index 63d43d388..d8768f35e 100644
--- a/test/lit/help/wasm2js.test
+++ b/test/lit/help/wasm2js.test
@@ -452,6 +452,8 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --symbolmap (alias for print-function-map)
;; CHECK-NEXT:
+;; CHECK-NEXT: --table64-lowering lower 64-bit tables 32-bit ones
+;; CHECK-NEXT:
;; CHECK-NEXT: --translate-to-exnref translate old Phase 3 EH
;; CHECK-NEXT: instructions to new ones with
;; CHECK-NEXT: exnref
diff --git a/test/lit/passes/table64-lowering-features.wast b/test/lit/passes/table64-lowering-features.wast
new file mode 100644
index 000000000..eb06231ad
--- /dev/null
+++ b/test/lit/passes/table64-lowering-features.wast
@@ -0,0 +1,64 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: wasm-opt %s --enable-memory64 --enable-reference-types --enable-bulk-memory --table64-lowering -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (type $0 (func))
+
+ ;; CHECK: (type $1 (func (result i64)))
+
+ ;; CHECK: (table $t 10 100 funcref)
+ (table $t i64 10 100 funcref)
+
+ ;; CHECK: (elem $elem (table $t) (i32.const 0) funcref (ref.null nofunc))
+ (elem $elem (table $t) (i64.const 0) funcref (ref.null func))
+
+ ;; CHECK: (func $test_call_indirect
+ ;; CHECK-NEXT: (call_indirect $t (type $0)
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $test_call_indirect
+ (call_indirect 0 (i64.const 0))
+ )
+
+ ;; CHECK: (func $test_table_size (result i64)
+ ;; CHECK-NEXT: (i64.extend_i32_u
+ ;; CHECK-NEXT: (table.size $t)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $test_table_size (result i64)
+ (table.size $t)
+ )
+
+ ;; CHECK: (func $test_table_grow (result i64)
+ ;; CHECK-NEXT: (i64.extend_i32_u
+ ;; CHECK-NEXT: (table.grow $t
+ ;; CHECK-NEXT: (ref.null nofunc)
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 10)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $test_table_grow (result i64)
+ (table.grow $t (ref.null func) (i64.const 10))
+ )
+
+ ;; CHECK: (func $test_table_fill
+ ;; CHECK-NEXT: (table.fill $t
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (ref.null nofunc)
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 10)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $test_table_fill
+ (table.fill $t (i64.const 0) (ref.null func) (i64.const 10))
+ )
+)
diff --git a/test/lit/validation/extended-const.wast b/test/lit/validation/extended-const.wast
index 8188079a1..36ffee430 100644
--- a/test/lit/validation/extended-const.wast
+++ b/test/lit/validation/extended-const.wast
@@ -4,8 +4,8 @@
;; RUN: wasm-opt %s -all -o - -S | filecheck %s --check-prefix EXTENDED
;; NO-EXTENDED: unexpected false: global init must be constant
-;; NO-EXTENDED: unexpected false: memory segment offset should be constant
-;; NO-EXTENDED: unexpected false: table segment offset should be constant
+;; NO-EXTENDED: unexpected false: memory segment offset must be constant
+;; NO-EXTENDED: unexpected false: table segment offset must be constant
;; EXTENDED: (import "env" "global" (global $gimport$0 i32))
;; EXTENDED: (global $1 i32 (i32.add