Debian Codegraph @

js/src/jit-test/tests/wasm/fac.js

raw
1 // This is fac-opt from fac.wast in the official testsuite, changed to use
2 // i32 instead of i64.
3 assertEq(wasmEvalText(`(module
4 (func $fac-opt (param i32) (result i32)
5 (local i32)
6 (local.set 1 (i32.const 1))
7 (block
8 (br_if 0 (i32.lt_s (local.get 0) (i32.const 2)))
9 (loop
10 (local.set 1 (i32.mul (local.get 1) (local.get 0)))
11 (local.set 0 (i32.add (local.get 0) (i32.const -1)))
12 (br_if 0 (i32.gt_s (local.get 0) (i32.const 1)))
13 )
14 )
15 (local.get 1)
16 )
17
18 (export "" (func 0))
19 )`).exports[""](10), 3628800);