diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/optimize-instructions_all-features.txt | 46 | ||||
-rw-r--r-- | test/passes/optimize-instructions_all-features.wast | 32 |
2 files changed, 76 insertions, 2 deletions
diff --git a/test/passes/optimize-instructions_all-features.txt b/test/passes/optimize-instructions_all-features.txt index d4ff1ead6..64b2d787b 100644 --- a/test/passes/optimize-instructions_all-features.txt +++ b/test/passes/optimize-instructions_all-features.txt @@ -3947,9 +3947,51 @@ ) ) (drop - (i64.div_u + (i64.extend_i32_u + (i64.eq + (local.get $y) + (i64.const -1) + ) + ) + ) + ) + (func $rhs-is-neg-const (param $x i32) (param $y i64) + (drop + (i32.ge_u + (local.get $x) + (i32.const -2) + ) + ) + (drop + (i32.eq + (local.get $x) + (i32.const -1) + ) + ) + (drop + (i32.ge_u + (local.get $x) + (i32.const -2147483647) + ) + ) + (drop + (i32.shr_u + (local.get $x) + (i32.const 31) + ) + ) + (drop + (i64.extend_i32_u + (i64.eq + (local.get $y) + (i64.const -1) + ) + ) + ) + (drop + (i64.shr_u (local.get $y) - (i64.const -1) + (i64.const 63) ) ) ) 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 |