diff options
Diffstat (limited to 'test/spec/stack.wast')
-rw-r--r-- | test/spec/stack.wast | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/test/spec/stack.wast b/test/spec/stack.wast index a8c79b698..5da5043c8 100644 --- a/test/spec/stack.wast +++ b/test/spec/stack.wast @@ -34,17 +34,15 @@ (i64.eq) (if (then (br $done)) - (then - (else - (local.get $i) - (local.get $res) - (i64.mul) - (local.set $res) - (local.get $i) - (i64.const 1) - (i64.sub) - (local.set $i) - ) + (else + (local.get $i) + (local.get $res) + (i64.mul) + (local.set $res) + (local.get $i) + (i64.const 1) + (i64.sub) + (local.set $i) ) ) (br $loop) @@ -93,13 +91,11 @@ (i64.eq (local.get $i) (i64.const 0)) (if (then (br $done)) - (then - (else - (i64.mul (local.get $i) (local.get $res)) - (local.set $res) - (i64.sub (local.get $i) (i64.const 1)) - (local.set $i) - ) + (else + (i64.mul (local.get $i) (local.get $res)) + (local.set $res) + (i64.sub (local.get $i) (i64.const 1)) + (local.set $i) ) ) (br $loop) @@ -129,12 +125,31 @@ end local.get $res ) + + (global $temp (mut i32) (i32.const 0)) + (func $add_one_to_global (result i32) + (local i32) + (global.set $temp (i32.add (i32.const 1) (global.get $temp))) + (global.get $temp) + ) + (func $add_one_to_global_and_drop + (drop (call $add_one_to_global)) + ) + (func (export "not-quite-a-tree") (result i32) + call $add_one_to_global + call $add_one_to_global + call $add_one_to_global_and_drop + i32.add + ) ) (assert_return (invoke "fac-expr" (i64.const 25)) (i64.const 7034535277573963776)) (assert_return (invoke "fac-stack" (i64.const 25)) (i64.const 7034535277573963776)) (assert_return (invoke "fac-mixed" (i64.const 25)) (i64.const 7034535277573963776)) +(assert_return (invoke "not-quite-a-tree") (i32.const 3)) +(assert_return (invoke "not-quite-a-tree") (i32.const 9)) + ;; Syntax of flat call_indirect |