summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions_all-features.wast
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2020-09-29 02:43:46 +0300
committerGitHub <noreply@github.com>2020-09-28 16:43:46 -0700
commit5a4db93bac7e123910ea173bb0a9c9f61bc6ee78 (patch)
tree54a486ef971888eee3d5257059ea2e0bdf0886f7 /test/passes/optimize-instructions_all-features.wast
parentc721f85e79f97936f4804afe51dcd2859ad13afd (diff)
downloadbinaryen-5a4db93bac7e123910ea173bb0a9c9f61bc6ee78.tar.gz
binaryen-5a4db93bac7e123910ea173bb0a9c9f61bc6ee78.tar.bz2
binaryen-5a4db93bac7e123910ea173bb0a9c9f61bc6ee78.zip
Lower signed binops to unsigned binops when possible (#2988)
This can unlock further instruction optimizations that do not apply to signed operations.
Diffstat (limited to 'test/passes/optimize-instructions_all-features.wast')
-rw-r--r--test/passes/optimize-instructions_all-features.wast65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast
index 1b03782e9..a89a16c1b 100644
--- a/test/passes/optimize-instructions_all-features.wast
+++ b/test/passes/optimize-instructions_all-features.wast
@@ -4354,6 +4354,71 @@
)
))
)
+ (func $unsigned-context (param $x i32) (param $y i64)
+ (drop (i32.div_s
+ (i32.and
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ )
+ (i32.const 3)
+ ))
+ (drop (i32.div_s
+ (i32.and
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ )
+ (i32.const -3) ;; skip
+ ))
+ (drop (i32.div_s
+ (i32.and
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ )
+ (i32.const 0x80000000) ;; skip
+ ))
+ (drop (i64.div_s
+ (i64.and
+ (local.get $y)
+ (i64.const 0x7fffffffffffffff)
+ )
+ (i64.const 2)
+ ))
+ (drop (i64.div_s
+ (i64.and
+ (local.get $y)
+ (i64.const 0x7fffffffffffffff)
+ )
+ (i64.const -1) ;; skip
+ ))
+ (drop (i32.rem_s
+ (i32.and
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ )
+ (i32.const 3)
+ ))
+ (drop (i32.shr_s
+ (i32.and
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ )
+ (i32.const 7)
+ ))
+ (drop (i32.ge_s
+ (i32.and
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ )
+ (i32.const 7)
+ ))
+ (drop (i32.ge_s
+ (i32.and
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ )
+ (i32.const -7) ;; skip
+ ))
+ )
(func $duplicate-elimination (param $x i32) (param $y i32) (param $z i32) (param $w f64)
;; unary
(drop (f64.abs (f64.abs (local.get $w))))