summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions_all-features.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/passes/optimize-instructions_all-features.wast')
-rw-r--r--test/passes/optimize-instructions_all-features.wast32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast
index 505f89ea2..e84778fde 100644
--- a/test/passes/optimize-instructions_all-features.wast
+++ b/test/passes/optimize-instructions_all-features.wast
@@ -4452,6 +4452,38 @@
(i64.const -1)
))
)
+ (func $rhs-is-neg-const (param $x i32) (param $y i64)
+ ;; u32(x) / -2 => x >= -2
+ (drop (i32.div_u
+ (local.get $x)
+ (i32.const -2)
+ ))
+ ;; u32(x) / -1 => x == -1
+ (drop (i32.div_u
+ (local.get $x)
+ (i32.const -1)
+ ))
+ ;; u32(x) / (i32.min + 1)
+ (drop (i32.div_u
+ (local.get $x)
+ (i32.const -2147483647)
+ ))
+ ;; u32(x) / i32.min => x >>> 31
+ (drop (i32.div_u
+ (local.get $x)
+ (i32.const -2147483648)
+ ))
+ ;; u64(x) / -1 => u64(x == -1)
+ (drop (i64.div_u
+ (local.get $y)
+ (i64.const -1)
+ ))
+ ;; u64(x) / i64.min => x >>> 63
+ (drop (i64.div_u
+ (local.get $y)
+ (i64.const -9223372036854775808)
+ ))
+ )
(func $pre-combine-or (param $x i32) (param $y i32)
(drop (i32.or
(i32.gt_s