summaryrefslogtreecommitdiff
path: root/test/lit/passes/optimize-instructions-sign-ext.wast
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2022-09-06 23:56:06 +0300
committerGitHub <noreply@github.com>2022-09-06 13:56:06 -0700
commitbd5422c8f13265cf89bdf49f30a04b882ee91d0e (patch)
tree86f6158549557dfed7da1f5c48a34dc8a6eeff5d /test/lit/passes/optimize-instructions-sign-ext.wast
parente584f69e12b261740da6da87f0cc4550f2312bdb (diff)
downloadbinaryen-bd5422c8f13265cf89bdf49f30a04b882ee91d0e.tar.gz
binaryen-bd5422c8f13265cf89bdf49f30a04b882ee91d0e.tar.bz2
binaryen-bd5422c8f13265cf89bdf49f30a04b882ee91d0e.zip
[OptimizeInstructions] Simplify two binary expressions with asymmetric shifts and same constant (#4996)
(x >> C) << C -> x & -(1 << C) (x >>> C) << C -> x & -(1 << C) (x << C) >>> C -> x & (-1 >>> C) // (x << C) >> C doesn't support Found by the superoptimizer #4994 Fixes #5012
Diffstat (limited to 'test/lit/passes/optimize-instructions-sign-ext.wast')
-rw-r--r--test/lit/passes/optimize-instructions-sign-ext.wast18
1 files changed, 6 insertions, 12 deletions
diff --git a/test/lit/passes/optimize-instructions-sign-ext.wast b/test/lit/passes/optimize-instructions-sign-ext.wast
index 70572e616..207703904 100644
--- a/test/lit/passes/optimize-instructions-sign-ext.wast
+++ b/test/lit/passes/optimize-instructions-sign-ext.wast
@@ -87,21 +87,15 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (i32.shr_u
- ;; CHECK-NEXT: (i32.shl
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (i32.const 24)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (i32.const 24)
+ ;; CHECK-NEXT: (i32.and
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: (i32.const 255)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (i32.shr_u
- ;; CHECK-NEXT: (i32.shl
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (i32.const 16)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (i32.const 16)
+ ;; CHECK-NEXT: (i32.and
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: (i32.const 65535)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop