commit 3298ef824d716a79bfaec1d2326f9fe3871889be parent 243e2da69a3139591441c3495637875794bb4d55 Author: William Casarin <jb55@jb55.com> Date: Sun, 18 Jul 2021 15:50:53 -0700 add loop test Diffstat:
A | wasm/loop.wat | | | 29 | +++++++++++++++++++++++++++++ |
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/wasm/loop.wat b/wasm/loop.wat @@ -0,0 +1,29 @@ +(module + (func $add (param $lhs i32) (param $rhs i32) (result i32) + local.get $lhs + local.get $rhs + i32.add) + (func $sub (param $lhs i32) (param $rhs i32) (result i32) + local.get $lhs + local.get $rhs + i32.sub + ) + (func $start (result i32) + (local i32 i32) + i32.const 0 + local.set 0 + loop + local.get 0 + i32.const 1 + i32.add + local.set 0 + local.get 0 + i32.const 4 + i32.gt_u + br_if 0 + end + i32.const 0 + ) + (export "start" (func $start)) + (export "add" (func $add)) + (export "sub" (func $sub)))