Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions ml-proto/test/func.wast
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@

;; Typing of locals

(func "local-first-i32" (local i32 i32) (result i32) (get_local 0))
(func "local-first-i64" (local i64 i64) (result i64) (get_local 0))
(func "local-first-f32" (local f32 f32) (result f32) (get_local 0))
(func "local-first-f64" (local f64 f64) (result f64) (get_local 0))
(func "local-second-i32" (local i32 i32) (result i32) (get_local 1))
(func "local-second-i64" (local i64 i64) (result i64) (get_local 1))
(func "local-second-f32" (local f32 f32) (result f32) (get_local 1))
(func "local-second-f64" (local f64 f64) (result f64) (get_local 1))
(func "local-mixed" (local f32) (local $x i32) (local i64 i32) (local) (local f64 i32) (result f64)
(func "local-first-i32" (result i32) (local i32 i32) (get_local 0))
(func "local-first-i64" (result i64) (local i64 i64) (get_local 0))
(func "local-first-f32" (result f32) (local f32 f32) (get_local 0))
(func "local-first-f64" (result f64) (local f64 f64) (get_local 0))
(func "local-second-i32" (result i32) (local i32 i32) (get_local 1))
(func "local-second-i64" (result i64) (local i64 i64) (get_local 1))
(func "local-second-f32" (result f32) (local f32 f32) (get_local 1))
(func "local-second-f64" (result f64) (local f64 f64) (get_local 1))
(func "local-mixed" (result f64) (local f32) (local $x i32) (local i64 i32) (local) (local f64 i32)
(f32.neg (get_local 0))
(i32.eqz (get_local 1))
(i64.eqz (get_local 2))
Expand Down Expand Up @@ -153,10 +153,10 @@

;; Default initialization of locals

(func "init-local-i32" (local i32) (result i32) (get_local 0))
(func "init-local-i64" (local i64) (result i64) (get_local 0))
(func "init-local-f32" (local f32) (result f32) (get_local 0))
(func "init-local-f64" (local f64) (result f64) (get_local 0))
(func "init-local-i32" (result i32) (local i32) (get_local 0))
(func "init-local-i64" (result i64) (local i64) (get_local 0))
(func "init-local-f32" (result f32) (local f32) (get_local 0))
(func "init-local-f64" (result f64) (local f64) (get_local 0))
)

(assert_return (invoke "local-first-i32") (i32.const 0))
Expand Down Expand Up @@ -280,7 +280,7 @@
;; Invalid typing of locals

(assert_invalid
(module (func $type-local-num-vs-num (local i32) (result i64) (get_local 0)))
(module (func $type-local-num-vs-num (result i64) (local i32) (get_local 0)))
"type mismatch"
)
(assert_invalid
Expand Down
16 changes: 9 additions & 7 deletions ml-proto/test/get_local.wast
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
(module
;; Typing

(func "type-local-i32" (local i32) (result i32) (get_local 0))
(func "type-local-i64" (local i64) (result i64) (get_local 0))
(func "type-local-f32" (local f32) (result f32) (get_local 0))
(func "type-local-f64" (local f64) (result f64) (get_local 0))
(func "type-local-i32" (result i32) (local i32) (get_local 0))
(func "type-local-i64" (result i64) (local i64) (get_local 0))
(func "type-local-f32" (result f32) (local f32) (get_local 0))
(func "type-local-f64" (result f64) (local f64) (get_local 0))

(func "type-param-i32" (param i32) (result i32) (get_local 0))
(func "type-param-i64" (param i64) (result i64) (get_local 0))
(func "type-param-f32" (param f32) (result f32) (get_local 0))
(func "type-param-f64" (param f64) (result f64) (get_local 0))

(func "type-mixed" (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) (result f64)
(func "type-mixed" (param i64 f32 f64 i32 i32) (result f64)
(local f32 i64 i64 f64)
(i64.eqz (get_local 0))
(f32.neg (get_local 1))
(f64.neg (get_local 2))
Expand All @@ -27,7 +28,8 @@

;; Reading

(func "read" (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) (result f64)
(func "read" (param i64 f32 f64 i32 i32) (result f64)
(local f32 i64 i64 f64)
(set_local 5 (f32.const 5.5))
(set_local 6 (i64.const 6))
(set_local 8 (f64.const 8))
Expand Down Expand Up @@ -87,7 +89,7 @@
;; Invalid typing of access to locals

(assert_invalid
(module (func $type-local-num-vs-num (local i32) (result i64) (get_local 0)))
(module (func $type-local-num-vs-num (result i64) (local i32) (get_local 0)))
"type mismatch"
)
(assert_invalid
Expand Down
16 changes: 9 additions & 7 deletions ml-proto/test/set_local.wast
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
(module
;; Typing

(func "type-local-i32" (local i32) (result i32) (set_local 0 (i32.const 0)))
(func "type-local-i64" (local i64) (result i64) (set_local 0 (i64.const 0)))
(func "type-local-f32" (local f32) (result f32) (set_local 0 (f32.const 0)))
(func "type-local-f64" (local f64) (result f64) (set_local 0 (f64.const 0)))
(func "type-local-i32" (result i32) (local i32) (set_local 0 (i32.const 0)))
(func "type-local-i64" (result i64) (local i64) (set_local 0 (i64.const 0)))
(func "type-local-f32" (result f32) (local f32) (set_local 0 (f32.const 0)))
(func "type-local-f64" (result f64) (local f64) (set_local 0 (f64.const 0)))

(func "type-param-i32" (param i32) (result i32) (set_local 0 (i32.const 10)))
(func "type-param-i64" (param i64) (result i64) (set_local 0 (i64.const 11)))
Expand All @@ -27,7 +27,8 @@

;; Writing

(func "write" (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) (result i64)
(func "write" (param i64 f32 f64 i32 i32) (result i64)
(local f32 i64 i64 f64)
(set_local 1 (f32.const -0.3))
(set_local 3 (i32.const 40))
(set_local 4 (i32.const -7))
Expand Down Expand Up @@ -65,7 +66,8 @@

;; Result

(func "result" (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) (result f64)
(func "result" (param i64 f32 f64 i32 i32) (result f64)
(local f32 i64 i64 f64)
(f64.add
(f64.convert_u/i64 (set_local 0 (i64.const 1)))
(f64.add
Expand Down Expand Up @@ -128,7 +130,7 @@
;; Invalid typing of access to locals

(assert_invalid
(module (func $type-local-num-vs-num (local i32) (result i64) (set_local 0 (i32.const 0))))
(module (func $type-local-num-vs-num (result i64) (local i32) (set_local 0 (i32.const 0))))
"type mismatch"
)
(assert_invalid
Expand Down