summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/example/c-api-kitchen-sink.txt16
-rw-r--r--test/example/c-api-kitchen-sink.txt.txt8
-rw-r--r--test/unit.asm.js15
-rw-r--r--test/unit.fromasm22
-rw-r--r--test/unit.fromasm.imprecise22
-rw-r--r--test/unit.fromasm.imprecise.no-opts56
-rw-r--r--test/unit.fromasm.no-opts56
7 files changed, 136 insertions, 59 deletions
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 28d7b759b..b7b4821ac 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -399,10 +399,12 @@ BinaryenFloat64: 4
)
(block
)
- (drop
- (if
- (i32.const 1)
+ (if
+ (i32.const 1)
+ (drop
(i32.const 2)
+ )
+ (drop
(i32.const 3)
)
)
@@ -1992,10 +1994,12 @@ int main() {
)
(block
)
- (drop
- (if
- (i32.const 1)
+ (if
+ (i32.const 1)
+ (drop
(i32.const 2)
+ )
+ (drop
(i32.const 3)
)
)
diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt
index f66b714eb..a6f6e0853 100644
--- a/test/example/c-api-kitchen-sink.txt.txt
+++ b/test/example/c-api-kitchen-sink.txt.txt
@@ -394,10 +394,12 @@
)
(block
)
- (drop
- (if
- (i32.const 1)
+ (if
+ (i32.const 1)
+ (drop
(i32.const 2)
+ )
+ (drop
(i32.const 3)
)
)
diff --git a/test/unit.asm.js b/test/unit.asm.js
index d4426bd90..931a75191 100644
--- a/test/unit.asm.js
+++ b/test/unit.asm.js
@@ -572,6 +572,21 @@ function asm(global, env, buffer) {
return temp | 0;
}
+ function dropIgnoredImportInIf($0,$1,$2) {
+ $0 = $0|0;
+ $1 = $1|0;
+ $2 = $2|0;
+ do {
+ if ($0) {
+ $0 = 1;
+ lb($2 | 0) | 0;
+ } else {
+ break;
+ }
+ } while(0);
+ return;
+ }
+
var FUNCTION_TABLE_a = [ z, big_negative, z, z ];
var FUNCTION_TABLE_b = [ w, w, importedDoubles, w ];
var FUNCTION_TABLE_c = [ z, cneg ];
diff --git a/test/unit.fromasm b/test/unit.fromasm
index fb9f239da..c4af783eb 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -508,13 +508,11 @@
)
)
(func $smallIf
- (block $do-once$0
- (if
- (i32.const 2)
- (drop
- (call $lb
- (i32.const 3)
- )
+ (if
+ (i32.const 2)
+ (drop
+ (call $lb
+ (i32.const 3)
)
)
)
@@ -1023,4 +1021,14 @@
)
(get_local $0)
)
+ (func $dropIgnoredImportInIf (param $0 i32) (param $1 i32) (param $2 i32)
+ (if
+ (get_local $0)
+ (drop
+ (call $lb
+ (get_local $2)
+ )
+ )
+ )
+ )
)
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index ad130ea82..91e75d5c6 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -489,13 +489,11 @@
)
)
(func $smallIf
- (block $do-once$0
- (if
- (i32.const 2)
- (drop
- (call $lb
- (i32.const 3)
- )
+ (if
+ (i32.const 2)
+ (drop
+ (call $lb
+ (i32.const 3)
)
)
)
@@ -1004,4 +1002,14 @@
)
(get_local $0)
)
+ (func $dropIgnoredImportInIf (param $0 i32) (param $1 i32) (param $2 i32)
+ (if
+ (get_local $0)
+ (drop
+ (call $lb
+ (get_local $2)
+ )
+ )
+ )
+ )
)
diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts
index 636238f17..ffcd9f449 100644
--- a/test/unit.fromasm.imprecise.no-opts
+++ b/test/unit.fromasm.imprecise.no-opts
@@ -856,14 +856,14 @@
)
(func $smallIf
(block $do-once$0
- (drop
- (if
- (i32.const 2)
+ (if
+ (i32.const 2)
+ (drop
(call $lb
(i32.const 3)
)
- (br $do-once$0)
)
+ (br $do-once$0)
)
(nop)
)
@@ -930,23 +930,23 @@
)
(func $breakThroughMany (param $$s i32)
(block $label$break$L1
- (drop
- (if
- (get_local $$s)
- (loop $while-in$2
- (block $while-out$1
- (if
- (i32.eqz
- (get_local $$s)
- )
- (br $label$break$L1)
- )
- (call $zeroInit
- (i32.const 0)
+ (if
+ (get_local $$s)
+ (loop $while-in$2
+ (block $while-out$1
+ (if
+ (i32.eqz
+ (get_local $$s)
)
- (br $while-in$2)
+ (br $label$break$L1)
+ )
+ (call $zeroInit
+ (i32.const 0)
)
+ (br $while-in$2)
)
+ )
+ (drop
(i32.const 1337)
)
)
@@ -1624,4 +1624,24 @@
(get_local $temp)
)
)
+ (func $dropIgnoredImportInIf (param $$0 i32) (param $$1 i32) (param $$2 i32)
+ (block $do-once$0
+ (if
+ (get_local $$0)
+ (block
+ (set_local $$0
+ (i32.const 1)
+ )
+ (drop
+ (call $lb
+ (get_local $$2)
+ )
+ )
+ )
+ (br $do-once$0)
+ )
+ (nop)
+ )
+ (return)
+ )
)
diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts
index 0684c1464..a8ca0e47a 100644
--- a/test/unit.fromasm.no-opts
+++ b/test/unit.fromasm.no-opts
@@ -862,14 +862,14 @@
)
(func $smallIf
(block $do-once$0
- (drop
- (if
- (i32.const 2)
+ (if
+ (i32.const 2)
+ (drop
(call $lb
(i32.const 3)
)
- (br $do-once$0)
)
+ (br $do-once$0)
)
(nop)
)
@@ -936,23 +936,23 @@
)
(func $breakThroughMany (param $$s i32)
(block $label$break$L1
- (drop
- (if
- (get_local $$s)
- (loop $while-in$2
- (block $while-out$1
- (if
- (i32.eqz
- (get_local $$s)
- )
- (br $label$break$L1)
- )
- (call $zeroInit
- (i32.const 0)
+ (if
+ (get_local $$s)
+ (loop $while-in$2
+ (block $while-out$1
+ (if
+ (i32.eqz
+ (get_local $$s)
)
- (br $while-in$2)
+ (br $label$break$L1)
+ )
+ (call $zeroInit
+ (i32.const 0)
)
+ (br $while-in$2)
)
+ )
+ (drop
(i32.const 1337)
)
)
@@ -1630,4 +1630,24 @@
(get_local $temp)
)
)
+ (func $dropIgnoredImportInIf (param $$0 i32) (param $$1 i32) (param $$2 i32)
+ (block $do-once$0
+ (if
+ (get_local $$0)
+ (block
+ (set_local $$0
+ (i32.const 1)
+ )
+ (drop
+ (call $lb
+ (get_local $$2)
+ )
+ )
+ )
+ (br $do-once$0)
+ )
+ (nop)
+ )
+ (return)
+ )
)