summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/optimize-instructions_all-features.txt27
-rw-r--r--test/passes/optimize-instructions_all-features.wast24
2 files changed, 45 insertions, 6 deletions
diff --git a/test/passes/optimize-instructions_all-features.txt b/test/passes/optimize-instructions_all-features.txt
index edebe0bc2..f43316f3d 100644
--- a/test/passes/optimize-instructions_all-features.txt
+++ b/test/passes/optimize-instructions_all-features.txt
@@ -3018,12 +3018,9 @@
)
)
(drop
- (i32.ne
- (i32.and
- (local.get $x)
- (i32.const 1)
- )
- (i32.const 0)
+ (i32.and
+ (local.get $x)
+ (i32.const 1)
)
)
(drop
@@ -3868,6 +3865,24 @@
(drop
(i64.const 1)
)
+ (drop
+ (i32.and
+ (local.get $x)
+ (i32.const 1)
+ )
+ )
+ (drop
+ (i64.ne
+ (local.get $y)
+ (i64.const 0)
+ )
+ )
+ (drop
+ (i32.ne
+ (local.get $x)
+ (i32.const 0)
+ )
+ )
)
(func $optimize-bitwise-oprations (param $x i32) (param $y i32) (param $z i64) (param $w i64)
(drop
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast
index cf3938cdf..934ccc977 100644
--- a/test/passes/optimize-instructions_all-features.wast
+++ b/test/passes/optimize-instructions_all-features.wast
@@ -4395,6 +4395,30 @@
)
(i64.const 1)
))
+ ;; i32(bool(expr)) != 0 -> i32(bool(expr))
+ (drop (i32.ne
+ (i32.and
+ (local.get $x)
+ (i32.const 1)
+ )
+ (i32.const 0)
+ ))
+ ;; i32(bool(expr)) != 0 -> i32(bool(expr))
+ (drop (i32.ne
+ (i64.ne
+ (local.get $y)
+ (i64.const 0)
+ )
+ (i32.const 0)
+ ))
+ ;; (i32(expr) != 0) != 0 -> (expr != 0)
+ (drop (i32.ne
+ (i32.ne
+ (local.get $x)
+ (i32.const 0)
+ )
+ (i32.const 0)
+ ))
)
(func $optimize-bitwise-oprations (param $x i32) (param $y i32) (param $z i64) (param $w i64)
;; ~(1 << x) -> rotl(-2, x)