Dumped code from the wasm2cretonne repo.
Integrated wasm test suite translation as cretonne test Fixes #146. Fixes #143.
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
e8276ed965
commit
ee9989c4b9
13
cranelift/wasmtests/arith.wast
Normal file
13
cranelift/wasmtests/arith.wast
Normal file
@@ -0,0 +1,13 @@
|
||||
(module
|
||||
(memory 1)
|
||||
(func $main (local i32)
|
||||
(set_local 0 (i32.sub (i32.const 4) (i32.const 4)))
|
||||
(if
|
||||
(get_local 0)
|
||||
(then unreachable)
|
||||
(else (drop (i32.mul (i32.const 6) (get_local 0))))
|
||||
)
|
||||
)
|
||||
(start $main)
|
||||
(data (i32.const 0) "abcdefgh")
|
||||
)
|
||||
10
cranelift/wasmtests/call.wast
Normal file
10
cranelift/wasmtests/call.wast
Normal file
@@ -0,0 +1,10 @@
|
||||
(module
|
||||
(func $main (local i32)
|
||||
(set_local 0 (i32.const 0))
|
||||
(drop (call $inc))
|
||||
)
|
||||
(func $inc (result i32)
|
||||
(i32.const 1)
|
||||
)
|
||||
(start $main)
|
||||
)
|
||||
22
cranelift/wasmtests/fibonacci.wast
Normal file
22
cranelift/wasmtests/fibonacci.wast
Normal file
@@ -0,0 +1,22 @@
|
||||
(module
|
||||
(memory 1)
|
||||
(func $main (local i32 i32 i32 i32)
|
||||
(set_local 0 (i32.const 0))
|
||||
(set_local 1 (i32.const 1))
|
||||
(set_local 2 (i32.const 1))
|
||||
(set_local 3 (i32.const 0))
|
||||
(block
|
||||
(loop
|
||||
(br_if 1 (i32.gt_s (get_local 0) (i32.const 5)))
|
||||
(set_local 3 (get_local 2))
|
||||
(set_local 2 (i32.add (get_local 2) (get_local 1)))
|
||||
(set_local 1 (get_local 3))
|
||||
(set_local 0 (i32.add (get_local 0) (i32.const 1)))
|
||||
(br 0)
|
||||
)
|
||||
)
|
||||
(i32.store (i32.const 0) (get_local 2))
|
||||
)
|
||||
(start $main)
|
||||
(data (i32.const 0) "0000")
|
||||
)
|
||||
8
cranelift/wasmtests/globals.wast
Normal file
8
cranelift/wasmtests/globals.wast
Normal file
@@ -0,0 +1,8 @@
|
||||
(module
|
||||
(global $x (mut i32) (i32.const 4))
|
||||
(memory 1)
|
||||
(func $main (local i32)
|
||||
(i32.store (i32.const 0) (get_global $x))
|
||||
)
|
||||
(start $main)
|
||||
)
|
||||
11
cranelift/wasmtests/memory.wast
Normal file
11
cranelift/wasmtests/memory.wast
Normal file
@@ -0,0 +1,11 @@
|
||||
(module
|
||||
(memory 1)
|
||||
(func $main (local i32)
|
||||
(i32.store (i32.const 0) (i32.const 0x0))
|
||||
(if (i32.load (i32.const 0))
|
||||
(then (i32.store (i32.const 0) (i32.const 0xa)))
|
||||
(else (i32.store (i32.const 0) (i32.const 0xb))))
|
||||
)
|
||||
(start $main)
|
||||
(data (i32.const 0) "0000")
|
||||
)
|
||||
Reference in New Issue
Block a user