summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/emcc_hello_world.fromasm17
-rw-r--r--test/emcc_hello_world.fromasm.imprecise17
-rw-r--r--test/passes/optimize-instructions.txt20
-rw-r--r--test/passes/optimize-instructions.wast16
4 files changed, 46 insertions, 24 deletions
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm
index d1c3304ff..239c2a185 100644
--- a/test/emcc_hello_world.fromasm
+++ b/test/emcc_hello_world.fromasm
@@ -6339,15 +6339,11 @@
(i32.const 1)
)
)
- (i32.eqz
- (i32.eqz
- (i32.and
- (i32.load
- (get_local $0)
- )
- (i32.const 32)
- )
+ (i32.and
+ (i32.load
+ (get_local $0)
)
+ (i32.const 32)
)
)
)
@@ -7043,10 +7039,7 @@
(set_local $6
(if i32
(i32.or
- (i32.ne
- (get_local $7)
- (i32.const 0)
- )
+ (get_local $7)
(tee_local $9
(i32.or
(i32.ne
diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise
index d95790044..8417befb4 100644
--- a/test/emcc_hello_world.fromasm.imprecise
+++ b/test/emcc_hello_world.fromasm.imprecise
@@ -6325,15 +6325,11 @@
(i32.const 1)
)
)
- (i32.eqz
- (i32.eqz
- (i32.and
- (i32.load
- (get_local $0)
- )
- (i32.const 32)
- )
+ (i32.and
+ (i32.load
+ (get_local $0)
)
+ (i32.const 32)
)
)
)
@@ -7029,10 +7025,7 @@
(set_local $6
(if i32
(i32.or
- (i32.ne
- (get_local $7)
- (i32.const 0)
- )
+ (get_local $7)
(tee_local $9
(i32.or
(i32.ne
diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt
index 226f1766e..cb043f155 100644
--- a/test/passes/optimize-instructions.txt
+++ b/test/passes/optimize-instructions.txt
@@ -373,6 +373,26 @@
(call $ne0)
(nop)
)
+ (if
+ (i32.or
+ (call $ne0)
+ (call $ne0)
+ )
+ (nop)
+ )
+ (if
+ (i32.and
+ (i32.ne
+ (call $ne0)
+ (i32.const 0)
+ )
+ (i32.ne
+ (call $ne0)
+ (i32.const 0)
+ )
+ )
+ (nop)
+ )
(i32.const 1)
)
(func $recurse-bool (type $1)
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast
index dfa6365f9..3cf756548 100644
--- a/test/passes/optimize-instructions.wast
+++ b/test/passes/optimize-instructions.wast
@@ -294,6 +294,22 @@
(if (i32.ne (i32.const 0) (call $ne0))
(nop)
)
+ ;; through an or
+ (if
+ (i32.or
+ (i32.ne (i32.const 0) (call $ne0))
+ (i32.ne (i32.const 0) (call $ne0))
+ )
+ (nop)
+ )
+ ;; but not an and
+ (if
+ (i32.and
+ (i32.ne (i32.const 0) (call $ne0))
+ (i32.ne (i32.const 0) (call $ne0))
+ )
+ (nop)
+ )
(i32.const 1)
)
(func $recurse-bool