diff options
author | Max Graey <maxgraey@gmail.com> | 2020-10-20 22:35:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 12:35:36 -0700 |
commit | 8b31756134ba4460d1dc5320198a87f88af2443c (patch) | |
tree | 2b675ce14dc02a6801b4b6cedb2cec617d7806bc /test/passes/optimize-instructions_all-features.wast | |
parent | c0c3812dfde2b8086b2fdd603e0d70705ec8a1e4 (diff) | |
download | binaryen-8b31756134ba4460d1dc5320198a87f88af2443c.tar.gz binaryen-8b31756134ba4460d1dc5320198a87f88af2443c.tar.bz2 binaryen-8b31756134ba4460d1dc5320198a87f88af2443c.zip |
Optimize signed division when RHS is signed minimum (#3221)
Diffstat (limited to 'test/passes/optimize-instructions_all-features.wast')
-rw-r--r-- | test/passes/optimize-instructions_all-features.wast | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast index 934ccc977..60ae8d3c2 100644 --- a/test/passes/optimize-instructions_all-features.wast +++ b/test/passes/optimize-instructions_all-features.wast @@ -4638,7 +4638,25 @@ (i64.const -1) )) ) - (func $rhs-is-neg-const (param $x i32) (param $y i64) + (func $rhs-is-const (param $x i32) (param $y i64) + ;; signed divs + ;; i32(x) / -2147483648 -> x == -2147483648 + (drop (i32.div_s + (local.get $x) + (i32.const -2147483648) + )) + ;; i64(x) / -9223372036854775808 -> x == -9223372036854775808 + (drop (i64.div_s + (local.get $y) + (i64.const -9223372036854775808) + )) + ;; skip + (drop (i64.div_s + (local.get $y) + (i64.const -2147483648) + )) + + ;; unsigned divs ;; u32(x) / -2 => x >= -2 (drop (i32.div_u (local.get $x) |