summaryrefslogtreecommitdiff
path: root/test/decompile/basic.txt
diff options
context:
space:
mode:
Diffstat (limited to 'test/decompile/basic.txt')
-rw-r--r--test/decompile/basic.txt76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/decompile/basic.txt b/test/decompile/basic.txt
new file mode 100644
index 00000000..7e529fc0
--- /dev/null
+++ b/test/decompile/basic.txt
@@ -0,0 +1,76 @@
+;;; TOOL: run-wasm-decompile
+
+(module
+ (memory 1)
+ (func $f (param i32 i32) (result i32) (local i64 f32 f64)
+ i64.const 8
+ set_local 2
+ f32.const 6.0
+ set_local 3
+ f64.const 7.0
+ tee_local 4
+ f64.const 10.0
+ f64.lt
+ if
+ i32.const 1
+ i32.const 2
+ i32.load offset=3
+ i32.const 5
+ i32.add
+ i32.store offset=4
+ end
+ get_local 0
+ get_local 1
+ i32.add
+ i32.const 9
+ call $f
+ drop
+ loop
+ block
+ i32.const 0
+ if (result i32)
+ i32.const 1
+ else
+ i32.const 2
+ end
+ br_if 0
+ br 1
+ end
+ i32.const 1
+ br_if 0
+ end
+ call $mv
+ i32.eq
+ )
+ (func $mv (param) (result i32 i32)
+ i32.const 1
+ i32.const 2
+ )
+ (export "f" (func $f))
+ (export "mv" (func $mv))
+)
+
+(;; STDOUT ;;;
+
+function f(a:int, b:int):int {
+ var c:long = 8L;
+ var d:float = 6f;
+ var e:double = 7d;
+ if (e < 10d) { 1[4]:int = (2[3]:int + 5) }
+ f(a + b, 9);
+ loop L_b {
+ block B_c {
+ if (if (0) { 1 } else { 2 }) break B_c;
+ continue L_b;
+ }
+ if (1) continue L_b;
+ }
+ push_all(mv());
+ return pop() == pop();
+}
+
+function mv():(int, int) {
+ return 1, 2
+}
+
+;;; STDOUT ;;)