summaryrefslogtreecommitdiff
path: root/test/binaryen.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js')
-rw-r--r--test/binaryen.js/expressions.js4
-rw-r--r--test/binaryen.js/expressions.js.txt12
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt170
-rw-r--r--test/binaryen.js/optimize-levels.js4
-rw-r--r--test/binaryen.js/optimize-levels.js.txt12
-rw-r--r--test/binaryen.js/sieve.js.txt40
-rw-r--r--test/binaryen.js/stackir.js4
-rw-r--r--test/binaryen.js/stackir.js.txt4
8 files changed, 151 insertions, 99 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js
index c7c45a08a..bd681f86d 100644
--- a/test/binaryen.js/expressions.js
+++ b/test/binaryen.js/expressions.js
@@ -109,7 +109,7 @@ console.log("# If");
assert(
theIf.toText()
==
- "(if (result i32)\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n"
+ "(if (result i32)\n (i32.const 4)\n (then\n (i32.const 5)\n )\n (else\n (i32.const 6)\n )\n)\n"
);
theIf.ifFalse = null;
@@ -118,7 +118,7 @@ console.log("# If");
assert(
theIf.toText()
==
- "(if (result i32)\n (i32.const 4)\n (i32.const 5)\n)\n"
+ "(if (result i32)\n (i32.const 4)\n (then\n (i32.const 5)\n )\n)\n"
);
module.dispose();
diff --git a/test/binaryen.js/expressions.js.txt b/test/binaryen.js/expressions.js.txt
index 7b04795ba..5d6c37c6b 100644
--- a/test/binaryen.js/expressions.js.txt
+++ b/test/binaryen.js/expressions.js.txt
@@ -7,13 +7,19 @@
# If
(if (result i32)
(i32.const 4)
- (i32.const 5)
- (i32.const 6)
+ (then
+ (i32.const 5)
+ )
+ (else
+ (i32.const 6)
+ )
)
(if (result i32)
(i32.const 4)
- (i32.const 5)
+ (then
+ (i32.const 5)
+ )
)
# Loop
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index bbef03377..b5a9b713e 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -1934,17 +1934,23 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
)
(if
(i32.const 1)
- (drop
- (i32.const 2)
+ (then
+ (drop
+ (i32.const 2)
+ )
)
- (drop
- (i32.const 3)
+ (else
+ (drop
+ (i32.const 3)
+ )
)
)
(if
(i32.const 4)
- (drop
- (i32.const 5)
+ (then
+ (drop
+ (i32.const 5)
+ )
)
)
(drop
@@ -4038,17 +4044,23 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
)
(if
(i32.const 1)
- (drop
- (i32.const 2)
+ (then
+ (drop
+ (i32.const 2)
+ )
)
- (drop
- (i32.const 3)
+ (else
+ (drop
+ (i32.const 3)
+ )
)
)
(if
(i32.const 4)
- (drop
- (i32.const 5)
+ (then
+ (drop
+ (i32.const 5)
+ )
)
)
(drop
@@ -4423,14 +4435,18 @@ raw:
)
(if
(i32.const 55)
- (block
- (call $check
- (i32.const 1)
+ (then
+ (block
+ (call $check
+ (i32.const 1)
+ )
)
)
- (block
- (call $check
- (i32.const 2)
+ (else
+ (block
+ (call $check
+ (i32.const 2)
+ )
)
)
)
@@ -4442,7 +4458,7 @@ raw:
)
(if
(i32.const 55)
- (block
+ (then
(drop
(i32.const 10)
)
@@ -4452,7 +4468,7 @@ raw:
)
)
)
- (block
+ (else
(drop
(i32.const 20)
)
@@ -4472,15 +4488,19 @@ raw:
)
(if
(i32.const 55)
- (block
- (call $check
- (i32.const 1)
- )
+ (then
(block
- (br $block$3$break)
+ (call $check
+ (i32.const 1)
+ )
+ (block
+ (br $block$3$break)
+ )
)
)
- (br $block$3$break)
+ (else
+ (br $block$3$break)
+ )
)
)
(block
@@ -4497,7 +4517,7 @@ raw:
)
(if
(i32.const 55)
- (block
+ (then
(drop
(i32.const -1)
)
@@ -4513,7 +4533,7 @@ raw:
)
)
)
- (block
+ (else
(drop
(i32.const -2)
)
@@ -4535,20 +4555,24 @@ raw:
)
(if
(i32.const 55)
- (block
- (call $check
- (i32.const 1)
- )
+ (then
(block
- (br $block$4$break)
+ (call $check
+ (i32.const 1)
+ )
+ (block
+ (br $block$4$break)
+ )
)
)
- (block
- (call $check
- (i32.const 2)
- )
+ (else
(block
- (br $block$4$break)
+ (call $check
+ (i32.const 2)
+ )
+ (block
+ (br $block$4$break)
+ )
)
)
)
@@ -4573,8 +4597,12 @@ raw:
)
(if
(i32.const 10)
- (br $shape$0$continue)
- (br $block$3$break)
+ (then
+ (br $shape$0$continue)
+ )
+ (else
+ (br $block$3$break)
+ )
)
)
)
@@ -4607,8 +4635,10 @@ raw:
)
(if
(i32.const -2)
- (br $block$3$break)
- (block
+ (then
+ (br $block$3$break)
+ )
+ (else
(drop
(i32.const 20)
)
@@ -4622,8 +4652,10 @@ raw:
)
(if
(i32.const -6)
- (br $block$4$break)
- (block
+ (then
+ (br $block$4$break)
+ )
+ (else
(drop
(i32.const 30)
)
@@ -4640,15 +4672,19 @@ raw:
)
(if
(i32.const -10)
- (block
- (call $check
- (i32.const 4)
- )
+ (then
(block
- (br $block$6$break)
+ (call $check
+ (i32.const 4)
+ )
+ (block
+ (br $block$6$break)
+ )
)
)
- (br $block$6$break)
+ (else
+ (br $block$6$break)
+ )
)
)
(block
@@ -4731,13 +4767,13 @@ raw:
)
(if
(i32.const 10)
- (block
+ (then
(local.set $3
(i32.const 2)
)
(br $block$2$break)
)
- (block
+ (else
(local.set $3
(i32.const 3)
)
@@ -4753,7 +4789,7 @@ raw:
(local.get $3)
(i32.const 2)
)
- (block
+ (then
(local.set $3
(i32.const 0)
)
@@ -4767,23 +4803,25 @@ raw:
(br $shape$1$continue)
)
)
- (if
- (i32.eq
- (local.get $3)
- (i32.const 3)
- )
- (block
- (local.set $3
- (i32.const 0)
- )
- (call $check
- (i32.const 2)
+ (else
+ (if
+ (i32.eq
+ (local.get $3)
+ (i32.const 3)
)
- (block
+ (then
(local.set $3
+ (i32.const 0)
+ )
+ (call $check
(i32.const 2)
)
- (br $shape$1$continue)
+ (block
+ (local.set $3
+ (i32.const 2)
+ )
+ (br $shape$1$continue)
+ )
)
)
)
diff --git a/test/binaryen.js/optimize-levels.js b/test/binaryen.js/optimize-levels.js
index b3dd2adbd..6d9dbc262 100644
--- a/test/binaryen.js/optimize-levels.js
+++ b/test/binaryen.js/optimize-levels.js
@@ -7,8 +7,8 @@ var wast = `
(block (result i32)
(if (result i32)
(local.get $0)
- (local.get $0)
- (i32.const 0)
+ (then (local.get $0))
+ (else (i32.const 0))
)
)
)
diff --git a/test/binaryen.js/optimize-levels.js.txt b/test/binaryen.js/optimize-levels.js.txt
index 05fe23589..ed928fbef 100644
--- a/test/binaryen.js/optimize-levels.js.txt
+++ b/test/binaryen.js/optimize-levels.js.txt
@@ -7,8 +7,8 @@
(block (result i32)
(if (result i32)
(local.get $0)
- (local.get $0)
- (i32.const 0)
+ (then (local.get $0))
+ (else (i32.const 0))
)
)
)
@@ -22,8 +22,12 @@
(func $test (param $0 i32) (result i32)
(if (result i32)
(local.get $0)
- (local.get $0)
- (i32.const 0)
+ (then
+ (local.get $0)
+ )
+ (else
+ (i32.const 0)
+ )
)
)
)
diff --git a/test/binaryen.js/sieve.js.txt b/test/binaryen.js/sieve.js.txt
index 3fad13fdf..46e5d3b39 100644
--- a/test/binaryen.js/sieve.js.txt
+++ b/test/binaryen.js/sieve.js.txt
@@ -12,17 +12,19 @@
)
(local.get $0)
)
- (drop
- (memory.grow
- (i32.sub
- (i32.div_u
- (i32.add
- (local.get $0)
- (i32.const 65535)
+ (then
+ (drop
+ (memory.grow
+ (i32.sub
+ (i32.div_u
+ (i32.add
+ (local.get $0)
+ (i32.const 65535)
+ )
+ (i32.const 65536)
)
- (i32.const 65536)
+ (memory.size)
)
- (memory.size)
)
)
)
@@ -70,17 +72,19 @@ optimized:
)
(local.get $0)
)
- (drop
- (memory.grow
- (i32.sub
- (i32.shr_u
- (i32.add
- (local.get $0)
- (i32.const 65535)
+ (then
+ (drop
+ (memory.grow
+ (i32.sub
+ (i32.shr_u
+ (i32.add
+ (local.get $0)
+ (i32.const 65535)
+ )
+ (i32.const 16)
)
- (i32.const 16)
+ (memory.size)
)
- (memory.size)
)
)
)
diff --git a/test/binaryen.js/stackir.js b/test/binaryen.js/stackir.js
index 20754e078..d797aa6d8 100644
--- a/test/binaryen.js/stackir.js
+++ b/test/binaryen.js/stackir.js
@@ -8,8 +8,8 @@ var wast = `
(block (result i32)
(if (result i32)
(local.get $0)
- (local.get $0)
- (i32.const 0)
+ (then (local.get $0))
+ (else (i32.const 0))
)
)
)
diff --git a/test/binaryen.js/stackir.js.txt b/test/binaryen.js/stackir.js.txt
index a49c6bb01..bd906c388 100644
--- a/test/binaryen.js/stackir.js.txt
+++ b/test/binaryen.js/stackir.js.txt
@@ -8,8 +8,8 @@
(block (result i32)
(if (result i32)
(local.get $0)
- (local.get $0)
- (i32.const 0)
+ (then (local.get $0))
+ (else (i32.const 0))
)
)
)