summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions_all-features.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/passes/optimize-instructions_all-features.wast')
-rw-r--r--test/passes/optimize-instructions_all-features.wast147
1 files changed, 147 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast
index cf35668d5..b28536519 100644
--- a/test/passes/optimize-instructions_all-features.wast
+++ b/test/passes/optimize-instructions_all-features.wast
@@ -4670,6 +4670,7 @@
(local.get $y)
(i64.const -1)
))
+ ;; (unsigned)x > -1 ==> 0
(drop (i32.gt_u
(local.get $x)
(i32.const -1)
@@ -4709,6 +4710,24 @@
(local.get $y)
(i64.const -1)
))
+ ;; (unsigned)x >= -1 ==> x == -1
+ (drop (i32.ge_u
+ (local.get $x)
+ (i32.const -1)
+ ))
+ (drop (i64.ge_u
+ (local.get $y)
+ (i64.const -1)
+ ))
+ ;; (unsigned)x < -1 ==> x != -1
+ (drop (i32.lt_u
+ (local.get $x)
+ (i32.const -1)
+ ))
+ (drop (i64.lt_u
+ (local.get $y)
+ (i64.const -1)
+ ))
;; x * -1
(drop (i32.mul
(local.get $x)
@@ -4786,6 +4805,134 @@
(i64.const -9223372036854775808)
))
+ ;; (unsigned)x >= 0 => i32(1)
+ (drop (i32.ge_u
+ (local.get $x)
+ (i32.const 0)
+ ))
+ (drop (i64.ge_u
+ (local.get $y)
+ (i64.const 0)
+ ))
+
+ ;; (unsigned)x < 0 => i32(0)
+ (drop (i32.lt_u
+ (local.get $x)
+ (i32.const 0)
+ ))
+ (drop (i64.lt_u
+ (local.get $y)
+ (i64.const 0)
+ ))
+
+ ;; (unsigned)x > 0 => x != 0
+ (drop (i32.gt_u
+ (local.get $x)
+ (i32.const 0)
+ ))
+ (drop (i64.gt_u
+ (local.get $y)
+ (i64.const 0)
+ ))
+
+ ;; (unsigned)x <= 0 => x == 0
+ (drop (i32.le_u
+ (local.get $x)
+ (i32.const 0)
+ ))
+ (drop (i64.le_u
+ (local.get $y)
+ (i64.const 0)
+ ))
+
+ ;; i32(x) <= 0x7fffffff => i32(1)
+ (drop (i32.le_s
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ ))
+ ;; i64(x) <= 0x7fffffffffffffff => i32(1)
+ (drop (i64.le_s
+ (local.get $y)
+ (i64.const 0x7fffffffffffffff)
+ ))
+
+ ;; i32(x) >= 0x80000000 => i32(1)
+ (drop (i32.ge_s
+ (local.get $x)
+ (i32.const 0x80000000)
+ ))
+ ;; i64(x) >= 0x8000000000000000 => i32(1)
+ (drop (i64.ge_s
+ (local.get $y)
+ (i64.const 0x8000000000000000)
+ ))
+
+ ;; i32(x) < 0x80000000 => 0
+ (drop (i32.lt_s
+ (local.get $x)
+ (i32.const 0x80000000)
+ ))
+ ;; i64(x) < 0x8000000000000000 => 0
+ (drop (i64.lt_s
+ (local.get $y)
+ (i64.const 0x8000000000000000)
+ ))
+
+ ;; i32(x) > 0x7fffffff => 0
+ (drop (i32.gt_s
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ ))
+ ;; i64(x) > 0x7fffffffffffffff => 0
+ (drop (i64.gt_s
+ (local.get $y)
+ (i64.const 0x7fffffffffffffff)
+ ))
+
+ ;; i32(x) < 0x7fffffff => x != 0x7fffffff
+ (drop (i32.lt_s
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ ))
+ ;; i64(x) < 0x7fffffffffffffff => x != 0x7fffffffffffffff
+ (drop (i64.lt_s
+ (local.get $y)
+ (i64.const 0x7fffffffffffffff)
+ ))
+
+ ;; i32(x) > 0x80000000 => x != 0x80000000
+ (drop (i32.gt_s
+ (local.get $x)
+ (i32.const 0x80000000)
+ ))
+ ;; i64(x) > 0x8000000000000000 => x != 0x8000000000000000
+ (drop (i64.gt_s
+ (local.get $y)
+ (i64.const 0x8000000000000000)
+ ))
+
+ ;; i32(x) <= 0x80000000 => x == 0x80000000
+ (drop (i32.le_s
+ (local.get $x)
+ (i32.const 0x80000000)
+ ))
+ ;; i64(x) <= 0x8000000000000000 => x == 0x8000000000000000
+ (drop (i64.le_s
+ (local.get $y)
+ (i64.const 0x8000000000000000)
+ ))
+
+ ;; i32(x) >= 0x7fffffff => x == 0x7fffffff
+ (drop (i32.ge_s
+ (local.get $x)
+ (i32.const 0x7fffffff)
+ ))
+ ;; i64(x) >= 0x7fffffffffffffff => x == 0x7fffffffffffffff
+ (drop (i64.ge_s
+ (local.get $y)
+ (i64.const 0x7fffffffffffffff)
+ ))
+
;; -x * 1 => x * -1
(drop (f32.mul
(f32.neg