first commit
This commit is contained in:
commit
b574d39a39
23 changed files with 8604 additions and 0 deletions
35
tests/wasm/fib.wat
Normal file
35
tests/wasm/fib.wat
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
;; tests/wasm/fib.wat
|
||||
(module
|
||||
(import "env" "log" (func $log (param i32 i32)))
|
||||
|
||||
(memory (export "memory") 1)
|
||||
(data (i32.const 0) "fib called\n")
|
||||
|
||||
(func $fib_impl (param $n i32) (result i32)
|
||||
local.get $n
|
||||
i32.const 2
|
||||
i32.lt_s
|
||||
if (result i32)
|
||||
local.get $n
|
||||
else
|
||||
local.get $n
|
||||
i32.const 1
|
||||
i32.sub
|
||||
call $fib_impl
|
||||
local.get $n
|
||||
i32.const 2
|
||||
i32.sub
|
||||
call $fib_impl
|
||||
i32.add
|
||||
end
|
||||
)
|
||||
|
||||
(func (export "fib") (param $n i32) (result i32)
|
||||
i32.const 0
|
||||
i32.const 11
|
||||
call $log
|
||||
|
||||
local.get $n
|
||||
call $fib_impl
|
||||
)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue