-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add test file * support br_table instruction (#49) * add java options to Test (#50) --------- Co-authored-by: butterunderflow <[email protected]>
- Loading branch information
1 parent
f0e2046
commit a8781d4
Showing
5 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#[no_mangle] | ||
#[inline(never)] | ||
fn fibonacci(n: i32) -> i32 { | ||
if n == 0 { 0 } | ||
else if n == 1 { 1 } | ||
else { fibonacci(n - 1) + fibonacci(n - 2) } | ||
} | ||
|
||
#[no_mangle] | ||
fn real_main() -> i32 { | ||
fibonacci(12) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(module | ||
(type (;0;) (func (param i32) (result i32))) | ||
(type (;1;) (func (result i32))) | ||
(func (;0;) (type 0) (param i32) (result i32) | ||
(local i32) | ||
i32.const 0 | ||
local.set 1 | ||
local.get 0 | ||
local.set 0 | ||
block ;; label = @1 | ||
loop ;; label = @2 | ||
local.get 1 | ||
local.set 1 | ||
block ;; label = @3 | ||
block ;; label = @4 | ||
block ;; label = @5 | ||
local.get 0 | ||
local.tee 0 | ||
br_table 0 (;@5;) 1 (;@4;) 2 (;@3;) | ||
end | ||
local.get 0 | ||
local.set 0 | ||
br 3 (;@1;) | ||
end | ||
i32.const 1 | ||
local.set 0 | ||
br 2 (;@1;) | ||
end | ||
local.get 1 | ||
local.get 0 | ||
i32.const -1 | ||
i32.add | ||
call 0 | ||
i32.add | ||
local.set 1 | ||
local.get 0 | ||
i32.const -2 | ||
i32.add | ||
local.set 0 | ||
br 0 (;@2;) | ||
end | ||
end | ||
local.get 1 | ||
local.get 0 | ||
i32.add) | ||
(func (;1;) (type 1) (result i32) | ||
i32.const 12 | ||
call 0) | ||
(start 1) | ||
(table (;0;) 1 1 funcref) | ||
(memory (;0;) 16) | ||
(global (;0;) (mut i32) (i32.const 1048576)) | ||
(global (;1;) i32 (i32.const 1048576)) | ||
(global (;2;) i32 (i32.const 1048576)) | ||
(export "memory" (memory 0)) | ||
(export "fibonacci" (func 0)) | ||
(export "real_main" (func 1)) | ||
(export "__data_end" (global 1)) | ||
(export "__heap_base" (global 2))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters