diff options
author | Max Graey <maxgraey@gmail.com> | 2022-09-06 23:56:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 13:56:06 -0700 |
commit | bd5422c8f13265cf89bdf49f30a04b882ee91d0e (patch) | |
tree | 86f6158549557dfed7da1f5c48a34dc8a6eeff5d /test/lit/passes/optimize-instructions-sign-ext.wast | |
parent | e584f69e12b261740da6da87f0cc4550f2312bdb (diff) | |
download | binaryen-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.wast | 18 |
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 |