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.wast52
1 files changed, 51 insertions, 1 deletions
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast
index c9f071727..cdd203fa4 100644
--- a/test/passes/optimize-instructions_all-features.wast
+++ b/test/passes/optimize-instructions_all-features.wast
@@ -4688,7 +4688,7 @@
(i64.const -1)
))
)
- (func $rhs-is-const (param $x i32) (param $y i64)
+ (func $rhs-is-const (param $x i32) (param $y i64) (param $fx f32) (param $fy f64)
;; signed divs
;; i32(x) / -2147483648 -> x == -2147483648
(drop (i32.div_s
@@ -4737,6 +4737,56 @@
(local.get $y)
(i64.const -9223372036854775808)
))
+
+ ;; -x * 1 => x * -1
+ (drop (f32.mul
+ (f32.neg
+ (local.get $fx)
+ )
+ (f32.const 1)
+ ))
+ ;; -x * -2.1 => x * 2.1
+ (drop (f64.mul
+ (f64.neg
+ (local.get $fy)
+ )
+ (f64.const -2.1)
+ ))
+ ;; 2 * -x => x * -2
+ (drop (f64.mul
+ (f64.const 2)
+ (f64.neg
+ (local.get $fy)
+ )
+ ))
+ ;; -x / inf => x / -inf
+ (drop (f32.div
+ (f32.neg
+ (local.get $fx)
+ )
+ (f32.const inf)
+ ))
+ ;; -x / -0.0 => x / 0.0
+ (drop (f64.div
+ (f64.neg
+ (local.get $fy)
+ )
+ (f64.const -0.0)
+ ))
+ ;; -x / nan => x / -nan
+ (drop (f64.div
+ (f64.neg
+ (local.get $fy)
+ )
+ (f64.const nan)
+ ))
+ ;; 5.0 / -x => -5 / x
+ (drop (f64.div
+ (f64.const 5)
+ (f64.neg
+ (local.get $fy)
+ )
+ ))
)
(func $pre-combine-or (param $x i32) (param $y i32)
(drop (i32.or